:root {
  color-scheme: light;
  --ink: #2D3A3A;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --page: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --good: #2ABFBF;
  --warn: #EDAA88;
  --bad: #d4473f;
  --accent: #2ABFBF;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(42, 191, 191, 0.10), transparent 32rem),
    linear-gradient(180deg, #fbfbfd 0%, var(--page) 100%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.toolbar,
.settings,
.metric-card,
.current-grid article,
.table-panel,
.status {
  background: var(--surface);
  border: 1px solid rgba(229, 229, 234, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(250px, 0.72fr) minmax(0, 1.28fr);
  gap: 28px;
  align-items: center;
  padding: 24px;
  border-radius: 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 5.6rem);
  line-height: 0.92;
  letter-spacing: 0;
  font-weight: 750;
}

.brand-logo {
  display: block;
  width: min(300px, 76vw);
  height: auto;
}

.toolbar p,
.panel-header p,
.metric-card small,
.status {
  color: var(--muted);
}

.toolbar p {
  max-width: 34ch;
  margin-top: 12px;
  font-size: 1.02rem;
  line-height: 1.4;
}

.controls {
  display: grid;
  gap: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1.35fr) minmax(160px, 1.05fr) minmax(112px, 0.72fr) minmax(112px, 0.72fr);
  gap: 10px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

select,
input,
button {
  min-height: 34px;
  border-radius: 11px;
  font: inherit;
}

select,
input[type="number"],
input[type="search"],
input[type="text"] {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 0 10px;
  font-size: 0.92rem;
  outline: none;
}

select:focus,
input:focus {
  border-color: rgba(42, 191, 191, 0.50);
  box-shadow: 0 0 0 4px rgba(42, 191, 191, 0.13);
}

button {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 0 15px;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}

button:hover {
  background: #25AFAF;
}

button[type="button"] {
  background: rgba(0, 0, 0, 0.07);
  color: var(--ink);
}

button[type="button"]:hover {
  background: rgba(0, 0, 0, 0.11);
}

.settings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 22px;
}

.app-shell.hide-advanced th:nth-child(4),
.app-shell.hide-advanced td:nth-child(4),
.app-shell.hide-advanced th:nth-child(5),
.app-shell.hide-advanced td:nth-child(5),
.app-shell.hide-advanced th:nth-child(6),
.app-shell.hide-advanced td:nth-child(6) {
  display: none;
}

.settings label {
  grid-template-columns: minmax(84px, auto) 1fr 66px;
  align-items: center;
  font-size: 0.84rem;
}

input[type="range"] {
  min-height: auto;
  accent-color: var(--accent);
}

.status {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.92rem;
  font-weight: 580;
}

.status.error {
  color: var(--bad);
  border-color: rgba(212, 71, 63, 0.28);
}

.summary-grid,
.current-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.summary-grid {
  grid-template-columns: 1.35fr repeat(3, 1fr);
}

.current-grid {
  grid-template-columns: repeat(6, 1fr);
}

.metric-card,
.current-grid article {
  min-height: 112px;
  padding: 18px;
  border-radius: 22px;
}

.metric-card span,
.current-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
}

.metric-card strong,
.current-grid strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.25rem, 2.5vw, 2.05rem);
  line-height: 1.05;
  font-weight: 720;
  letter-spacing: 0;
}

.current-grid strong {
  white-space: nowrap;
  font-size: clamp(1.18rem, 2.05vw, 1.86rem);
}

.metric-card small {
  display: block;
  margin-top: 8px;
  line-height: 1.35;
  font-size: 0.86rem;
}

.verdict-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 16px;
  align-items: center;
}

.verdict-card.good strong {
  color: var(--good);
}

.verdict-card.ok strong {
  color: var(--warn);
}

.verdict-card.bad strong {
  color: var(--bad);
}

.verdict-card.unknown strong {
  color: var(--muted);
}

.verdict-visual {
  width: 104px;
  height: 104px;
  justify-self: end;
}

.verdict-visual path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 8;
  opacity: 0;
  transform-origin: center;
  transition: opacity 180ms ease, transform 180ms ease;
}

.calm-line {
  stroke: var(--good);
}

.soft-wave {
  stroke: var(--warn);
}

.rough-zigzag {
  stroke: var(--bad);
}

.unknown-line {
  stroke: #2D3A3A;
}

