:root {
  color-scheme: light;
  --page: #b7ed55;
  --page-shadow: #96c93f;
  --page-ink: #17374a;
  --navy: #122b3d;
  --navy-soft: #203c4e;
  --cream: #fff9eb;
  --screen-ink: #17374a;
  --teal: #416b5d;
  --coral: #f2765f;
  --line: #b9cbb2;
  --muted: #637d70;
  --panel: #fff9eb;
  --panel-ink: #17374a;
  --panel-muted: #5e7669;
  --focus: #dd5843;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  background: var(--page);
  color: var(--page-ink);
  font: 16px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --page: #263b2d;
  --page-shadow: #1d3025;
  --page-ink: #f4f1e5;
  --navy: #102638;
  --navy-soft: #1a3749;
  --cream: #e8eedc;
  --screen-ink: #17374a;
  --teal: #416b5d;
  --coral: #fa8066;
  --line: #b9cbb2;
  --muted: #a8bea9;
  --panel: #173648;
  --panel-ink: #f4f1e5;
  --panel-muted: #b6c8b7;
  --focus: #ff9a83;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-frame {
  width: min(100% - 32px, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--page-ink);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 3px solid var(--navy);
  border-radius: 13px;
  background: var(--cream);
  color: var(--coral);
  font-size: 25px;
  font-weight: 850;
  line-height: 1;
}

.brand-copy { display: grid; gap: 1px; }
.brand-copy small { font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.brand-copy strong { font-size: 16px; font-weight: 780; letter-spacing: -.02em; }

.theme-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid var(--navy);
  border-radius: 14px;
  background: var(--cream);
  color: var(--navy);
  font-size: 21px;
  cursor: pointer;
}

main { flex: 1; padding: 8px 0 30px; }

.mode-tabs {
  width: fit-content;
  display: flex;
  gap: 6px;
  margin: 0 auto 22px;
  padding: 5px;
  border: 2px solid var(--navy);
  border-radius: 16px;
  background: var(--navy);
}

.mode-tab {
  min-width: 100px;
  min-height: 44px;
  padding: 8px 18px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #f7f4e9;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.mode-tab.is-active { background: var(--cream); color: var(--navy); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  align-items: center;
  gap: clamp(24px, 5vw, 64px);
}

.scale-column { width: 100%; max-width: 570px; margin: 0 auto; }

.scale-platform {
  width: 88%;
  height: 52px;
  position: relative;
  z-index: 1;
  margin: 0 auto;
  border: 8px solid var(--navy);
  border-radius: 24px;
  background: var(--cream);
  box-shadow: 0 4px 0 var(--page-shadow);
}

.scale-platform span {
  position: absolute;
  top: 9px;
  left: 7px;
  right: 7px;
  height: 5px;
  border-radius: 6px;
  background: #d7d7c8;
}

.scale-neck {
  width: 72px;
  height: 30px;
  margin: 0 auto;
  background: var(--navy);
  position: relative;
}

.scale-neck::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  top: 0;
  bottom: 0;
  border-radius: 0 0 4px 4px;
  background: var(--teal);
}

.scale-shell {
  position: relative;
  padding: 18px 20px 16px;
  border: 3px solid var(--navy);
  border-radius: 38px;
  background: var(--navy);
  box-shadow: 0 11px 0 var(--page-shadow), 0 17px 28px #122b3d20;
}

.scale-shell::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 8%;
  right: 8%;
  height: 5px;
  background: #2c4858;
}

.scale-screen {
  min-height: 238px;
  position: relative;
  padding: 17px 19px 14px;
  border-radius: 24px;
  background: var(--cream);
  color: var(--screen-ink);
}

.screen-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.screen-group {
  margin: 0;
  color: var(--teal);
  font-size: 16px;
  font-weight: 850;
  letter-spacing: .035em;
  line-height: 1.1;
}

.screen-caption {
  margin: 4px 0 0;
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .035em;
}

.screen-indicator {
  width: 9px;
  height: 9px;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px #416b5d1c;
}

.readout-row {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
}

#quantity {
  width: 100%;
  min-width: 0;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--screen-ink);
  font-size: clamp(42px, 7vw, 64px);
  font-weight: 780;
  letter-spacing: -.045em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#quantity:focus-visible { box-shadow: 0 2px 0 var(--coral); }

.readout-unit {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 21px;
  font-weight: 800;
}

.screen-rule { height: 3px; margin: 7px 0 9px; background: var(--line); }

.total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.total-value {
  color: var(--coral);
  font-size: clamp(30px, 5vw, 38px);
  font-weight: 850;
  letter-spacing: -.035em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.total-label {
  padding-right: 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .04em;
}

.unit-price-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 0 2px;
}

