:root {
  color-scheme: dark;
  --ink: #f7fbff;
  --muted: #a8b8cc;
  --line: #1f4169;
  --panel: #071b35;
  --panel-strong: #041223;
  --accent: #1597ff;
  --accent-strong: #0074e8;
  --accent-dark: #003f86;
  --silver: #d5dde7;
  --shadow: 0 18px 46px rgba(0, 8, 22, 0.48);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #001329;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(21, 151, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 151, 255, 0.045) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(21, 151, 255, 0.22), transparent 30rem),
    linear-gradient(180deg, #06264a, #001329 42rem),
    #001329;
  background-size: 36px 36px, 36px 36px, auto, auto, auto;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(26px, env(safe-area-inset-bottom));
}

.top-panel {
  margin-bottom: 14px;
  padding: 10px 2px 0;
}

.title-block {
  min-width: 0;
}

.eyebrow,
.label-text,
.primary-result p,
.metric span,
#table-note {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.25rem, 9vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.screen {
  display: none;
  margin-top: 14px;
  padding: 18px;
  border: 1px solid rgba(93, 150, 207, 0.26);
  border-radius: 8px;
  background: rgba(4, 18, 35, 0.95);
  box-shadow: var(--shadow);
}

.screen.active {
  display: block;
}

.screen-head {
  margin-bottom: 16px;
}

.screen-head h2 {
  margin-top: 4px;
  font-size: clamp(1.55rem, 4vw, 2.45rem);
  line-height: 1;
}

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

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

.choice-card {
  min-height: 138px;
  padding: 20px;
  border: 1px solid rgba(119, 161, 202, 0.28);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: linear-gradient(180deg, #092746, #061b33);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 8, 22, 0.28);
}

.choice-card.compact {
  min-height: 98px;
  display: flex;
  align-items: center;
}

.choice-card:hover,
.choice-card:focus-visible,
.primary-button:hover,
.back-button:hover {
  border-color: rgba(21, 151, 255, 0.72);
  box-shadow: 0 10px 24px rgba(0, 116, 232, 0.24);
}

.choice-card strong {
  display: block;
  margin: 0 0 8px;
  font-size: 1.42rem;
}

.choice-card span:last-child {
  display: block;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.35;
}

.control-group,
.calculator-form {
  margin-top: 12px;
}

.control-group {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #061b33;
}

.label-text {
  display: block;
  margin-bottom: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: #031124;
}

.segment {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 850;
}

.segment.active {
  color: #f7fbff;
  background: var(--accent);
  box-shadow: 0 6px 14px rgba(0, 116, 232, 0.3);
}

.calculator-form {
  max-width: 720px;
}

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

#size-round-inputs {
  grid-template-columns: 1fr;
}

.form-row {
  margin-bottom: 14px;
}

.form-row label {
  display: block;
  margin-bottom: 7px;
  color: var(--silver);
  font-size: 0.9rem;
  font-weight: 850;
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--panel-strong);
}

.input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 15px 13px;
  color: var(--ink);
  background: transparent;
  font-size: 1.15rem;
  font-weight: 850;
}

.input-wrap span {
  align-self: stretch;
  display: flex;
  align-items: center;
  min-width: max-content;
  padding: 0 12px;
  color: var(--muted);
  background: #092746;
  font-weight: 800;
}

.primary-button,
.back-button {
  min-height: 46px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  width: 100%;
  color: #ffffff;
  background: linear-gradient(180deg, #1597ff, #0074e8);
  box-shadow: 0 8px 18px rgba(0, 116, 232, 0.28);
}

.back-button {
  min-width: 86px;
  margin-bottom: 14px;
  color: #dbe8f5;
  background: #092746;
}

.hidden {
  display: none !important;
}

.result-screen {
  padding: 0;
  overflow: hidden;
}

.result-screen > .back-button {
  margin: 18px 18px 0;
}

.primary-result {
  margin: 18px;
  padding: 18px;
  border-radius: 8px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(21, 151, 255, 0.34), rgba(213, 221, 231, 0.1)),
    #061b33;
}

.primary-result p {
  color: rgba(255, 255, 255, 0.72);
}

.primary-result h2 {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1rem;
  line-height: 1.2;
}

.primary-result strong {
  display: block;
  margin: 6px 0 3px;
  font-size: clamp(2.1rem, 10vw, 4.1rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.primary-result span {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 18px 16px;
}

.metric {
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #061b33;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
  line-height: 1.1;
}

.suggestions {
  padding: 0 18px 18px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.section-head h2 {
  font-size: 1rem;
  line-height: 1.2;
}

.result-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 10px;
  padding: 5px;
  border-radius: 8px;
  background: #031124;
}

.result-tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.result-tab.active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 6px 14px rgba(0, 116, 232, 0.3);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  background: #041223;
}

th,
td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid #173456;
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  background: #092746;
  font-size: 0.74rem;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

td:first-child {
  font-weight: 900;
}

.highlight-row td {
  color: #ffffff;
  background: linear-gradient(180deg, #1597ff, #0074e8);
  border-top: 1px solid #72c4ff;
  border-bottom: 1px solid #72c4ff;
  font-weight: 900;
}

.highlight-row td:first-child {
  color: #ffffff;
}

.text-page {
  max-width: 820px;
}

.support-page {
  display: block;
}

.support-copy {
  display: grid;
  gap: 14px;
  color: #dbe8f5;
  font-size: 1rem;
  line-height: 1.55;
}

.support-copy strong {
  color: #ffffff;
}

.support-copy a,
.support-email a {
  color: #72c4ff;
  font-weight: 900;
  text-decoration: none;
}

.support-email {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #061b33;
}

.support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 7px;
  font-weight: 900;
  text-decoration: none;
}

.primary-link {
  color: #ffffff;
  background: linear-gradient(180deg, #1597ff, #0074e8);
}

.secondary-link {
  color: #dbe8f5;
  border: 1px solid var(--line);
  background: #092746;
}

@media (max-width: 850px) {
  .choice-grid,
  .choice-grid.three {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 520px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .screen {
    padding: 14px;
  }

  .result-screen {
    padding: 0;
  }

  .segment {
    min-height: 42px;
    font-size: 0.88rem;
  }

  .form-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: block;
  }

  #table-note {
    display: block;
    margin-top: 5px;
  }
}
