/* MinusMester: base components and responsive variants; redundant declarations removed without moving cascade order. */
:root {
  color-scheme: light;
  --ink: #254e55;
  --muted: #58777a;
  --accent: #d85743;
  --bg: #f5f2e9;
  --border: #c4d5d1;
  --viewport-height: 100svh;
  font-family: ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
}

h1,h2,p {
  margin: 0;
}

button,a,[role=slider] {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

button {
  min-height: 44px;
  border-radius: 10px;
  border: 0;
}

button:focus-visible,a:focus-visible,[role=slider]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

[hidden] {
  display: none!important;
}

.page-shell {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  height: var(--viewport-height);
  display: grid;
  grid-template-rows: 64px minmax(0,1fr) 36px;
  max-width: 1440px;
  margin: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 36px 0;
  gap: 20px;
}

.site-logo {
  display: inline-flex;
  align-items: center;
}

.site-logo img {
  display: block;
  width: 195px;
  height: auto;
  max-height: 46px;
  object-fit: contain;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  padding: 6px 12px;
}

.site-footer a {
  text-underline-offset: 3px;
}

.game-main {
  min-height: 0;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 1.6px;
  font-weight: 800;
  color: var(--muted);
}

.menu-screen {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 40px;
  max-width: 1160px;
  margin: auto;
  padding: 24px 36px;
  overflow: auto;
  overscroll-behavior: contain;
}

.menu-copy h1 {
  font-size: clamp(42px,5vw,65px);
  letter-spacing: -2.5px;
  line-height: 1.05;
  margin: 14px 0 18px;
}

.menu-description {
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
  margin: 17px 0 24px;
}

.menu-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary,.secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 13px 22px;
  min-height: 48px;
  font-weight: 750;
  font-size: 14px;
  text-decoration: none;
}

.primary {
  color: white;
}

.primary:hover {
  background: #b54434;
}

.primary span {
  font-size: 23px;
  font-weight: 400;
}

.secondary {
  color: var(--ink);
  background: transparent;
  border: 1px solid #a4bfbb;
}

.secondary:hover {
  background: #e0ece7;
}

.completion-note {
  font-size: 12px;
  color: var(--muted);
}

.menu-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.fullscreen-button {
  position: fixed;
  top: max(10px,env(safe-area-inset-top));
  right: max(12px,env(safe-area-inset-right));
  z-index: 4;
  width: 44px;
  height: 44px;
  background: #f8faf7;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}

.fullscreen-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fullscreen-icon-exit {
  display: none;
}

.fullscreen-button[aria-pressed=true] .fullscreen-icon-enter {
  display: none;
}

.fullscreen-button[aria-pressed=true] .fullscreen-icon-exit {
  display: block;
}

body[data-overlay] .page-shell,body[data-screen=play] .page-shell,body[data-screen=result] .page-shell {
  grid-template-rows: minmax(0,1fr);
}

body[data-screen=play] .site-header,body[data-screen=play] .site-footer,body[data-screen=result] .site-header,body[data-screen=result] .site-footer,body[data-overlay] .site-header,body[data-overlay] .site-footer {
  display: none;
}

.play-screen {
  height: 100%;
  display: grid;
  overflow: auto;
  overscroll-behavior: contain;
}

.game-toolbar {
  gap: 12px;
}

.quiet {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  padding: 0 8px;
}

.quiet:hover {
  background: #e0ece7;
}

.task {
  text-align: center;
  grid-column: 2;
}

.task strong {
  letter-spacing: -1px;
  white-space: nowrap;
}

.line-card {
  display: grid;
  align-items: stretch;
  min-height: 270px;
}

.line-stage {
  position: relative;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: absolute;
  inset: 0;
}

.control-dock {
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0,1fr) 180px;
  align-items: center;
}

.feedback {
  grid-column: 1/-1;
  font-size: 13px;
  text-align: center;
  min-height: 22px;
  line-height: 1.5;
}

