:root {
  color-scheme: light;
  font: 16px/1.45 "Trebuchet MS", Arial, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  color: #153e39;
  background: #daedf3;
  --pine: #133b34;
  --muted: #48625d;
  --mint: #ccede0;
  --cream: #fffdf1;
  --amber: #ffda76;
  --pink: #e6668b;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid #167b70; outline-offset: 4px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.game {
  position: relative; isolation: isolate; height: 100vh; height: 100dvh;
  min-height: 380px; overflow: hidden;
  background: linear-gradient(160deg, #dceef8 0%, #eff9f6 70%, #d3e6f3 100%);
}
#course, .cover { position: absolute; inset: 0; width: 100%; height: 100%; }
#course { display: block; touch-action: none; }
.cover { display: none; pointer-events: none; }
.game[data-mode="home"] .cover {
  display: block;
  background: linear-gradient(90deg, #f0f8f6 0%, #eff8f5f2 23%, #edf7f3bb 34%, #edf7f300 56%);
}
.game.has-cover[data-mode="home"] .cover {
  background:
    linear-gradient(90deg, #edf7f5 0%, #f1f9f5ce 24%, #f1f9f530 41%, transparent 57%),
    var(--cover-art) center center / cover no-repeat,
    #eaf4f9;
}
.menu-bar {
  position: absolute; z-index: 2; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: 1.25rem clamp(1.2rem, 4.3vw, 4.5rem);
}
.brand {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: .7rem; color: var(--pine);
  font-size: .83rem; font-weight: 900; letter-spacing: .11em; line-height: 1.11;
}
.brand-mark {
  display: grid; place-items: center; width: 2.8rem; height: 2.8rem;
  font-size: 1.7rem; line-height: 1; color: #e6fbf2; background: var(--pine);
  border: 1px solid #2e6157; border-radius: 1rem; transform: rotate(-7deg);
  box-shadow: 0 3px 0 #75a79a40, inset 0 1px 0 #ffffff32;
}
.menu-bar nav { display: flex; gap: .5rem; margin-left: auto; }
.language-switch {
  display: inline-flex; flex: 0 0 auto; align-items: center; gap: .13rem;
  padding: .15rem; border: 1px solid #326b5e3d; border-radius: 99px;
  background: #f9fffcf0; box-shadow: 0 2px 4px #21474a12;
}
.language-switch button {
  display: grid; place-items: center; min-height: 2.175rem; padding: .15rem .59rem;
  border: 1px solid transparent; border-radius: 99px; font-size: .79rem;
  font-weight: 900; line-height: 1.15; color: var(--pine); background: transparent; white-space: nowrap;
}
.language-switch button:hover { background: #d9eee6; }
.language-switch button[aria-pressed="true"] { background: var(--pine); color: #f2fff7; }
.run-language { position: absolute; top: calc(100% + .32rem); right: 0; pointer-events: auto; }
.run-language button, .panel-language button { min-height: 1.68rem; }
.panel-language { position: absolute; top: .83rem; left: .85rem; }
:root[lang="ko"] :is(.brand, .stat-label, .start-card label, .leader-table th) { letter-spacing: .01em; }
.nav-button, .pause-button {
  display: inline-flex; gap: .52rem; align-items: center; justify-content: center;
  border-radius: 99px; min-height: 2.6rem; padding: 0 .91rem;
  border: 1px solid #326b5e32; color: var(--pine); background: #f9fffcdf;
  box-shadow: 0 2px 4px #21474a12; font-weight: 800; font-size: .87rem;
}
.nav-button { white-space: nowrap; }
.nav-button:hover, .pause-button:hover { background: white; border-color: #659c8f; }
.question-icon {
  display: inline-grid; place-items: center; width: 1rem; height: 1rem;
  font-size: .72rem; line-height: 1; border: 1.5px solid currentColor; border-radius: 50%;
}
.cup-icon { font-size: .88rem; }
.sound { width: 2.6rem; padding: 0; position: relative; font-size: 1.2rem; }
.sound[aria-pressed="false"]::after {
  content: ""; position: absolute; width: 16px; height: 1.5px; border-radius: 9px;
  background: currentColor; transform: rotate(-48deg); box-shadow: 0 1px #f9fffc;
}
.home {
  position: relative; height: 100%; display: flex; align-items: center;
  overflow: auto; padding: 5.25rem 0 1.4rem clamp(2rem, 7.2vw, 9rem);
}
.home-copy { width: min(31rem, 41vw); margin-block: auto; position: relative; z-index: 1; }
h1 {
  margin: 0 0 .87rem; position: relative; width: fit-content;
  color: var(--pine); font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: clamp(4rem, 8.15vw, 9.15rem); font-weight: 1000;
  letter-spacing: -.091em; line-height: .86;
  text-shadow: 0 .035em #9dccc1, 0 .072em #fcfffd;
  -webkit-text-stroke: .012em currentColor;
}
.title-second { color: #237b6c; }
:root[lang="ko"] h1 {
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: clamp(3rem, 7vw, 8.25rem); line-height: .98; letter-spacing: -.08em;
}
:root[lang="ko"] .intro, :root[lang="ko"] .guide-list p { word-break: keep-all; }
.title-spark {
  color: #ec967c; position: absolute; top: -.13em; right: -.65em;
  font-size: .36em; text-shadow: .055em .06em #fff4e0; transform: rotate(-11deg);
}
.intro {
  margin: 1.4rem 0 1.45rem; width: min(23rem, 93%); color: #37554f;
  font-size: clamp(1rem, 1.5vw, 1.2rem); font-weight: 650; line-height: 1.5;
}
.start-card {
  display: grid; gap: .6rem; width: min(25.2rem, 100%); padding: 1.05rem 1.12rem 1.13rem;
  background: #fffffff0; border: 1px solid #c3dad3; border-radius: 1.45rem;
  box-shadow: 0 12px 37px #31536a18, 0 3px 0 #c1dcd5;
}
.start-card label {
  color: #41635c; font-size: .77rem; font-weight: 900; letter-spacing: .13em;
}
.start-card input {
  min-width: 0; width: 100%; min-height: 2.78rem; padding: .52rem .8rem;
  color: var(--pine); background: #eff7f5; border: 1px solid #c1d8d0;
  border-radius: .75rem; font-weight: 700;
}
.start-card input::placeholder { color: #617e75; opacity: 1; font-weight: 500; }
.primary, .secondary {
  display: inline-flex; gap: .62rem; justify-content: center; align-items: center;
  width: 100%; min-height: 3rem; padding: .68rem 1rem;
  border: 1px solid #183f35; border-radius: .85rem; font-weight: 900; color: var(--pine);
}
.primary {
  border-color: #bd8a34; background: linear-gradient(180deg, #ffe99b, var(--amber));
  box-shadow: 0 3px 0 #ce9e46; font-size: 1.02rem;
}
.start-card .primary { margin-top: .12rem; }
.primary:hover { background: #ffe89a; }
.primary:active, .secondary:active { transform: translateY(2px); box-shadow: 0 1px 0 #b98d45; }
.secondary { background: #e8f5f0; border-color: #bdd8ce; }
.secondary:hover { background: #d9eee6; }
.play-icon {
  display: inline-block; width: 0; height: 0; border-left: .63rem solid currentColor;
  border-top: .43rem solid transparent; border-bottom: .43rem solid transparent;
  border-radius: 2px;
}
.home-controls {
  display: flex; align-items: center; margin: 1.32rem 0 0; gap: .48rem;
  color: #47625c; font-size: .84rem; font-weight: 800; white-space: nowrap;
}
.key-group { display: inline-flex; gap: .26rem; align-items: center; }
kbd {
  display: inline-grid; place-items: center; min-width: 1.58rem; height: 1.64rem;
  padding: 0 .19rem; background: #fdfffe; border: 1px solid #b9d5ce;
  border-radius: .33rem; font: 800 .86rem/1 "Trebuchet MS", sans-serif; color: var(--pine);
  box-shadow: 0 2px 0 #bdd4ce;
}
.helper-disjunction { color: #4d6d66; font-weight: 500; }
.control-divider { margin: 0 .22rem; width: 1px; height: 1.1rem; background: #a8c5bd; }
.pointer-label { display: inline-flex; align-items: center; gap: .4rem; }
.mouse-icon {
  width: .77rem; height: 1.06rem; border: 1.5px solid currentColor; border-radius: .4rem;
  display: inline-block; position: relative;
}
.mouse-icon::before {
  content: ""; position: absolute; top: 2px; left: calc(50% - .7px);
  width: 1.4px; height: 4px; border-radius: 2px; background: currentColor;
}
.touch-copy { display: none; }
@media (pointer: coarse) { .mouse-copy, .mouse-icon { display: none; } .touch-copy { display: inline; } }

.hud {
  pointer-events: none; position: absolute; z-index: 4; top: 1rem; left: 2%; right: 2%;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: .4rem; align-items: start;
}
.readout {
  min-width: 6.4rem; width: fit-content; max-width: min(31vw, 18rem);
  background: #fafff4ec; border: 1px solid #94c2b7; border-radius: 1rem;
  padding: .54rem .88rem .62rem; box-shadow: 0 3px 0 #41847731, 0 6px 14px #264d5e14;
}
.stat-label {
  display: block; margin-bottom: .08rem; color: #42685c;
  font-weight: 900; letter-spacing: .13em; font-size: .69rem;
}
.stat-figure { display: flex; align-items: baseline; gap: .23rem; line-height: 1.02; white-space: nowrap; }
.stat-figure strong { font-size: clamp(1.4rem, 3.25vw, 2.1rem); font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-unit { color: #52716b; font-size: .72rem; font-weight: 800; }
.score { text-align: center; }
.score .stat-figure { justify-content: center; }
.hud-right { justify-self: end; display: flex; align-items: center; gap: .55rem; }
.heart-row { display: flex; flex-wrap: wrap; gap: 0 .18rem; align-items: center; line-height: 1; min-height: 1.3rem; }
.heart-row > span { color: var(--pink); font-size: 1.5rem; text-shadow: 0 1px #9d3d64; }
.heart-row > .empty-heart { color: #a8c6bd; text-shadow: none; }
.pause-button { pointer-events: auto; padding: 0; width: 2.6rem; flex-shrink: 0; }
.pause-button span { width: .7rem; height: .88rem; border-inline: .23rem solid currentColor; border-radius: 1px; }
.status-area {
  position: absolute; z-index: 3; pointer-events: none; top: clamp(5.4rem, 13%, 7rem);
  left: 50%; transform: translateX(-50%); width: max-content; max-width: 96%; text-align: center;
}
.warning, .toast {
  margin: 0 auto .45rem; padding: .44rem .8rem; width: fit-content;
  color: var(--pine); border: 1px solid #a7c3bc; border-radius: 1rem;
  background: #fffff7f0; font-size: clamp(.82rem, 2.25vw, .98rem); font-weight: 800;
  box-shadow: 0 3px 0 #4176681f;
}
.warning { background: #ffdf83; border-color: #bc8b3c; }
.warning span { margin-right: .37rem; }
.toast[data-type="devil"] { background: #dfd5ff; border-color: #a595d5; }
.toast[data-type="giant"] { background: #ffedb7; border-color: #cda45a; }
.toast[data-type="hit"] { background: #ffe3e6; border-color: #d493a3; }
.run-tools {
  position: absolute; z-index: 3; pointer-events: none; bottom: max(1rem, env(safe-area-inset-bottom));
  left: 2%; right: 2%; display: flex; flex-wrap: wrap; align-items: center; gap: .47rem;
}
.run-chip {
  display: flex; align-items: center; gap: .36rem; border-radius: 99px;
  background: #fafff4eb; padding: .35rem .63rem; border: 1px solid #97bfb6;
  font-size: .85rem; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.growth-progress .sparkle, .giant-timer .sparkle { color: #a06915; }
.giant-timer { background: #ffedb7; border-color: #cda45a; }
.devil-timer { background: #ede6ff; border-color: #ac9bde; }
.lane-inputs { position: absolute; inset: 0; display: flex; z-index: 1; touch-action: none; }
.lane-inputs button { flex: 1; border: 0; padding: 0; background: transparent; touch-action: none; }
.lane-inputs button:focus-visible { outline: 3px solid #28766c; outline-offset: -5px; }

.panel {
  width: min(30rem, calc(100% - 1.5rem)); max-width: none;
  max-height: calc(100% - 1.5rem); padding: 0; margin: auto; overflow: hidden;
  color: var(--pine); background: #fdfff9;
  border: 1px solid #9ac3b8; border-radius: 1.55rem;
  box-shadow: 0 25px 90px #0b352a56, 0 6px 0 #49695e63;
}
.panel::backdrop { background: #1c474768; backdrop-filter: blur(6px); }
.panel-scroll { position: relative; padding: 1.13rem 1.32rem 1.4rem; overflow: auto; max-height: calc(100dvh - 1.55rem); }
.close {
  position: absolute; top: .8rem; right: .85rem; display: grid; place-items: center;
  color: var(--pine); border: 1px solid #bdd7cd; background: #edf7f3; border-radius: 50%;
  width: 2.25rem; height: 2.25rem; font-size: 1.52rem; line-height: 1; padding: 0 0 .13rem;
}
.close:hover { background: #d9eee6; }
.panel-mark {
  display: grid; place-items: center; width: 2.63rem; height: 2.63rem; margin: 0 auto .35rem;
  color: #237c6b; background: var(--mint); border-radius: .85rem;
  font-size: 1.62rem; line-height: 1;
}
.panel-mark.trophy { color: #9d6419; background: #ffedab; }
.panel h2 { font-size: clamp(1.5rem, 6vw, 2rem); font-weight: 900; letter-spacing: -.045em; line-height: 1.1; text-align: center; margin: .23rem 0 .88rem; }
.guide-steer { display: flex; align-items: center; gap: .74rem; padding: .66rem .74rem; background: #e6f4ed; border-radius: .77rem; }
.guide-steer .key-group { display: grid; grid-template-columns: repeat(2, 1fr); }
.guide-steer p, .guide-list p { margin: 0; color: #48625d; font-size: .93rem; line-height: 1.28; }
.guide-list { list-style: none; margin: .58rem 0 .87rem; padding: 0; }
.guide-list li { display: flex; gap: .65rem; align-items: center; padding: .44rem .18rem; }
.guide-list li + li { border-top: 1px solid #dcebe6; }
.guide-list strong { color: var(--pine); font-weight: 900; }
.guide-icon {
  flex: 0 0 2.2rem; height: 2.2rem; display: grid; place-items: center;
  border-radius: .67rem; color: #2e7383; font-size: 1.23rem;
}
.ice { background: #d3effb; }
.pink { background: #ffe3e8; }
.yellow { background: #ffedb7; }
.lilac { background: #eae0ff; }
.leader-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: .62rem 0 .85rem; font-variant-numeric: tabular-nums; }
.leader-table th, .leader-table td { border-bottom: 1px solid #e1ede8; padding: .31rem .52rem; text-align: left; }
.leader-table th { font-size: .69rem; color: #587766; letter-spacing: .1em; }
.leader-table td { font-size: .87rem; }
.leader-table td:first-child { width: 21%; font-weight: 900; }
.leader-table td:last-child, .leader-table th:last-child { text-align: right; white-space: nowrap; }
.leader-table td:nth-child(2) { overflow-wrap: anywhere; }
.leader-table .placeholder { color: #658079; }
.leader-table .your-score td { background: #e2f5ec; font-weight: 900; }
.result, .leader-status { text-align: center; color: #4b6a60; font-weight: 700; margin: .3rem 0 .5rem; }
.result strong { color: var(--pine); }
.leader-status { font-size: .86rem; }
.panel-actions { display: flex; gap: .48rem; }

@media (max-height: 690px) and (min-width: 701px) {
  .home { padding-top: 4.45rem; }
  h1 { font-size: clamp(3.7rem, min(8vw, 14vh), 7.5rem); }
  .intro { margin: 1rem 0; }
  .home-controls { margin-top: 1rem; }
}
@media (max-width: 700px) {
  .menu-bar { padding: .8rem .8rem; }
  .brand { font-size: .67rem; gap: .4rem; }
  .brand-mark { width: 2.15rem; height: 2.15rem; border-radius: .72rem; font-size: 1.27rem; }
  .menu-bar nav { gap: .28rem; }
  .menu-bar { gap: .3rem; }
  .language-switch button { min-height: 1.75rem; padding-inline: .43rem; font-size: .73rem; }
  .run-language button, .panel-language button { min-height: 1.52rem; }
  .panel-language { top: .88rem; left: .7rem; }
  :root[lang="ko"] h1 { font-size: clamp(2.7rem, 10.2vw, 4.15rem); }
  .nav-button { min-height: 2.21rem; font-size: .74rem; padding: 0 .58rem; gap: .25rem; }
  .sound { width: 2.21rem; padding: 0; font-size: 1rem; }
  .game[data-mode="home"] .cover {
    background: linear-gradient(180deg, #eff8f426 11%, #eef8f345 28%, #eef8f3 49%, #eef8f3 100%);
  }
  .game.has-cover[data-mode="home"] .cover {
    background: linear-gradient(180deg, #f2f9fa15 12%, #eff8f600 26%, #edf7f5 55%, #edf7f5 100%),
      var(--cover-art) 89% 0 / auto 64% no-repeat, #edf7f5;
  }
  .home { align-items: end; justify-content: center; padding: clamp(11rem, 35vh, 21rem) 1rem max(1.25rem, env(safe-area-inset-bottom)); }
  .home-copy { width: min(23rem, 100%); margin: auto auto 0; }
  h1 { font-size: clamp(3rem, 11.2vw, 4.5rem); line-height: .89; letter-spacing: -.09em; margin: .36rem 0 .75rem; }
  .intro { font-size: .93rem; margin: .74rem 0 .8rem; width: 100%; }
  .start-card { padding: .71rem .78rem .8rem; border-radius: 1.1rem; gap: .39rem; }
  .start-card .primary, .start-card input { min-height: 2.55rem; padding-top: .42rem; padding-bottom: .42rem; }
  .home-controls { margin: .86rem 0 0; }
  .hud { top: .62rem; left: 2%; right: 2%; }
  .readout { min-width: 4.75rem; padding: .38rem .43rem .42rem; border-radius: .7rem; }
  .heart-row { gap: 0 .1rem; }
  .heart-row > span { font-size: 1.19rem; }
  .stat-label { font-size: .58rem; }
  .stat-unit { font-size: .61rem; }
  .hud-right { gap: .23rem; }
  .pause-button { width: 2.06rem; min-height: 2.06rem; }
}
@media (max-width: 540px) {
  .brand > span:last-child { display: none; }
}
@media (max-width: 380px) {
  .menu-bar { padding-inline: .58rem; flex-wrap: wrap; }
  .menu-language { margin-left: auto; }
  .home-controls { gap: .36rem; }
  .nav-button { padding-inline: .44rem; }
  .nav-button .cup-icon, .nav-button .question-icon { display: none; }
  .sound { padding: 0; }
  .panel-scroll { padding-inline: .87rem; }
}
@media (max-width: 700px) and (max-height: 630px) {
  .home { padding-top: clamp(5.5rem, 24vh, 10rem); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

