:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: #031007;
  --panel-strong: #061b0d;
  --line: #0f5f28;
  --line-soft: #0a3d1b;
  --text: #62ff86;
  --text-strong: #9dffb0;
  --text-dim: #35a952;
  --danger: #ff5f5f;
  --shadow: 0 0 36px rgba(39, 255, 104, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(30, 255, 83, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 255, 83, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--text-strong);
  outline-offset: 3px;
}

.app-shell {
  width: min(860px, calc(100% - 24px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.play-surface {
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.86);
  box-shadow: var(--shadow);
}

.play-surface {
  min-height: calc(100vh - 32px);
  padding: clamp(16px, 3vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.top-bar,
.name-row,
.record-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.round-label {
  margin: 0 0 8px;
  color: var(--text-dim);
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

#roundLabel {
  display: none;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--text-strong);
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  line-height: 1;
}

h2 {
  margin-bottom: 10px;
  color: var(--text-strong);
  font-size: 1.15rem;
}

.level-pill {
  width: 86px;
  height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: grid;
  place-items: center;
  text-align: center;
  flex: 0 0 auto;
}

.level-pill span {
  display: block;
  color: var(--text-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.level-pill strong {
  display: block;
  color: var(--text-strong);
  font-size: 2.35rem;
  line-height: 1;
}

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

.status-grid article {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
}

.status-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.8rem;
}

.status-grid strong {
  display: block;
  color: var(--text-strong);
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1;
}

.time-track {
  height: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(12, 61, 27, 0.38);
  overflow: hidden;
}

.time-fill {
  width: 100%;
  height: 100%;
  background: var(--text);
  box-shadow: 0 0 18px rgba(98, 255, 134, 0.55);
  transform-origin: left center;
  transition: transform 0.25s linear;
}

.question-panel,
.proficiency-panel {
  border: 1px solid var(--line-soft);
  background: var(--panel-strong);
  padding: clamp(14px, 3vw, 20px);
}

.question-text {
  min-height: 100px;
  display: grid;
  place-items: center;
  color: var(--text-strong);
  font-size: clamp(2.8rem, 9vw, 5.7rem);
  line-height: 1;
  text-align: center;
}

.question-ready {
  min-height: 110px;
}

.answer-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.answer-form label,
.name-form label {
  grid-column: 1 / -1;
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.8rem;
}

.name-form label {
  display: block;
  margin-bottom: 12px;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #000000;
  color: var(--text-strong);
  padding: 0 14px;
}

input[type="number"] {
  font-size: 1.35rem;
}

.answer-form button,
.name-row button,
.primary-button {
  background: var(--text);
  color: #001104;
  border-color: var(--text-strong);
  font-weight: 700;
}

.answer-form button,
.name-row button {
  min-width: 110px;
  padding: 0 18px;
}

.question-start-button {
  min-width: min(260px, 100%);
  min-height: 62px;
  font-size: 1.35rem;
}

.feedback {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--text-dim);
}

.feedback.correct {
  color: var(--text-strong);
}

.feedback.wrong {
  color: var(--danger);
}

.proficiency-panel {
  border-color: var(--text);
}

.proficiency-panel h2 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.save-status {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--text-dim);
}

.primary-button {
  padding: 0 22px;
}

.level-selector {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(78px, 1fr));
  gap: 10px;
  margin-top: 0;
  min-height: 170px;
}

.level-selector button {
  min-width: 0;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(1.25rem, 2vw, 2rem);
  font-weight: 700;
}

.level-selector button.is-active,
.level-selector button[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text-strong);
  color: #001104;
}

.level-selector button:disabled {
  opacity: 0.32;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .app-shell {
    min-height: auto;
  }

  .play-surface {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .top-bar,
  .name-row {
    align-items: stretch;
    flex-direction: column;
  }

  .level-selector {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(52px, auto));
    min-height: 112px;
    flex: 0 0 auto;
  }

  .level-pill {
    width: 100%;
    height: 72px;
  }

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

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

  .answer-form button,
  .name-row button,
  .primary-button {
    width: 100%;
  }
}