.feedback.wrong {
  font-weight: 650;
}

.feedback.correct {
  font-weight: 650;
}

#answer {
  width: 100%;
  letter-spacing: 1.8px;
  min-height: 52px;
}

dialog {
  border-radius: 22px;
  padding: 0;
  color: var(--ink);
  max-width: calc(100vw - 28px);
  max-height: calc(var(--viewport-height) - 30px);
  overflow: auto;
}

.result-icon {
  display: grid;
  place-items: center;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  font-size: 28px;
  margin: 0 auto 20px;
}

.result-actions {
  display: flex;
  margin-top: 24px;
  justify-content: center;
}

.result-description {
  max-width: 350px;
  margin: auto;
}

@media(min-width:750px) and (max-height:600px) {
  .menu-screen {
    padding: 12px 32px;
    gap: 28px;
  }

  .menu-scene {
    padding: 15px;
  }

  .line-card {
    grid-template-columns: minmax(0,1fr) 255px;
  }

  .control-dock {
    width: min(710px,100%);
  }

  .result-icon {
    margin-bottom: 10px;
  }

}

@media(min-width:650px) and (orientation:portrait) {
  .menu-screen {
    grid-template-columns: 1fr;
    text-align: center;
    max-width: 780px;
    padding: 28px 40px;
  }

  .menu-actions {
    justify-content: center;
  }

  .menu-scene {
    max-width: 650px;
    width: 100%;
  }

  .play-screen {
    padding: 18px 20px;
  }

  .task strong {
    font-size: 42px;
  }

  .control-dock {
    grid-template-columns: minmax(0,1fr) 160px;
  }

  .fullscreen-button {
    display: none;
  }

}

@media(max-width:749px) and (orientation:landscape) {
  .play-screen {
    grid-template-rows: 60px 270px 105px;
    padding: 10px 15px;
    gap: 8px;
  }

  .line-card {
    grid-template-columns: minmax(0,1fr) 230px;
    padding: 8px;
  }

  .control-dock {
    grid-template-columns: minmax(0,1fr) 140px;
    gap: 10px;
  }

  .task strong {
    font-size: 32px;
  }

}

@media(max-width:649px) and (orientation:portrait) {
  .page-shell {
    grid-template-rows: 65px minmax(0,1fr) 38px;
  }

  .site-header {
    padding: 12px 20px 0;
  }

  .site-logo img {
    width: 170px;
  }

  .menu-screen {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 23px;
    padding: 30px 22px;
    text-align: center;
  }

  .menu-copy h1 {
    font-size: 43px;
    letter-spacing: -1.8px;
  }

  .menu-description {
    font-size: 15px;
    margin: 14px 0 20px;
  }

  .menu-actions {
    justify-content: center;
  }

  .menu-scene {
    padding: 18px;
  }

  .site-footer {
    font-size: 10px;
  }

  .play-screen {
    gap: 12px;
  }

  .game-toolbar {
    gap: 2px;
  }

  .task strong {
    letter-spacing: -.6px;
  }

  .quiet {
    font-size: 11px;
    padding: 0 2px;
  }

  .line-card {
    grid-template-columns: 1fr;
  }

  .line-stage {
    min-height: 235px;
  }

  .control-dock {
    grid-template-columns: 1fr;
  }

  .answer-control {
    width: 100%;
  }

  .feedback {
    grid-row: 3;
  }

  .fullscreen-button {
    display: none;
  }

  .result-actions {
    flex-direction: column;
  }

}

@media(prefers-reduced-motion:reduce) {
  dialog::backdrop {
    backdrop-filter: none;
  }

}

.level-picker {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 18px;
}

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

.review-link {
  font-size: 12px;
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0 4px;
  margin-top: 3px;
}

.completion-note {
  margin-top: 8px;
}

.level-indicator {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .4px;
}

.task strong {
  font-size: clamp(32px,4vw,43px);
}