.verdict-card.good .calm-line,
.verdict-card.ok .soft-wave,
.verdict-card.bad .rough-zigzag,
.verdict-card.unknown .unknown-line {
  opacity: 1;
  transform: scale(1);
}

.verdict-card.ok .wave-two {
  opacity: 0.72;
}

.table-panel {
  margin-top: 14px;
  border-radius: 24px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

h2 {
  font-size: 1.12rem;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 680;
}

tbody tr:hover {
  background: rgba(42, 191, 191, 0.045);
}

.pill {
  display: inline-flex;
  min-width: 84px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 680;
}

.pill.good {
  background: rgba(29, 154, 108, 0.12);
  color: var(--good);
}

.pill.ok {
  background: rgba(195, 138, 24, 0.14);
  color: var(--warn);
}

.pill.bad {
  background: rgba(212, 71, 63, 0.12);
  color: var(--bad);
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  justify-items: end;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
}

.settings-overlay[hidden] {
  display: none;
}

.settings-sheet {
  width: min(520px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 22px;
  background: rgba(250, 250, 252, 0.96);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.18);
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.sheet-header p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.07);
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.sheet-section {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.sheet-section h3 {
  margin: 0 0 13px;
  font-size: 0.95rem;
}

.settings-form-grid,
.favorite-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.spot-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-form-grid label,
.favorite-row label {
  text-transform: none;
}

.settings-form-grid input,
.settings-form-grid select,
.favorite-row select {
  min-height: 36px;
}

.settings-form-grid .range-setting {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 10px;
}

.settings-form-grid .range-setting > span:first-child {
  grid-column: 1;
  grid-row: 1;
}

.settings-form-grid .range-setting > span:last-child {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.settings-form-grid .range-setting > input[type="range"] {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
}

.toggle-label {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

.toggle-label input {
  min-height: auto;
}

.sheet-actions,
.favorite-row {
  margin-top: 12px;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.favorite-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}

.learning-summary {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(42, 191, 191, 0.10);
}

.learning-summary strong {
  font-size: 0.96rem;
}

.learning-summary span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.observation-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.observation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.observation-item strong {
  display: block;
  font-size: 0.9rem;
}

.observation-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.observation-item button {
  min-height: 30px;
  padding: 0 10px;
}


@media (max-width: 1000px) {
  .toolbar,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .current-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 761px) and (max-width: 1000px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-grid .metric-card:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 22px, 1180px);
    padding-top: 14px;
  }

  .toolbar,
  .settings,
  .metric-card,
  .current-grid article {
    border-radius: 20px;
    padding: 14px;
  }

  .field-grid,
  .settings,
  .current-grid {
    grid-template-columns: 1fr;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .settings label {
    grid-template-columns: 82px 1fr 66px;
  }

  .verdict-card {
    grid-template-columns: minmax(0, 1fr) 82px;
  }

  .verdict-visual {
    width: 82px;
    height: 82px;
  }

  .panel-header {
    display: grid;
    padding: 16px;
  }

  table {
    min-width: 0;
  }

  th,
  td {
    padding: 11px 10px;
    font-size: 0.86rem;
  }

  th:nth-child(4),
  td:nth-child(4),
  th:nth-child(5),
  td:nth-child(5),
  th:nth-child(6),
  td:nth-child(6),
  th:nth-child(8),
  td:nth-child(8) {
    display: none;
  }

  .settings-sheet {
    width: 100%;
    padding: 16px;
  }

  .settings-form-grid,
  .spot-grid,
  .favorite-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.5rem;
  }

  .verdict-card {
    grid-template-columns: 1fr;
  }

  .verdict-visual {
    justify-self: start;
  }

  th:nth-child(3),
  td:nth-child(3) {
    display: none;
  }
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: -24px auto 40px;
  padding: 0 18px;
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 520;
  line-height: 1.5;
  text-align: center;
  -webkit-font-smoothing: antialiased;
}

.footer-copy {
  margin: 0;
}

.footer-copy span {
  display: inline;
}

.footer-copy span + span::before {
  content: " ";
}

.footer-links {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
}

.footer-links a {
  color: var(--good);
  font: inherit;
  font-weight: 720;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-links a + a::before {
  content: "·";
  margin-right: 14px;
  color: var(--muted);
  font-weight: 520;
}


.footer-copyright {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 620;
}
