@font-face {
  font-family: "OPlus Sans";
  src: url("./fonts/OPPO%20Sans%204.0.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #183038;
  --ink-soft: #5f7074;
  --paper: #f4f6f2;
  --surface: #ffffff;
  --line: #dce3de;
  --sage: #587c70;
  --sage-dark: #315c51;
  --sage-pale: #e8f0eb;
  --blue: #466e8a;
  --blue-pale: #e8f0f5;
  --sand: #d8bd86;
  --sand-pale: #f6f0e4;
  --danger: #a64843;
  --shadow: 0 24px 60px rgba(39, 59, 54, 0.08);
  font-family: "OPlus Sans", "OPPO Sans", "Microsoft YaHei UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.42)),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc(25% - 1px),
      rgba(73, 104, 94, 0.035) 25%
    ),
    var(--paper);
}

button,
input {
  font: inherit;
}

button,
summary,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

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

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  min-height: 250px;
  padding: 38px 52px;
  overflow: hidden;
  color: #f8fbf8;
  background:
    radial-gradient(circle at 78% 18%, rgba(224, 235, 224, 0.14), transparent 28%),
    linear-gradient(135deg, #254a48 0%, #183b3d 55%, #153238 100%);
  border-radius: 28px 28px 0 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #b9d7c3;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(185, 215, 195, 0.12);
}