.mental-stage {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.response-control {
  align-self: center;
  text-align: center;
}

.response-control h2 {
  font-size: 17px;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-button {
  min-height: 65px;
  font-size: 27px;
  font-weight: 700;
  background: #f5f2e9;
  border: 2px solid #c4d5d1;
  color: var(--ink);
}

.choice-button[aria-pressed=true] {
  box-shadow: inset 0 0 0 1px var(--ink);
}

.input-control {
  width: 100%;
}

#answer-input {
  width: 100%;
  height: 48px;
  text-align: center;
  font: 700 29px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  border-radius: 10px;
}

.keypad {
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 6px;
  margin-top: 10px;
}

.keypad button {
  height: 44px;
  min-width: 44px;
  background: #e4eeeb;
  color: var(--ink);
  font-size: 18px;
  font-weight: 650;
}

.keypad button:active {
  background: #c7deda;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.answer-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.answer-control #answer {
  flex: 1;
  white-space: nowrap;
  letter-spacing: 1px;
}

.mental-dock {
  grid-template-columns: 1fr;
  gap: 8px;
}

.mental-dock .answer-control {
  grid-column: 1/-1;
}

.mental-dock .answer-control #answer {
  max-width: 240px;
}

.mental-dock #use-help {
  white-space: nowrap;
  padding: 13px 16px;
}

.result-actions {
  flex-wrap: wrap;
  gap: 10px;
}

.result-description {
  margin-top: 12px;
}

@media(pointer:coarse) {
  .keypad {
    display: grid;
  }

  .input-control {
    padding: 0;
  }

  .response-control h2 {
    margin-bottom: 16px;
  }

}

@media(min-width:750px) and (max-height:600px) {
  .level-picker {
    gap: 5px;
  }

  .menu-screen {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .result-actions {
    margin-top: 16px;
  }

}

@media(min-width:650px) and (orientation:portrait) {
  .level-picker {
    margin-left: auto;
    margin-right: auto;
  }

  .choices {
    gap: 10px;
  }

  .choice-button {
    font-size: 25px;
  }

  .mental-dock {
    width: min(560px,100%);
  }

}

@media(max-width:649px) and (orientation:portrait) {
  .level-picker {
    margin-left: auto;
    margin-right: auto;
    text-align: left;
  }

  .mental-stage {
    min-height: 210px;
  }

  .mental-stage p {
    font-size: 12px;
  }

  .task strong {
    font-size: 26px;
  }

  .level-indicator {
    font-size: 9px;
  }

  .game-toolbar {
    grid-template-columns: 52px 1fr 52px;
  }

  .mental-dock .answer-control {
    flex-wrap: wrap;
  }

  .mental-dock .answer-control #answer {
    max-width: none;
  }

  .mental-dock .feedback {
    grid-row: auto;
  }

  .input-control {
    max-width: 280px;
    justify-self: center;
  }

  .choices {
    max-width: 280px;
    margin: auto;
  }

  .keypad {
    display: grid;
  }

  .result-actions>button {
    width: 100%;
  }

  .review-link {
    margin-top: 5px;
  }

}

.level-picker {
  max-width: 100%;
}

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

.level-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  padding: 7px 10px;
  border: 1px solid #b5c9c4;
  text-align: left;
}

.level-button strong {
  font-size: 12px;
  font-weight: 750;
}

.level-button>span {
  font-size: 12px;
  line-height: 1.2;
}

.level-button:hover {
  border-color: #75a3a5;
}

.level-button[aria-pressed=true] {
  color: white;
}

.completion-mark {
  position: absolute;
  right: 7px;
  top: 5px;
  font-size: 11px;
  font-style: normal;
}

.level-button:has(.completion-mark) strong {
  padding-right: 12px;
}