.unit-price-block label {
  color: #e6eddf;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .065em;
}

.price-entry {
  width: min(55%, 190px);
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 2px solid #466174;
  border-radius: 12px;
  background: var(--navy-soft);
  color: var(--coral);
}

.dollar-prefix { font-size: 19px; font-weight: 850; }

#unit-price {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff9eb;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#unit-price::placeholder { color: #c6d1cd; font-size: 14px; font-weight: 500; opacity: .9; }

.unit-keys {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.unit-key {
  min-width: 0;
  min-height: 48px;
  padding: 8px 5px;
  border: 0;
  border-radius: 13px;
  background: var(--cream);
  color: var(--teal);
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  transition: transform .12s ease, background-color .12s ease;
}

.unit-key.is-active { background: var(--coral); color: var(--navy); }
.unit-key:active { transform: translateY(1px); }

.scale-bottom-row {
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.feedback {
  min-height: 20px;
  margin: 0;
  color: #d9e2da;
  font-size: 11px;
}

.feedback.has-error { color: #ff9a83; }

.reset-button {
  min-height: 35px;
  flex: 0 0 auto;
  padding: 5px 11px;
  border: 1px solid #668090;
  border-radius: 10px;
  background: transparent;
  color: #f4f1e5;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.comparison-panel {
  width: 100%;
  padding: 23px 24px 20px;
  border: 3px solid var(--navy);
  border-radius: 28px;
  background: var(--panel);
  color: var(--panel-ink);
  box-shadow: 0 8px 0 var(--page-shadow);
}

.comparison-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.eyebrow { margin: 0 0 5px; color: var(--panel-muted); font-size: 10px; font-weight: 850; letter-spacing: .12em; }
.comparison-heading h1 { margin: 0; font-size: clamp(21px, 2.5vw, 27px); line-height: 1.1; letter-spacing: -.035em; }
.live-dot { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 5px #416b5d1c; }

.comparison-description { margin: 12px 0 16px; color: var(--panel-muted); font-size: 13px; }

.comparison-list { display: grid; gap: 2px; }

.comparison-row {
  min-height: 47px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--panel-muted), transparent 78%);
  color: var(--panel-ink);
  font-size: 14px;
}

.comparison-row:last-child { border-bottom: 0; }
.comparison-row.is-active { border-radius: 10px; background: #b7ed5538; font-weight: 800; }
.comparison-row .comparison-unit { color: var(--panel-muted); font-weight: 650; }
.comparison-row .comparison-price { white-space: nowrap; font-weight: 800; font-variant-numeric: tabular-nums; }
.comparison-footnote { margin: 15px 0 0; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--panel-muted), transparent 78%); color: var(--panel-muted); font-size: 12px; }

.app-footer {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  color: var(--page-ink);
  font-size: 12px;
}

.app-footer a { color: inherit; font-weight: 750; text-underline-offset: 3px; }
.visually-hidden { width: 1px; height: 1px; position: absolute; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

@media (max-width: 760px) {
  .app-frame { width: min(100% - 24px, 570px); }
  .topbar { min-height: 68px; }
  main { padding-top: 6px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .scale-column { max-width: 520px; }
  .comparison-panel { max-width: 520px; margin: 0 auto; }
  .app-footer { min-height: 58px; }
}

@media (max-width: 380px) {
  .app-frame { width: min(100% - 18px, 520px); }
  .topbar { min-height: 62px; }
  .brand-mark { width: 38px; height: 38px; }
  .scale-platform { height: 44px; border-width: 7px; border-radius: 20px; }
  .scale-neck { width: 62px; height: 25px; }
  .scale-shell { padding: 16px 13px 12px; border-radius: 31px; }
  .scale-screen { min-height: 216px; padding: 15px 14px 13px; border-radius: 20px; }
  #quantity { height: 66px; font-size: clamp(39px, 12vw, 52px); }
  .readout-unit { font-size: 18px; }
  .unit-keys { gap: 6px; }
  .unit-key { min-height: 46px; padding: 7px 2px; font-size: 13px; }
  .unit-price-block { gap: 8px; }
  .unit-price-block label { font-size: 10px; }
  .price-entry { width: 54%; min-height: 44px; }
  .feedback { font-size: 10px; }
  .comparison-panel { padding: 19px 16px 17px; }
  .mode-tabs { width: 100%; margin-bottom: 17px; }
  .mode-tab { min-width: 0; flex: 1; padding-inline: 8px; }
  .app-footer { flex-wrap: wrap; gap: 6px 13px; padding: 12px 0; }
}

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