:root {
  --rlu-blue: #149bd7;
  --rlu-ink: #102131;
  --rlu-muted: #5c6b78;
  --rlu-paper: #eef4f8;
  --rlu-panel: #ffffff;
  --rlu-line: #ccdbe5;
  --rlu-dark: #071018;
  --rlu-green: #1d8f5a;
  --rlu-violet: #6555c7;
  --rlu-amber: #f3b23a;
  --rlu-shadow: 0 12px 30px rgba(15, 33, 49, 0.14);
  --rlu-radius: 9px;
  --rlu-touch: 48px;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html,
body {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  color: var(--rlu-ink);
  background:
    linear-gradient(#dce8f0 1px, transparent 1px),
    linear-gradient(90deg, #dce8f0 1px, transparent 1px),
    var(--rlu-paper);
  background-size: 34px 34px;
  touch-action: manipulation;
}

button,
select { font: inherit; }

button,
select,
.home-button { min-height: var(--rlu-touch); }

button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 4px solid rgba(20, 155, 215, 0.38);
  outline-offset: 2px;
}

.rounding-line-up-app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.rounding-line-up-topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  padding: 7px 14px;
  background: var(--rlu-dark);
  color: #fff;
}

.rounding-line-up-brand,
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rounding-line-up-brand { min-width: 0; }
.rounding-line-up-brand img { display: block; width: 126px; height: auto; }
.rounding-line-up-brand h1 { margin: 0; font-size: clamp(1.28rem, 2vw, 2rem); line-height: 1; }
.top-actions { justify-content: flex-end; }

.icon-button,
.home-button {
  border: 2px solid #263d51;
  border-radius: var(--rlu-radius);
  background: #122436;
  color: #fff;
}

.icon-button {
  width: var(--rlu-touch);
  padding: 0;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.icon-button svg { width: 24px; height: 24px; pointer-events: none; }
.home-button { display: inline-flex; align-items: center; padding: 0 14px; font-weight: 800; text-decoration: none; }
.icon-button:hover,
.home-button:hover { border-color: #8fd8f3; background: var(--rlu-blue); color: #06111a; }

.rounding-line-up-page {
  min-height: 0;
  width: min(1500px, calc(100% - 24px));
  margin: 0 auto;
  padding: 8px 0;
}

#roundingLineUpHost,
.rounding-line-up-game { height: 100%; min-height: 0; }

.rounding-line-up-game {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.rounding-line-up-toolbar,
.rounding-line-up-play,
.rounding-line-up-summary {
  border: 1px solid var(--rlu-line);
  border-radius: var(--rlu-radius);
  background: var(--rlu-panel);
  box-shadow: var(--rlu-shadow);
}

.rounding-line-up-toolbar {
  min-height: 58px;
  display: flex;
  align-items: end;
  gap: 9px;
  padding: 6px 9px;
}

.rounding-line-up-toolbar label {
  display: grid;
  gap: 2px;
  color: var(--rlu-muted);
  font-size: .78rem;
  font-weight: 900;
}

.rounding-line-up-toolbar select {
  min-width: 116px;
  padding: 0 34px 0 10px;
  border: 2px solid var(--rlu-line);
  border-radius: 7px;
  background: #f8fbfd;
  color: var(--rlu-ink);
  font-weight: 800;
}

.rounding-line-up-setting-summary {
  min-width: 0;
  flex: 1 1 auto;
  align-self: center;
  margin: 0;
  color: var(--rlu-muted);
  font-size: .88rem;
  font-weight: 800;
}

.rounding-line-up-button {
  min-height: var(--rlu-touch);
  padding: 0 14px;
  border: 2px solid var(--rlu-line);
  border-radius: 7px;
  background: #f8fbfd;
  color: var(--rlu-ink);
  font-weight: 850;
  cursor: pointer;
}

.rounding-line-up-button:hover:not(:disabled) { border-color: var(--rlu-blue); background: #eaf7fc; }
.rounding-line-up-button:disabled { cursor: not-allowed; opacity: .55; }
.rounding-line-up-button--primary,
.rounding-line-up-button--next { border-color: #5144a6; background: var(--rlu-violet); color: #fff; }
.rounding-line-up-button--primary:hover:not(:disabled),
.rounding-line-up-button--next:hover:not(:disabled) { border-color: #392d8b; background: #5144a6; }
.rounding-line-up-button--hint { justify-self: start; }

.rounding-line-up-play {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(180px, 1fr) auto;
  gap: 6px;
  padding: 8px 12px 10px;
  overflow: hidden;
}

.rounding-line-up-status {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 7px;
  background: #edf5fa;
  color: var(--rlu-muted);
  font-size: .86rem;
  font-weight: 900;
}

.rounding-line-up-status span:nth-child(2) { text-align: center; color: var(--rlu-ink); }
.rounding-line-up-status span:last-child { text-align: right; }

.rounding-line-up-question { text-align: center; }
.rounding-line-up-context { margin: 1px 0 3px; font-size: clamp(1rem, 1.55vw, 1.25rem); }
.rounding-line-up-context strong { color: #5144a6; font-size: 1.12em; }
.rounding-line-up-question h2 { margin: 0; font-size: clamp(1.12rem, 2vw, 1.55rem); }

.rounding-line-up-model {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.rounding-line-up-model > *,
.rounding-line-up-model .diagram-visual {
  width: 100%;
  max-height: 100%;
}

.rounding-line-up-model > .question-visual {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  display: grid;
  place-items: center;
  margin: 0;
  overflow: hidden;
}
.rounding-line-up-model .rounding-number-line-visual { width: 100%; height: 100%; min-height: 0; max-height: 100%; }
.rounding-line-up-model figcaption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rounding-line-up-response {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  grid-template-areas:
    "hint choices next"
    "note feedback feedback";
  align-items: center;
  gap: 7px 12px;
}

.rounding-line-up-button--hint { grid-area: hint; }
.rounding-line-up-hint { grid-area: note; margin: 0; color: var(--rlu-muted); font-size: .88rem; font-weight: 800; }
.rounding-line-up-choices { grid-area: choices; display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 10px; }
.rounding-line-up-choices button {
  min-height: 58px;
  padding: 8px 16px;
  border: 3px solid #aabfce;
  border-radius: 9px;
  background: #fff;
  color: var(--rlu-ink);
  font-size: clamp(1.25rem, 2.3vw, 1.8rem);
  font-weight: 900;
  cursor: pointer;
}
.rounding-line-up-choices button:hover:not(:disabled) { border-color: var(--rlu-blue); background: #eef9fd; }
.rounding-line-up-choices button:disabled { cursor: default; opacity: .76; }
.rounding-line-up-feedback { grid-area: feedback; margin: 0; padding: 7px 10px; border-left: 5px solid #bf6f18; border-radius: 5px; background: #fff6e7; font-weight: 800; }
.rounding-line-up-feedback.is-correct { border-color: var(--rlu-green); background: #eef9f3; }
.rounding-line-up-button--next { grid-area: next; }

.rounding-line-up-summary {
  min-height: 0;
  padding: 16px;
  overflow: auto;
}

.rounding-line-up-summary-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.rounding-line-up-summary-heading h2 { margin: 0; font-size: clamp(1.4rem, 2.5vw, 2rem); }
.rounding-line-up-summary-heading > p { margin: 0; font-weight: 900; }
.rounding-line-up-eyebrow { margin: 0 0 3px; color: var(--rlu-violet); font-size: .8rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }

.rounding-line-up-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.rounding-line-up-summary-card {
  min-height: 108px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  gap: 1px 9px;
  padding: 10px 12px;
  border: 3px solid var(--rlu-line);
  border-radius: 9px;
  background: #f8fbfd;
  color: var(--rlu-ink);
  text-align: left;
  cursor: pointer;
}

.rounding-line-up-summary-card:hover { border-color: var(--rlu-blue); }
.rounding-line-up-summary-card.is-selected { border-color: var(--rlu-violet); background: #f1effc; }
.rounding-line-up-summary-card span { color: var(--rlu-muted); font-size: .76rem; font-weight: 900; text-transform: uppercase; }
.rounding-line-up-summary-card strong { grid-column: 1; font-size: clamp(1.3rem, 2.4vw, 1.8rem); }
.rounding-line-up-summary-card small { grid-column: 1; font-weight: 800; }
.rounding-line-up-summary-card b { grid-column: 2; grid-row: 1 / 4; padding-left: 12px; border-left: 1px solid var(--rlu-line); color: var(--rlu-green); font-size: clamp(1.25rem, 2.3vw, 1.7rem); }
.rounding-line-up-summary-card b::before { content: "→ "; color: var(--rlu-muted); }
.rounding-line-up-summary-actions { display: flex; gap: 10px; }
.rounding-line-up-summary .rounding-line-up-feedback { margin-top: 12px; }

@media (max-width: 899px), (max-height: 649px) {
  html,
  body { height: auto; min-height: 100%; overflow: auto; }
  .rounding-line-up-app { height: auto; min-height: 100vh; }
  .rounding-line-up-page { min-height: 0; }
  #roundingLineUpHost,
  .rounding-line-up-game { height: auto; }
  .rounding-line-up-play { overflow: visible; }
}

@media (max-width: 760px) {
  .rounding-line-up-topbar { grid-template-columns: 1fr auto; padding: 7px 9px; }
  .rounding-line-up-brand img { width: 105px; }
  .rounding-line-up-brand h1 { font-size: 1.12rem; }
  .home-button { display: none; }
  .rounding-line-up-page { width: min(100% - 14px, 680px); }
  .rounding-line-up-toolbar { align-items: end; flex-wrap: wrap; }
  .rounding-line-up-toolbar label { flex: 1 1 130px; }
  .rounding-line-up-toolbar select { width: 100%; }
  .rounding-line-up-setting-summary { flex: 1 0 100%; order: 4; }
  .rounding-line-up-play { grid-template-rows: auto auto minmax(170px, 190px) auto; }
  .rounding-line-up-status { grid-template-columns: 1fr 1fr; }
  .rounding-line-up-status span:nth-child(2) { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .rounding-line-up-response {
    grid-template-columns: 1fr;
    grid-template-areas: "hint" "note" "choices" "feedback" "next";
  }
  .rounding-line-up-button--hint,
  .rounding-line-up-button--next { width: 100%; }
  .rounding-line-up-card-grid { grid-template-columns: 1fr; }
  .rounding-line-up-summary-heading { align-items: start; flex-direction: column; }
}

@media (max-width: 430px) {
  .rounding-line-up-brand img { width: 92px; }
  .rounding-line-up-brand h1 { max-width: 112px; }
  .rounding-line-up-toolbar > .rounding-line-up-button { flex: 1 1 calc(50% - 5px); }
  .rounding-line-up-choices { grid-template-columns: 1fr; }
  .rounding-line-up-summary-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