@media(min-width:750px) and (max-height:600px) {
  .menu-copy h1 {
    font-size: 36px;
    margin: 6px 0 8px;
  }

  .menu-description {
    font-size: 14px;
    line-height: 1.5;
    margin: 8px 0 10px;
  }

  .level-picker {
    margin-bottom: 8px;
  }

  .level-button {
    min-height: 44px;
    padding: 5px 8px;
    gap: 2px;
  }

  .menu-actions>button {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .completion-note {
    margin-top: 5px;
  }

}

@media(max-width:649px) and (orientation:portrait) {
  .level-buttons {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .level-button {
    min-height: 54px;
  }

  .level-button strong {
    font-size: 13px;
  }

  .level-button>span {
    font-size: 13px;
  }

}

body {
  background-color: var(--bg);
}

.primary {
  background: var(--accent);
  border: 1px solid #b34737;
  box-shadow: inset 0 2px 0 #ffffff55,0 3px 0 #a44335;
}

.secondary,.fullscreen-button {
  background: #fffaf0;
  box-shadow: inset 0 1px 0 #fff;
}

.level-button {
  border-radius: 8px;
}

.level-button[aria-pressed=true] {
  box-shadow: inset 0 2px 0 #ffffff45,0 2px 0 #a44335;
}

.menu-scene {
  position: relative;
  border-radius: 20px;
  background-color: #f5f2e9;
  background-image: linear-gradient(90deg,#75bab840 2px,transparent 2px),linear-gradient(#75bab840 2px,transparent 2px);
  background-size: 54px 54px;
}

.task strong {
  line-height: 1.05;
  display: inline-block;
  border-radius: 12px;
}

#answer-input {
  border: 2px solid #75a9a6;
}

dialog {
  background: #fffaf0;
  border: 3px solid #75a9a6;
}

@media(min-width:750px) and (max-height:600px) {
  .task strong {
    padding: 2px 17px;
  }

}

@media(max-width:649px) and (orientation:portrait) {
  .task strong {
    padding: 4px 10px;
    border-radius: 8px;
  }

}

body {
  background-image: url('assets/sento-bathhouse.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.menu-copy {
  background: #fffaf0;
  border: 2px solid #75a9a6;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 5px 15px #254e5520;
}

.menu-scene {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: 250px;
}

.site-logo {
  filter: drop-shadow(0 1px 3px #f5f2e9);
}

.site-footer {
  background: none;
  color: #254e55;
  text-shadow: 0 1px 2px #fffaf0,0 0 5px #fffaf0;
}

.line-card {
  background: none;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.control-dock {
  background: none;
  border: 0;
  padding: 0;
  gap: 8px 24px;
  width: min(720px,100%);
}

.feedback {
  color: var(--ink);
  text-shadow: 0 1px 2px #fffaf0,0 0 5px #fffaf0;
}

.feedback:not(:empty) {
  border-radius: 8px;
  padding: 3px 10px;
  justify-self: center;
}

.quiet {
  background: #fffaf0;
  border: 1px solid #75a9a6;
}

.level-indicator {
  display: table;
  margin: 4px auto 0;
  border-radius: 6px;
}

.response-control {
  background: #fffaf0;
  border: 2px solid #75a9a6;
  border-radius: 14px;
  padding: 16px;
  width: 100%;
  max-width: 310px;
  justify-self: center;
}

.response-control h2 {
  margin-bottom: 12px;
}

.input-control {
  padding: 12px;
}

.mental-stage p {
  font-size: 13px;
}

.mental-dock {
  width: min(420px,100%);
}

dialog::backdrop {
  background: #254e5518;
  backdrop-filter: none;
}

@media(min-width:750px) and (max-height:600px) {
  .menu-copy {
    padding: 12px;
  }

  .menu-scene {
    min-height: 240px;
  }

  .response-control {
    padding: 10px;
  }

  .level-indicator {
    margin-top: 3px;
    padding: 1px 8px;
  }

}

@media(min-width:650px) and (orientation:portrait) {
  .menu-screen {
    gap: 18px;
    align-content: center;
  }

  .menu-copy {
    width: min(560px,100%);
    justify-self: center;
  }

  .menu-scene {
    min-height: 180px;
    max-height: 210px;
    justify-self: center;
  }

  .line-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .line-stage {
    min-height: 210px;
  }

  .mental-stage {
    min-height: 210px;
  }

  .response-control {
    max-width: 340px;
  }

  .control-dock {
    width: min(620px,100%);
    gap: 8px 20px;
  }

  .play-screen {
    gap: 12px;
  }

}

@media(max-width:649px) and (orientation:portrait) {
  .menu-copy {
    padding: 14px;
  }

  .menu-scene {
    min-height: 160px;
  }

  .line-card {
    gap: 10px;
  }

  .response-control {
    max-width: 280px;
  }

  .control-dock {
    padding: 0;
    gap: 10px;
  }

}

body[data-screen=result] .play-screen {
  visibility: hidden;
}

.play-screen {
  gap: 8px;
  padding: 12px 28px;
}

.game-toolbar {
  align-items: center;
}

.game-toolbar .quiet {
  min-width: 80px;
}

.line-card {
  grid-template-columns: minmax(0,1fr);
  gap: 6px;
  padding: 0 16px;
}

.line-card .task {
  grid-column: 1/-1;
  grid-row: 1;
  justify-self: center;
}

.line-help {
  grid-column: 1/-1;
  grid-row: 2;
  justify-self: center;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

.line-stage {
  grid-column: 1/-1;
  grid-row: 3;
}

#number-line {
  touch-action: none;
  cursor: grab;
  border-radius: 12px;
}

#number-line.dragging {
  cursor: grabbing;
}

#number-line[aria-disabled=true] {
  cursor: default;
}

.control-dock,.mental-dock {
  grid-template-columns: 1fr;
  width: min(480px,100%);
  gap: 6px;
}

.answer-control {
  grid-column: 1/-1;
  justify-self: center;
  width: 100%;
}

.answer-control #answer {
  max-width: 240px;
}

.feedback {
  grid-row: auto;
}

.line-card.has-response {
  grid-template-columns: minmax(0,1fr) 310px;
}

.has-response .mental-stage {
  grid-column: 1;
  grid-row: 3;
}

.has-response .response-control {
  grid-column: 2;
  grid-row: 3;
}

@media(min-width:750px) and (max-height:600px) {
  .play-screen {
    padding: 8px 18px;
    gap: 5px;
  }

  .line-card {
    padding: 0 8px;
  }

  .task strong {
    font-size: 32px;
  }

  .line-help {
    font-size: 12px;
  }

}

@media(min-width:650px) and (orientation:portrait) {
  .line-card {
    padding: 0;
    grid-template-rows: auto 24px minmax(240px,1fr);
  }

  .line-card.has-response {
    grid-template-columns: 1fr;
  }

  .has-response .mental-stage {
    grid-column: 1;
    grid-row: 2;
  }

  .has-response .response-control {
    grid-column: 1;
    grid-row: 3;
    max-width: 340px;
  }

}

@media(max-width:649px) and (orientation:portrait) {
  .play-screen {
    padding: 10px 12px;
  }

  .line-card {
    padding: 0;
    grid-template-rows: auto 36px minmax(240px,1fr);
  }

  .line-help {
    max-width: 100%;
    font-size: 12px;
  }

  .line-card.has-response {
    grid-template-columns: 1fr;
  }

  .has-response .mental-stage {
    grid-column: 1;
    grid-row: 2;
  }

  .has-response .response-control {
    grid-column: 1;
    grid-row: 3;
  }

  .answer-control #answer {
    max-width: none;
  }

  .mental-dock .answer-control #answer {
    flex-basis: auto;
  }

}