h1 {
  max-width: none;
  margin: 22px 0 7px;
  font-size: clamp(42px, 5.2vw, 70px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.hero-title-en {
  margin: 0 0 15px;
  color: rgba(248, 251, 248, 0.5);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.14em;
}

.hero-copy {
  max-width: none;
  margin: 0;
  color: rgba(248, 251, 248, 0.72);
  font-size: 14px;
  line-height: 1.45;
  white-space: nowrap;
}

.hero-copy-en {
  margin: 4px 0 0;
  color: rgba(248, 251, 248, 0.42);
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.hero-author {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 14px;
  padding: 0 12px 16px 48px;
  color: rgba(248, 251, 248, 0.68);
}

.hero-author-rule {
  width: 38px;
  height: 1px;
  background: rgba(215, 228, 215, 0.5);
}

.hero-author div {
  display: grid;
  gap: 5px;
}

.hero-author small {
  color: rgba(248, 251, 248, 0.42);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.hero-author strong {
  color: #edf4ef;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(720px, 2fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  box-shadow: var(--shadow);
}

.input-panel,
.results-panel {
  padding: 38px 42px 44px;
}

.input-panel {
  background: #fafbf9;
  border-right: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.step {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--sage-dark);
  background: var(--sage-pale);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.section-heading p {
  margin: 4px 0 0;
  color: #8b9996;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field {
  margin-top: 30px;
}

.field label {
  display: block;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 700;
}

.field label span {
  color: var(--ink-soft);
  font-weight: 500;
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
  height: 56px;
  padding: 0 58px 0 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #cfd9d3;
  border-radius: 12px;
  outline: none;
  font-size: 20px;
  font-weight: 650;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.input-wrap input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(88, 124, 112, 0.1);
}

.input-wrap input.invalid {
  border-color: var(--danger);
}

.unit {
  position: absolute;
  top: 50%;
  right: 16px;
  color: #71817d;
  font-size: 12px;
  font-weight: 700;
  transform: translateY(-50%);
}

.field-help,
.field-error {
  min-height: 17px;
  margin: 7px 2px 0;
  font-size: 11px;
}

.field-help {
  color: #8c9996;
}

.field-error {
  min-height: 0;
  color: var(--danger);
}

.field-error:not(:empty) + * {
  margin-top: 0;
}

.advanced {
  margin-top: 26px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.advanced summary {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 700;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.summary-note {
  color: #9aa6a3;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.switch-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row strong {
  font-size: 12px;
}

.switch-row small {
  margin-top: 4px;
  color: #83918e;
  font-size: 10px;
}

.switch-row input {
  position: absolute;
  opacity: 0;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  background: #c9d2ce;
  border-radius: 999px;
  transition: background 160ms ease;
}

.switch::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  content: "";
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(20, 40, 35, 0.2);
  transition: transform 160ms ease;
}

.switch-row input:checked + .switch {
  background: var(--sage);
}

.switch-row input:checked + .switch::after {
  transform: translateX(18px);
}

.switch-row input:focus-visible + .switch {
  outline: 3px solid rgba(88, 124, 112, 0.25);
  outline-offset: 2px;
}

.switch-impact {
  margin: 0;
  padding: 0 0 14px;
  color: #71817d;
  font-size: 10px;
  line-height: 1.5;
}

.input-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.button.primary {
  color: white;
  background: var(--sage-dark);
}

.button.primary:hover {
  background: #244c43;
}

.button.ghost {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--line);
}

.results-panel {
  min-width: 0;
}

.results-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.k-readout {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 0 14px;
  text-align: right;
}

.k-readout-copy {
  display: grid;
  gap: 4px;
}

.k-readout span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.k-readout strong {
  font-size: 46px;
  font-weight: 500;
  line-height: 0.9;
}

.k-readout small {
  color: #91a09c;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.boundary-warning {
  margin-top: 22px;
  padding: 12px 14px;
  color: #775f2c;
  background: var(--sand-pale);
  border: 1px solid #e6d7b8;
  border-radius: 10px;
  font-size: 12px;
}

.result-table-wrap {
  margin-top: 30px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.result-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  table-layout: fixed;
}

.result-table th,
.result-table td {
  padding: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.result-table tr:last-child th,
.result-table tr:last-child td {
  border-bottom: 0;
}

.result-table th:last-child,
.result-table td:last-child {
  border-right: 0;
}

.result-table thead th {
  height: 60px;
  padding: 8px 6px;
  color: #29464a;
  background: #eef3ef;
  border-bottom: 2px solid #a9bbb4;
  font-weight: 800;
  line-height: 1.2;
}

.result-table thead th span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.result-table thead th small {
  display: block;
  margin-top: 4px;
  color: #7d918a;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.1em;
}

.result-table tbody th {
  width: 16%;
  background: #f4f7f4;
}

.type-pill {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: white;
  border-radius: 9px;
  font-size: 16px;
  font-weight: 800;
}

.type-b {
  background: #698a80;
}

.type-c {
  background: #486f77;
}

.type-d {
  background: #394f5b;
}

.result-cell {
  position: relative;
  width: 100%;
  min-height: 94px;
  padding: 14px 6px 12px;
  color: var(--ink);
  background: white;
}

.result-cell strong {
  display: block;
}

.result-cell strong {
  font-size: 28px;
  font-weight: 560;
  line-height: 1;
}

.empty-row td {
  height: 280px;
  color: #8b9995;
  font-size: 13px;
}

footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 48px;
  padding: 32px 52px;
  color: #d6e0dc;
  background: #182f33;
  border-radius: 0 0 28px 28px;
}

footer strong {
  display: block;
  font-size: 12px;
}

footer .engineering-notice > small {
  display: block;
  margin-top: 4px;
  color: #78908c;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.13em;
}

footer p {
  max-width: 780px;
  margin: 9px 0 0;
  color: #98aaa6;
  font-size: 10px;
  line-height: 1.7;
}

footer .engineering-notice-en {
  margin-top: 4px;
  color: #718784;
  font-size: 9px;
  line-height: 1.55;
}

.source-links {
  display: grid;
  flex: 0 0 auto;
  gap: 8px;
  justify-items: end;
  font-size: 9px;
}

.source-links a {
  color: #d9e6dd;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.source-links span {
  color: #829895;
}

.source-links .font-credit {
  max-width: 360px;
  color: #9eb0ac;
  line-height: 1.45;
  text-align: right;
}

@media (max-width: 1040px) {
  .app-shell {
    width: min(100% - 28px, 920px);
    padding-top: 20px;
  }

  .hero {
    min-height: 240px;
    padding: 34px;
  }

  .hero-author {
    padding-right: 0;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .input-panel,
  .results-panel {
    padding: 32px;
  }

  .input-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 18px;
  }

  .input-panel > .section-heading,
  .advanced,
  .input-actions {
    grid-column: 1 / -1;
  }

  footer {
    padding-right: 34px;
    padding-left: 34px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: 100%;
    padding: 0;
  }

  .hero,
  footer {
    border-radius: 0;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 270px;
    padding: 34px 24px;
  }

  h1 {
    font-size: 46px;
    white-space: normal;
  }

  .hero-copy {
    font-size: 13px;
    white-space: normal;
  }

  .hero-copy-en {
    white-space: normal;
  }

  .hero-author {
    margin-top: 24px;
    padding: 0;
  }

  .input-panel,
  .results-panel,
  .method {
    padding: 28px 20px 32px;
  }

  .input-panel {
    display: block;
  }

  .results-topline {
    align-items: flex-start;
  }

  .k-readout {
    grid-template-columns: auto auto;
    gap: 10px;
  }

  .k-readout strong {
    font-size: 38px;
  }

  .k-readout small {
    font-size: 8px;
  }

  footer {
    display: block;
    padding: 28px 20px;
  }

  .source-links {
    margin-top: 22px;
    justify-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