.play-screen {
  grid-template-rows: 44px minmax(430px,1fr);
}

.line-card {
  height: 100%;
  align-self: safe center;
}

.line-card .control-dock {
  grid-column: 1/-1;
  grid-row: 4;
  margin: 0 auto;
  align-self: center;
}

.line-card.has-response {
  grid-template-rows: auto 24px minmax(240px,1fr) 80px;
}

@media(min-width:750px) and (max-height:600px) {
  .play-screen {
    grid-template-rows: 44px minmax(430px,1fr);
  }

}

@media(min-width:650px) and (orientation:portrait) {
  .play-screen {
    grid-template-rows: 44px minmax(430px,1fr);
  }

}

@media(max-width:649px) and (orientation:portrait) {
  .play-screen {
    grid-template-rows: 44px minmax(430px,1fr);
  }

  .line-card.has-response {
    height: auto;
    max-height: none;
  }

}

.dialog-content {
  width: min(510px,calc(100vw - 32px));
  padding: 24px;
  text-align: center;
}

.dialog-content h2 {
  margin: 8px 0 12px;
  font-size: 25px;
}

.dialog-content p {
  line-height: 1.5;
}

.dialog-content ol {
  text-align: left;
  margin: 18px 0;
  padding-left: 24px;
  line-height: 1.55;
}

.dialog-content li+li {
  margin-top: 8px;
}

.dialog-content #close-rules {
  margin-top: 16px;
}

@media(min-width:750px) and (max-height:600px) {
  .dialog-content {
    padding: 20px;
  }

  .dialog-content h2 {
    font-size: 23px;
  }

  .dialog-content ol {
    margin: 12px 0;
  }

  .dialog-content li+li {
    margin-top: 5px;
  }

}

.menu-copy,dialog,.response-control {
  background: linear-gradient(145deg,#315f65,#203f46);
  color: #fff1d8;
  border-color: #8abbb8;
  box-shadow: inset 0 1px 0 #d8ecec55,0 5px 12px #18363b40;
}

.menu-copy .eyebrow,.menu-description,.level-picker,.completion-note,dialog .eyebrow,dialog p {
  color: #d3e8df;
}

.menu-copy h1 {
  color: #fff1d8;
}

.menu-copy h1 span {
  color: #ef876f;
}

.level-button {
  background: linear-gradient(#41747b,#315e65);
  color: #fff1d8;
  border-color: #75a9a6;
  box-shadow: inset 0 1px 0 #d8ecec40,0 2px 0 #17373b;
}

.level-button:hover {
  background: #477c80;
}

.level-button[aria-pressed=true] {
  background: #d85743;
  border-color: #f09a7d;
}

.secondary,.quiet,.fullscreen-button {
  background: #315e65;
  color: #fff1d8;
  border: 1px solid #8abbb8;
  box-shadow: inset 0 1px 0 #d8ecec40;
}

.secondary:hover,.quiet:hover {
  background: #41747b;
}

.fullscreen-button svg {
  stroke: #fff1d8;
}

.task {
  background: linear-gradient(150deg,#315f65,#203f46);
  border: 2px solid #8abbb8;
  border-radius: 12px;
  padding: 5px 14px;
  box-shadow: inset 0 1px 0 #d8ecec40,0 3px 0 #17373b;
}

.task strong {
  background: none;
  color: #fff1d8;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.level-indicator {
  background: none;
  color: #c2ded7;
  margin-top: 2px;
  padding: 0;
}

.line-help {
  background: none;
  color: #254e55;
  text-shadow: 0 1px 2px #fff1d8,0 0 4px #fff1d8;
  padding: 3px 6px;
}

#number-line:focus-visible {
  filter: drop-shadow(0 0 3px #fff1d8);
}

.feedback:not(:empty) {
  background: #254e55;
  color: #fff1d8;
  text-shadow: none;
}

.feedback.correct {
  color: #d4edbc;
}

.feedback.wrong {
  color: #ffd0b0;
}

.mental-stage p {
  background: #254e55;
  color: #fff1d8;
  border-radius: 7px;
  padding: 5px 10px;
}

.choice-button,.keypad button {
  background: linear-gradient(#8ccac6,#75bab8);
  border-color: #aacfc7;
  color: #183d45;
  box-shadow: inset 0 1px 0 #d9eeee88,0 2px 0 #284d53;
}

.keypad button[data-key="minus"] {
  background: #f0c4a3;
  color: #672e28;
  border: 2px solid #fff1d8;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.keypad button[data-key="minus"]:active {
  background: #e4ad85;
}

.keypad button[data-key="delete"] {
  font-size: 24px;
}

.choice-button[aria-pressed=true] {
  background: #d85743;
  color: #fff1d8;
  border-color: #fff1d8;
}

.choice-button:hover {
  border-color: #fff1d8;
}

#answer-input {
  background: #b6dcd4;
  color: #183d45;
  border-color: #75bab8;
}

#answer-input::placeholder {
  color: #486d73;
  opacity: 1;
}

.result-icon {
  background: #75bab8;
  color: #173e45;
}

.menu-master {
  display: block;
  height: 260px;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 3px #254e5530);
}

.mental-master {
  object-fit: contain;
  filter: drop-shadow(0 4px 2px #254e5530);
}

@media(min-width:750px) and (max-height:600px) {
  .menu-master {
    height: 230px;
  }

  .task {
    padding: 4px 12px;
  }

}

@media(min-width:650px) and (orientation:portrait) {
  .menu-master {
    height: 200px;
  }

}

@media(max-width:649px) and (orientation:portrait) {
  .menu-master {
    height: 160px;
  }

  .task {
    padding: 4px 10px;
  }

}

.game-toolbar {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
}

.game-toolbar .quiet {
  justify-self: start;
}

.game-toolbar .level-indicator {
  grid-column: 2;
  justify-self: center;
  margin: 0;
  padding: 7px 12px;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  color: #fff1d8;
  background: #254e55;
  border: 1px solid #8abbb8;
  border-radius: 8px;
}

.task-row {
  grid-column: 1/-1;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  align-items: center;
  width: 100%;
  gap: 14px;
}

.line-card .task-row .task {
  grid-column: 2;
  grid-row: 1;
}

.task-row .feedback {
  grid-column: 3;
  grid-row: 1;
  justify-self: start;
  min-height: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  text-align: left;
  text-shadow: none;
}

.task-row .feedback:not(:empty) {
  padding: 8px 12px;
  border-radius: 9px;
  background: #254e55;
  color: #fff1d8;
}

.task-row .feedback.correct,
.task-row .feedback.wrong {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.feedback-art {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 3px 2px #254e5530);
}

.feedback-mark,
.feedback-splash {
  transform-origin: 80px 80px;
}

.feedback-mark {
  animation: feedback-water-hop 650ms cubic-bezier(.2,.8,.3,1.3) both;
}

.feedback.wrong .feedback-mark {
  animation: feedback-water-stop 600ms ease-out both;
}

.feedback-splash {
  animation: feedback-water-splash 850ms ease-out both;
}

@keyframes feedback-water-hop {
  0% { transform: translateY(15px) scale(.3) rotate(-18deg); opacity: 0; }
  50% { transform: translateY(-7px) scale(1.12) rotate(4deg); opacity: 1; }
  75% { transform: scale(.96) rotate(-2deg); }
  100% { transform: none; opacity: 1; }
}

@keyframes feedback-water-stop {
  0% { transform: translateX(18px) scale(.7); opacity: 0; }
  35% { transform: translateX(-9px) scale(1.1); opacity: 1; }
  60% { transform: translateX(5px); }
  80% { transform: translateX(-2px); }
  100% { transform: none; opacity: 1; }
}

@keyframes feedback-water-splash {
  0% { transform: scale(.4); opacity: 0; }
  35% { opacity: 1; }
  75% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

@media(max-width:649px), (max-height:600px) {
  .task-row .feedback.correct,
  .task-row .feedback.wrong {
    width: 60px;
    height: 60px;
  }
}

@media(prefers-reduced-motion:reduce) {
  .feedback-mark,
  .feedback.wrong .feedback-mark,
  .feedback-splash {
    animation: none;
  }
}

@media(max-width:649px) {
  .task-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .line-card .task-row .task {
    grid-column: 1;
  }

  .task-row .feedback {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
    text-align: center;
    font-size: 16px;
  }

  .task-row .feedback:empty {
    display: none;
  }

}

#answer.counting {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

#answer.counting::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 0;
  width: var(--countdown-progress,0%);
  background: rgba(255,239,214,.22);
  pointer-events: none;
}

#answer-input:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px #254e55;
}

.keypad {
  display: grid;
}

@media(min-width:650px) and (orientation:landscape) {
  .has-response .input-control {
    grid-row: 2 / 4;
    padding: 8px;
  }

}

.line-card {
  max-height: 580px;
  grid-template-rows: auto 24px minmax(280px,1fr) 64px;
}

.line-stage {
  min-height: 280px;
}

.mental-master {
  width: 160px;
  height: 240px;
}

.mental-stage {
  gap: 10px;
}

@media(min-width:750px) and (max-height:600px) {
  .line-card {
    grid-template-rows: auto 22px minmax(270px,1fr) 60px;
    gap: 5px;
  }

  .line-stage {
    min-height: 270px;
  }

  .mental-master {
    width: 120px;
    height: 180px;
  }

  .mental-stage {
    min-height: 200px;
  }

}

@media(min-width:650px) and (orientation:portrait) {
  .mental-master {
    width: 160px;
    height: 240px;
  }

  .line-card.has-response {
    grid-template-rows: auto minmax(280px,1fr) auto 70px;
    max-height: 850px;
  }

  .has-response .mental-stage {
    min-height: 280px;
  }

}

@media(max-width:649px) and (orientation:portrait) {
  .mental-master {
    width: 120px;
    height: 180px;
  }

  .line-card.has-response {
    grid-template-rows: auto 220px auto 70px;
  }

  .has-response .mental-stage {
    min-height: 220px;
  }

}

.game-main,.menu-screen,.menu-copy,.line-card,.task-row,.response-control {
  min-width: 0;
}

.menu-screen {
  width: 100%;
}

.menu-copy h1 {
  overflow-wrap: anywhere;
}

.storage-notice {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: #ffdfb3;
}

body[data-fullscreen="true"] .fullscreen-button {
  display: grid;
}

#number-line:focus-visible {
  outline: 2px solid #254e55;
  outline-offset: -3px;
}

@media(max-width:400px) {
  .game-toolbar .level-indicator {
    max-width: calc(100vw - 208px);
    white-space: normal;
    text-align: center;
    font-size: 12px;
    padding: 4px 6px;
  }

}

@media(prefers-contrast:more) {
  .line-help {
    background: #fff1d8;
    text-shadow: none;
  }

  button:focus-visible,a:focus-visible {
    outline: 3px solid #fff1d8;
    box-shadow: 0 0 0 5px #254e55;
  }

}

@media(forced-colors:active) {
  .task,.level-indicator,.response-control,.menu-copy {
    border: 2px solid CanvasText;
  }

  #answer.counting::before {
    background: Highlight;
    opacity: .25;
  }

  #number-line:focus-visible {
    outline: 3px solid Highlight;
  }

}


/* On narrow screens keep the task and navigation visible during internal scrolling. */
@media (max-width: 649px) {
  .play-screen { scroll-padding-top: 140px; }
  .game-toolbar { position: sticky; top: 0; z-index: 3; }
  .task-row { position: sticky; top: 52px; z-index: 2; }
}

/* Keep the choice panel beside the master rather than at the window edge. */
@media(min-width:650px) and (orientation:landscape) {
  .line-card.has-choices {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .has-choices .mental-stage {
    justify-self: end;
    margin-inline-end: 24px;
  }

  .has-choices #choice-control {
    justify-self: start;
    margin-inline-start: 24px;
    width: calc(100% - 24px);
  }
}
