:root {
  color-scheme: dark;
  --bg: #0d1218;
  --ink: #f3f0df;
  --muted: #9fb1b8;
  --yellow: #e5b83f;
  --teal: #2e9b91;
  --teal-dark: #135a58;
  --glass: #b9dce2;
  --steel: #697681;
  --pink: #d15f7c;
  --danger: #d84739;
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  background: #11151c;
  color: #edf2f4;
}

* {
  box-sizing: border-box;
}

body {
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, rgba(70, 95, 110, 0.16), transparent 38rem),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 32px),
    linear-gradient(180deg, #121922, #080c11 74%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    radial-gradient(circle at 18% 26%, rgba(255,255,255,.05) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 18%, rgba(255,255,255,.04) 0 1px, transparent 2px),
    radial-gradient(circle at 44% 78%, rgba(255,255,255,.035) 0 1px, transparent 2px);
  background-size: 94px 86px, 132px 128px, 176px 152px;
  opacity: .75;
}

body::after {
  background:
    linear-gradient(110deg, transparent 0 14%, rgba(255,255,255,.035) 14.2%, transparent 14.6% 100%),
    radial-gradient(circle at 15% 82%, rgba(255,255,255,.08), transparent 3px),
    radial-gradient(circle at 88% 74%, rgba(255,255,255,.06), transparent 4px);
  mix-blend-mode: screen;
  opacity: .55;
}

button {
  min-height: 2.5rem;
  border: 1px solid rgba(247, 208, 70, 0.35);
  border-radius: 8px;
  padding: 0 1rem;
  background:
    linear-gradient(180deg, rgba(40, 54, 73, 0.96), rgba(17, 25, 36, 0.96));
  color: #edf2f4;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 20px rgba(0, 0, 0, 0.28);
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}

button:hover {
  border-color: rgba(247, 208, 70, 0.72);
  background:
    linear-gradient(180deg, rgba(51, 69, 92, 0.98), rgba(21, 32, 46, 0.98));
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.game-shell {
  width: min(100%, 1400px);
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 14px 20px 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  position: relative;
  transition: opacity 0.25s;
}

.game-shell.is-hidden {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

.playfield-frame {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
}

.playfield-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 8px;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), transparent 24%),
    radial-gradient(circle at 22% 22%, rgba(229,184,63,.055), transparent 16rem),
    radial-gradient(circle at 78% 20%, rgba(78,205,196,.045), transparent 14rem),
    linear-gradient(180deg, #192432, #141d28 58%, #17202a);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}

.playfield-bg::before {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: 11%;
  height: 52%;
  opacity: .16;
  background:
    linear-gradient(to top, rgba(0,0,0,.78), rgba(0,0,0,.18)),
    linear-gradient(90deg,
      transparent 0 4%, #05080c 4% 11%, transparent 11% 13%,
      #05080c 13% 19%, transparent 19% 25%, #05080c 25% 31%,
      transparent 31% 40%, #05080c 40% 47%, transparent 47% 51%,
      #05080c 51% 57%, transparent 57% 66%, #05080c 66% 74%,
      transparent 74% 81%, #05080c 81% 87%, transparent 87% 100%);
  clip-path: polygon(
    0 100%, 0 38%, 6% 38%, 6% 18%, 11% 18%,
    11% 46%, 16% 46%, 16% 26%, 21% 26%,
    21% 60%, 29% 60%, 29% 10%, 35% 10%,
    35% 40%, 42% 40%, 42% 20%, 48% 20%,
    48% 68%, 56% 68%, 56% 30%, 62% 30%,
    62% 50%, 71% 50%, 71% 16%, 78% 16%,
    78% 58%, 85% 58%, 85% 28%, 91% 28%,
    91% 52%, 100% 52%, 100% 100%
  );
}

.playfield-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .34;
  background:
    radial-gradient(circle at 24% 68%, rgba(229,184,63,.12) 0 2px, transparent 3px),
    radial-gradient(circle at 52% 30%, rgba(255,255,255,.07) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 61%, rgba(255,255,255,.06) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 40%, rgba(229,184,63,.08) 0 2px, transparent 3px);
}

.menu-screen {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  z-index: 20;
  transition: opacity 0.25s;
  overflow-y: auto;
  padding: 20px 0;
}

.menu-screen.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.mockup {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100vw - 28px));
  margin: 18px auto 32px;
}

.screen {
  display: none;
  animation: settle .18s ease-out;
}

.screen.is-active { display: block; }

@keyframes settle {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand {
  position: relative;
  width: min(760px, 92vw);
  margin: 0 auto 18px;
  padding: 10px 18px 12px;
  text-align: center;
  transform: rotate(-1deg);
  filter: drop-shadow(0 16px 0 rgba(0,0,0,.35));
}

.brand::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 2px solid rgba(255,255,255,.14);
  background:
    linear-gradient(90deg, rgba(240,180,40,.68) 0 54px, transparent 54px calc(100% - 54px), rgba(240,180,40,.68) calc(100% - 54px)),
    linear-gradient(180deg, #343b40, #151b22 58%, #0e1319);
  clip-path: polygon(3% 8%, 27% 0, 100% 7%, 97% 92%, 56% 100%, 0 90%);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.18),
    inset 0 -8px 0 rgba(0,0,0,.22),
    0 0 0 5px rgba(0,0,0,.18);
}

.brand::after {
  content: "";
  position: absolute;
  right: 86px;
  top: 56px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, #fbfaf0 0 7px, #d8d5c8 8px 26px, #9b988e 27px 28px, transparent 29px),
    radial-gradient(circle at 30% 30%, rgba(0,0,0,.25), transparent 38px);
  box-shadow:
    0 0 0 7px rgba(0,0,0,.2),
    0 0 0 13px rgba(255,255,255,.08),
    inset -8px -9px 0 rgba(0,0,0,.18);
  transform: rotate(10deg);
}

.brand-top,
.brand-bottom {
  position: relative;
  display: block;
  letter-spacing: .055em;
  text-transform: uppercase;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  line-height: .88;
  text-shadow:
    0 4px 0 rgba(0,0,0,.4),
    0 8px 16px rgba(0,0,0,.45);
}

.brand-top {
  font-size: clamp(2.35rem, 7vw, 5.2rem);
  color: var(--yellow);
  -webkit-text-stroke: 1px rgba(40,28,12,.55);
}

.brand-bottom {
  margin-top: -1px;
  font-size: clamp(2rem, 6vw, 4.25rem);
  color: #dedad0;
  -webkit-text-stroke: 1px rgba(0,0,0,.42);
}

.brand-subtitle {
  margin: 12px 0 0;
  color: #c2cbc6;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #000;
}

.course-list {
  display: grid;
  gap: 10px;
  margin: 0 auto;
}

.course-card {
  --mat: var(--teal);
  position: relative;
  display: grid;
  grid-template-columns: 142px 1fr 152px;
  min-height: 112px;
  overflow: hidden;
  padding: 0;
  border: 2px solid color-mix(in srgb, var(--mat) 78%, white 12%);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.10), transparent 20%, rgba(0,0,0,.20) 100%),
    repeating-linear-gradient(0deg, rgba(0,0,0,.12) 0 2px, transparent 2px 14px),
    var(--mat);
  color: var(--ink);
  box-shadow:
    0 6px 0 rgba(0,0,0,.42),
    inset 0 2px 0 rgba(255,255,255,.18),
    inset 0 -8px 0 rgba(0,0,0,.17);
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}

.course-card:hover:not(.locked) {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow:
    0 8px 0 rgba(0,0,0,.45),
    inset 0 2px 0 rgba(255,255,255,.2),
    inset 0 -8px 0 rgba(0,0,0,.17);
}

.course-card:active:not(.locked) {
  transform: translateY(3px);
  box-shadow:
    0 2px 0 rgba(0,0,0,.45),
    inset 0 2px 0 rgba(0,0,0,.12),
    inset 0 -6px 0 rgba(0,0,0,.16);
}

.course-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 6px;
  pointer-events: none;
  opacity: .8;
}

.course-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 50%, rgba(0,0,0,.35) 0 4px, transparent 4.5px),
    radial-gradient(circle at 67% 49%, rgba(0,0,0,.30) 0 4px, transparent 4.5px),
    radial-gradient(circle at 92% 50%, rgba(0,0,0,.30) 0 4px, transparent 4.5px),
    radial-gradient(circle at 3% 10%, rgba(255,255,255,.2) 0 1px, transparent 2px),
    radial-gradient(circle at 42% 86%, rgba(255,255,255,.16) 0 1px, transparent 2px),
    radial-gradient(circle at 71% 13%, rgba(255,255,255,.14) 0 1px, transparent 2px);
}

.course-number {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  align-content: center;
  border-right: 2px solid rgba(0,0,0,.42);
  background: rgba(10,20,24,.12);
  text-transform: uppercase;
}

.course-number small {
  display: block;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: .06em;
  opacity: .92;
}

.course-number b {
  display: block;
  margin-top: -4px;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 4rem;
  line-height: .9;
  font-weight: 400;
  letter-spacing: .02em;
  text-shadow: 0 4px 0 rgba(0,0,0,.3);
}

.course-body {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  padding: 15px 18px 14px 28px;
  min-width: 0;
}

.course-name {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(2.15rem, 5.7vw, 3.65rem);
  line-height: .88;
  letter-spacing: .045em;
  text-transform: uppercase;
  text-shadow:
    0 4px 0 rgba(0,0,0,.24),
    0 12px 16px rgba(0,0,0,.24);
}

.course-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.course-meta.is-status {
  gap: 10px;
  margin-top: 14px;
}

.material-icon {
  display: inline-grid;
  place-items: center;
  width: 39px;
  height: 32px;
  transform: rotate(-7deg);
  border: 2px solid rgba(0,0,0,.34);
  background: rgba(0,0,0,.22);
  box-shadow: 0 3px 0 rgba(0,0,0,.28), inset 0 2px 0 rgba(255,255,255,.15);
  font-size: 1.2rem;
}

.course-meta strong {
  color: rgba(255,255,255,.95);
  font-size: .96rem;
}

.course-meta span {
  color: rgba(210,245,246,.88);
  font-size: 1.25rem;
  letter-spacing: .06em;
}

.course-stars {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 2px solid rgba(0,0,0,.32);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.18)),
    rgba(18, 25, 30, .72);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    0 2px 0 rgba(0,0,0,.24);
  color: var(--yellow) !important;
  font-size: .95rem !important;
  line-height: 1;
  white-space: nowrap;
}

.status-badge {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 2px solid rgba(0,0,0,.38);
  border-radius: 7px;
  background:
    linear-gradient(45deg, transparent 0 28%, rgba(0,0,0,.30) 28% 36%, transparent 36% 62%, rgba(0,0,0,.30) 62% 70%, transparent 70%),
    rgba(38, 48, 54, .78);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.12),
    0 3px 0 rgba(0,0,0,.26);
  color: #ff806b !important;
  font-size: 1.05rem !important;
}

.stamp-zone {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding-right: 20px;
}

.cleared-stamp {
  display: inline-block;
  padding: 7px 15px;
  border: 4px solid rgba(84, 218, 209, .78);
  border-radius: 8px;
  color: rgba(106, 231, 222, .86);
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 1.72rem;
  letter-spacing: .055em;
  line-height: 1;
  text-transform: uppercase;
  transform: rotate(-7deg);
  opacity: .78;
  box-shadow: inset 0 0 0 2px rgba(84,218,209,.28);
  max-width: 138px;
}

.course-card.theme-wood {
  --mat: var(--teal);
}

.course-card.theme-glass {
  --mat: rgba(174, 209, 216, .83);
  color: #172d36;
  border-color: rgba(230,250,255,.88);
  background:
    linear-gradient(110deg, rgba(255,255,255,.35), transparent 34%, rgba(255,255,255,.18) 74%, transparent),
    linear-gradient(18deg, transparent 0 44%, rgba(255,255,255,.65) 44.5% 46%, transparent 46.5%),
    linear-gradient(-42deg, transparent 0 55%, rgba(255,255,255,.48) 55.4% 56.4%, transparent 57%),
    linear-gradient(180deg, rgba(237,252,255,.36), rgba(123,164,176,.18)),
    rgba(174, 209, 216, .82);
}

.theme-glass .course-name,
.theme-glass .course-meta strong,
.theme-glass .course-meta span {
  color: #162c35;
  text-shadow: none;
}

.theme-glass .course-number { background: rgba(38, 57, 64, .25); }

.course-card.theme-steel {
  --mat: #4f5963;
  border-color: #838d95;
  background:
    linear-gradient(90deg, transparent 0 70%, rgba(230,184,54,.8) 70% 75%, rgba(20,20,20,.35) 75% 80%, rgba(230,184,54,.8) 80% 85%, transparent 85%),
    linear-gradient(180deg, rgba(255,255,255,.09), transparent 22%, rgba(0,0,0,.28)),
    #4f5963;
}

.course-card.theme-bouncy {
  --mat: #ba5870;
  border-color: #e98ba0;
  background:
    radial-gradient(circle at 88% 30%, rgba(0,0,0,.22) 0 10px, transparent 11px),
    radial-gradient(circle at 22% 76%, rgba(255,255,255,.16) 0 6px, transparent 7px),
    linear-gradient(180deg, rgba(255,255,255,.08), transparent 45%, rgba(0,0,0,.2)),
    #ba5870;
}

.course-card.locked {
  cursor: not-allowed;
  filter: saturate(.78) brightness(.85);
}

.course-card.locked .stamp-zone { justify-items: stretch; }

.lock-plate {
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 2px solid rgba(0,0,0,.42);
  border-radius: 6px;
  background:
    linear-gradient(45deg, transparent 0 28%, rgba(0,0,0,.35) 28% 36%, transparent 36% 62%, rgba(0,0,0,.35) 62% 70%, transparent 70%),
    #3f474d;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.12), 0 4px 0 rgba(0,0,0,.34);
  color: #ff7d67;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 1.15rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.menu-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.reset-button,
.back-button {
  min-height: 50px;
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 8px;
  padding: 0 20px;
  color: var(--ink);
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 1.35rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0,0,0,.45), inset 0 2px 0 rgba(255,255,255,.18);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease, color .12s ease;
}

.reset-button {
  background:
    linear-gradient(90deg, rgba(255,255,255,.08), transparent 30%),
    #982b25;
  border-color: rgba(255, 122, 97, .55);
}

.back-button {
  background: #d0c6b0;
  color: #1b1f21;
  border-color: rgba(255,255,255,.36);
}

.reset-button:hover {
  transform: translateY(-2px);
  background:
    linear-gradient(90deg, rgba(255,255,255,.10), transparent 34%),
    #b3332b;
  border-color: rgba(255, 143, 118, .72);
  box-shadow:
    0 7px 0 rgba(0,0,0,.42),
    inset 0 2px 0 rgba(255,255,255,.20);
}

.back-button:hover {
  transform: translateY(-2px);
  background: #e2d8c1;
  border-color: rgba(255,255,255,.55);
  color: #15191b;
  box-shadow:
    0 7px 0 rgba(0,0,0,.42),
    inset 0 2px 0 rgba(255,255,255,.28);
}

.reset-button:active,
.back-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0,0,0,.45), inset 0 2px 0 rgba(0,0,0,.14);
}

.level-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  margin: 4px 0 16px;
}

.level-title-card {
  position: relative;
  min-height: 98px;
  padding: 16px 22px;
  border: 2px solid #4ecdc4;
  border-radius: 10px;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 2px, transparent 2px 15px),
    linear-gradient(180deg, rgba(255,255,255,.1), rgba(0,0,0,.18)),
    #287f78;
  box-shadow: 0 6px 0 rgba(0,0,0,.42), inset 0 2px 0 rgba(255,255,255,.18);
  overflow: hidden;
}

.level-title-card::before {
  content: attr(data-course-label);
  display: block;
  margin-bottom: 5px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
  letter-spacing: .13em;
  color: rgba(235,255,250,.72);
}

.level-title-card h2 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  line-height: .9;
  letter-spacing: .045em;
  text-transform: uppercase;
  text-shadow: 0 4px 0 rgba(0,0,0,.28);
}

.level-title-card p {
  margin: 9px 0 0;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(232,255,250,.78);
}

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

.level-tile {
  position: relative;
  min-height: 126px;
  padding: 14px 12px 12px;
  border: 2px solid rgba(78,205,196,.75);
  border-radius: 9px;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.13) 0 2px, transparent 2px 15px),
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.18)),
    #287f78;
  box-shadow: 0 6px 0 rgba(0,0,0,.42), inset 0 2px 0 rgba(255,255,255,.16);
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}

.level-tile:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.level-tile.selected {
  border-color: #f3f0df;
  box-shadow:
    0 6px 0 rgba(0,0,0,.42),
    inset 0 2px 0 rgba(255,255,255,.16),
    0 0 0 4px rgba(78,205,196,.25);
}

.level-tile::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 5px;
  pointer-events: none;
}

.level-number {
  display: block;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 3.45rem;
  line-height: .9;
  letter-spacing: .04em;
  text-shadow: 0 4px 0 rgba(0,0,0,.32);
}

.level-name {
  display: block;
  min-height: 1.2em;
  margin-top: 6px;
  color: rgba(235,255,250,.85);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.level-par {
  display: block;
  margin-top: 5px;
  color: rgba(232,255,250,.95);
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 1.15rem;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.level-stars {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  margin-top: 5px;
  padding: 0 10px;
  border: 2px solid rgba(0,0,0,.32);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.18)),
    rgba(18, 25, 30, .72);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    0 2px 0 rgba(0,0,0,.24);
  color: var(--yellow);
  font-size: 1rem;
  letter-spacing: .08em;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0,0,0,.28);
}

.level-medal {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 2px solid rgba(229, 184, 63, .62);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.16)),
    rgba(54, 43, 19, .88);
  color: var(--yellow);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 3px 0 rgba(0,0,0,.28);
}

.check {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-top: 0;
  border-radius: 50%;
  border: 2px solid rgba(185,255,248,.7);
  color: #70eee2;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
  background: rgba(0,0,0,.22);
}

.level-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.menu-reset {
  margin-top: 1.5rem;
  background: transparent;
  border-color: rgba(237, 242, 244, 0.12);
  color: #b7c3cc;
  font-size: 0.8rem;
  min-height: auto;
  padding: 6px 14px;
}

.menu-reset:hover {
  background: rgba(230, 57, 70, 0.15);
  border-color: #e63946;
  color: #e63946;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 21, 28, 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 10;
  opacity: 1;
  transition: opacity 0.25s;
}

.overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  --result: var(--teal);
  --result-dark: var(--teal-dark);
  --result-soft: rgba(46,155,145,.18);
  width: min(610px, calc(100vw - 48px));
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding: 22px;
  border: 2px solid color-mix(in srgb, var(--result) 72%, white 14%);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.10), transparent 22%, rgba(0,0,0,.30) 100%),
    repeating-linear-gradient(0deg, rgba(0,0,0,.13) 0 2px, transparent 2px 15px),
    linear-gradient(135deg, color-mix(in srgb, var(--result-dark) 70%, #11151c 30%), #151b22 58%, #0e1319);
  color: var(--ink);
  box-shadow:
    0 8px 0 rgba(0,0,0,.42),
    0 22px 50px rgba(0,0,0,.42),
    inset 0 2px 0 rgba(255,255,255,.18),
    inset 0 -8px 0 rgba(0,0,0,.18);
}

.overlay-card::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  pointer-events: none;
  opacity: .85;
}

.overlay-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,.15) 0 1px, transparent 2px),
    radial-gradient(circle at 75% 15%, rgba(255,255,255,.12) 0 1px, transparent 2px),
    radial-gradient(circle at 86% 84%, var(--result-soft), transparent 11rem),
    linear-gradient(110deg, transparent 0 16%, rgba(255,255,255,.050) 16.2%, transparent 16.9% 100%);
  opacity: .95;
}

.result-under {
  --result: #4ecdc4;
  --result-dark: #287f78;
  --result-soft: rgba(78,205,196,.20);
}

.result-par {
  --result: #b9dce2;
  --result-dark: #334553;
  --result-soft: rgba(185,220,226,.15);
}

.result-over {
  --result: #f4a261;
  --result-dark: #7a3d2b;
  --result-soft: rgba(244,162,97,.18);
}

.result-bad {
  --result: #e63946;
  --result-dark: #63232a;
  --result-soft: rgba(230,57,70,.16);
}

.result-content {
  position: relative;
  z-index: 1;
}

.result-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.result-kicker {
  display: block;
  margin-bottom: 4px;
  color: rgba(235,255,250,.70);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0,0,0,.3);
}

.result-title {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(3.1rem, 9vw, 5.6rem);
  line-height: .88;
  letter-spacing: .055em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--result) 76%, white 18%);
  -webkit-text-stroke: 1px rgba(0,0,0,.38);
  text-shadow:
    0 4px 0 rgba(0,0,0,.38),
    0 13px 18px rgba(0,0,0,.28),
    0 0 22px var(--result-soft);
}

.result-badge {
  min-width: 86px;
  min-height: 66px;
  display: grid;
  place-items: center;
  padding: 8px 11px;
  border: 2px solid rgba(0,0,0,.34);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.14), rgba(0,0,0,.18)),
    rgba(18, 25, 30, .70);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.12),
    0 5px 0 rgba(0,0,0,.34);
  color: var(--result);
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  text-align: center;
  transform: rotate(1.5deg);
}

.result-badge b {
  font-size: 2.15rem;
  line-height: .86;
  text-shadow: 0 3px 0 rgba(0,0,0,.32);
}

.result-badge span {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .11em;
  color: rgba(232,255,250,.78);
  text-transform: uppercase;
}

.result-summary {
  display: grid;
  grid-template-columns: minmax(142px, .84fr) minmax(0, 1.5fr);
  gap: 12px;
  align-items: stretch;
  margin: 0 0 18px;
}

.shots-taken {
  min-height: 126px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  border: 2px solid rgba(0,0,0,.34);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.14), rgba(0,0,0,.15)),
    repeating-linear-gradient(0deg, rgba(0,0,0,.10) 0 2px, transparent 2px 12px),
    color-mix(in srgb, var(--result-dark) 76%, #11151c 24%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    0 5px 0 rgba(0,0,0,.28);
  position: relative;
  overflow: hidden;
}

.shots-taken::after,
.quiet-score::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 7px;
  pointer-events: none;
}

.shots-taken strong {
  display: block;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(3.6rem, 8.8vw, 5.2rem);
  line-height: .82;
  color: color-mix(in srgb, var(--yellow) 84%, white 10%);
  -webkit-text-stroke: 1px rgba(0,0,0,.25);
  text-shadow: 0 4px 0 rgba(0,0,0,.30);
}

.shots-taken span {
  margin-top: 5px;
  color: rgba(235,255,250,.86);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.quiet-score {
  min-height: 126px;
  display: grid;
  align-content: center;
  gap: 13px;
  padding: 18px;
  border: 2px solid rgba(0,0,0,.34);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.18)),
    rgba(18,25,30,.70);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.12),
    0 5px 0 rgba(0,0,0,.26);
  position: relative;
  overflow: hidden;
}

.par-chip {
  width: max-content;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 15px;
  border: 2px solid rgba(0,0,0,.30);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.11), rgba(0,0,0,.16)),
    rgba(0,0,0,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 2px 0 rgba(0,0,0,.22);
  color: rgba(235,255,250,.90);
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: 1.55rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-shadow: 0 3px 0 rgba(0,0,0,.24);
}

.par-chip .flag {
  color: var(--result);
  font-size: 1.15rem;
  text-shadow: none;
}

.stars {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--yellow);
  font-size: clamp(2rem, 5.5vw, 2.7rem);
  line-height: 1;
  letter-spacing: .02em;
  text-shadow: 0 3px 0 rgba(0,0,0,.30), 0 0 17px rgba(229,184,63,.24);
}

.stars .empty {
  color: rgba(8,12,17,.52);
  -webkit-text-stroke: 1px rgba(243,240,223,.18);
  text-shadow: 0 2px 0 rgba(0,0,0,.26);
}

.fail-note {
  min-height: 84px;
  display: grid;
  align-content: center;
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 2px solid rgba(0,0,0,.34);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.18)),
    rgba(18,25,30,.70);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 5px 0 rgba(0,0,0,.26);
  color: rgba(235,255,250,.88);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: .92rem;
  font-weight: 900;
  letter-spacing: .09em;
  line-height: 1.35;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0,0,0,.34);
}

.overlay-actions {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(170px, 1.35fr);
  gap: 12px;
  align-items: stretch;
}

.overlay-actions.is-retry-primary {
  grid-template-columns: 1fr minmax(190px, 1.45fr);
}

.result-button {
  min-height: 60px;
  border: 2px solid rgba(247, 208, 70, 0.35);
  border-radius: 10px;
  padding: 0 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(40, 54, 73, 0.96), rgba(17, 25, 36, 0.96));
  color: #edf2f4;
  font: inherit;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .03em;
  cursor: pointer;
  box-shadow:
    0 5px 0 rgba(0,0,0,.45),
    inset 0 2px 0 rgba(255,255,255,.18);
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease, filter .14s ease;
}

.result-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.result-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0,0,0,.45), inset 0 2px 0 rgba(0,0,0,.14);
}

.button-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  font-size: 1.05rem;
  line-height: 1;
}

.result-button-primary {
  border-color: rgba(255, 232, 118, .85);
  background:
    linear-gradient(180deg, rgba(255,255,255,.22), transparent 28%),
    linear-gradient(180deg, #f5cf54, #e5b83f 58%, #b78323);
  color: #15191b;
  text-shadow: 0 1px 0 rgba(255,255,255,.22);
  box-shadow:
    0 6px 0 rgba(58, 42, 12, .86),
    0 0 0 4px rgba(229,184,63,.16),
    inset 0 2px 0 rgba(255,255,255,.32),
    inset 0 -8px 0 rgba(0,0,0,.12);
}

.result-button-primary:hover,
.result-button-primary:focus-visible {
  border-color: rgba(255, 232, 118, .95);
  background:
    linear-gradient(180deg, rgba(255,255,255,.28), transparent 28%),
    linear-gradient(180deg, #ffe06b, #eec448 58%, #bd8427);
  color: #15191b;
  filter: brightness(1.04);
}

.result-button-primary:active {
  background:
    linear-gradient(180deg, rgba(255,255,255,.16), transparent 24%),
    linear-gradient(180deg, #dfad35, #d09c2c 62%, #916018);
  color: #15191b;
  box-shadow:
    0 2px 0 rgba(58, 42, 12, .86),
    0 0 0 4px rgba(229,184,63,.16),
    inset 0 2px 0 rgba(0,0,0,.12),
    inset 0 -4px 0 rgba(0,0,0,.12);
}

.result-button-primary .button-icon {
  background: rgba(0,0,0,.18);
  color: #fff6ca;
  text-shadow: none;
}

.result-button-retry.is-suggested {
  border-color: color-mix(in srgb, var(--result) 70%, white 10%);
  box-shadow:
    0 5px 0 rgba(0,0,0,.45),
    0 0 0 4px var(--result-soft),
    inset 0 2px 0 rgba(255,255,255,.18);
}

.overlay-actions .is-hidden,
.result-summary.is-hidden,
.stars.is-hidden,
.fail-note.is-hidden {
  display: none;
}

@media (max-width: 700px) {
  .overlay-card {
    width: calc(100vw - 28px);
    padding: 16px;
  }

  .result-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .result-title {
    font-size: clamp(2.7rem, 16vw, 4.5rem);
  }

  .result-badge {
    width: max-content;
    min-width: 76px;
  }

  .result-summary {
    grid-template-columns: 1fr;
  }

  .shots-taken,
  .quiet-score {
    min-height: 94px;
  }

  .overlay-actions,
  .overlay-actions.is-retry-primary {
    grid-template-columns: 1fr;
  }

  .result-button-primary {
    order: -1;
  }
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.hud h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.1;
  pointer-events: none;
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  text-transform: uppercase;
  letter-spacing: .045em;
  display: flex;
  align-items: baseline;
  gap: 2px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
}

.hud-top {
  color: var(--yellow);
}

.hud-bottom {
  color: #dedad0;
}

.hud p {
  margin: 0.35rem 0 0;
  color: rgba(210,245,246,.88);
  pointer-events: none;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.scoreboard {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin: 0.2rem 0;
  background: rgba(237, 242, 244, 0.08);
  border: 1px solid rgba(237, 242, 244, 0.12);
  border-radius: 8px;
  padding: 2px 12px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.scoreboard-shot {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--yellow);
  min-width: 1.2ch;
  text-align: center;
  letter-spacing: .06em;
}

.scoreboard-sep {
  color: rgba(210,245,246,.88);
  font-weight: 400;
  margin: 0 1px;
}

.scoreboard-par {
  font-size: 0.85rem;
  font-weight: 900;
  color: rgba(235,255,250,.85);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.hud-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  pointer-events: auto;
}

.hud-actions button,
.minimap-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 18px;
  border: 2px solid rgba(229, 184, 63, 0.38);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.12)),
    repeating-linear-gradient(0deg, rgba(0,0,0,.10) 0 2px, transparent 2px 12px),
    linear-gradient(180deg, rgba(40, 54, 64, 0.94), rgba(16, 24, 32, 0.96));
  color: #edf2f4;
  font-weight: 900;
  letter-spacing: .01em;
  text-shadow: 0 2px 0 rgba(0,0,0,.28);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.15),
    inset 0 -5px 0 rgba(0,0,0,.14),
    0 5px 0 rgba(0,0,0,.42),
    0 12px 26px rgba(0,0,0,.28);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.hud-actions button::before {
  content: attr(data-icon);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: rgba(237,242,244,.94);
  background: rgba(255,255,255,.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  font-size: 1.05rem;
  line-height: 1;
}

.hud-actions button:hover,
.minimap-toggle:hover {
  border-color: rgba(229, 184, 63, 0.72);
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.hud-actions button:active,
.minimap-toggle:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px 0 rgba(0,0,0,.12),
    inset 0 -3px 0 rgba(0,0,0,.12),
    0 2px 0 rgba(0,0,0,.42),
    0 8px 18px rgba(0,0,0,.24);
}

#muteButton {
  position: relative;
}

#peekGoalButton.is-active {
  border-color: rgba(78, 205, 196, 0.72);
  color: #7ee7dd;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.16),
    inset 0 -5px 0 rgba(0,0,0,.14),
    0 0 0 3px rgba(78, 205, 196, 0.16),
    0 5px 0 rgba(0,0,0,.42),
    0 12px 26px rgba(0, 0, 0, 0.24);
}

#muteButton.is-muted::after {
  content: "";
  position: absolute;
  left: 31px;
  top: 50%;
  width: 1.45rem;
  height: 3px;
  border-radius: 999px;
  background: #e63946;
  box-shadow: 0 0 0 1px rgba(17, 21, 28, 0.75);
  transform: translate(-50%, -50%) rotate(-42deg);
}

#gameCanvas {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid rgba(237, 242, 244, 0.18);
  border-radius: 8px;
  background: transparent !important;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
  touch-action: none;
  user-select: none;
  cursor: grab;
}

#gameCanvas.is-peeking-camera {
  cursor: grabbing;
}

.portrait-hint {
  display: none;
}

.minimap-toggle {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 4;
  display: none;
  min-width: 44px;
}

.minimap-toggle::before {
  content: attr(data-icon);
  font-size: 1.05rem;
  line-height: 1;
}

@media (max-width: 780px) {
  .mockup {
    width: min(100vw - 16px, 960px);
    margin-top: 14px;
  }

  .brand {
    margin-bottom: 14px;
    padding-inline: 14px;
  }

  .brand::after {
    right: 54px;
    top: 48px;
    width: 42px;
    height: 42px;
  }

  .course-card {
    grid-template-columns: 104px 1fr;
    min-height: 96px;
  }

  .stamp-zone {
    grid-column: 2;
    justify-content: start;
    place-items: start;
    padding: 0 0 12px 22px;
    margin-top: -10px;
  }

  .cleared-stamp {
    font-size: 1.25rem;
    padding: 5px 10px;
  }

  .course-card.locked .stamp-zone {
    display: none;
  }

  .course-number b { font-size: 3.1rem; }
  .course-number small { font-size: .96rem; }
  .course-name { font-size: clamp(1.65rem, 7.4vw, 2.65rem); }

  .course-body { padding: 12px 14px 10px 18px; }

  .course-meta {
    gap: 10px;
    margin-top: 8px;
  }

  .course-meta strong {
    font-size: .82rem;
  }

  .course-meta span {
    font-size: 1.08rem;
  }

  .course-stars {
    font-size: .82rem !important;
    min-height: 24px;
    padding: 0 8px;
  }

  .status-badge {
    min-height: 32px;
    padding: 0 12px;
    font-size: .92rem !important;
  }

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

  .level-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 470px) {
  .course-card {
    grid-template-columns: 78px 1fr;
    min-height: 88px;
  }

  .course-number b { font-size: 2.4rem; }
  .course-number small { font-size: .78rem; }
  .course-meta { gap: 9px; }
  .material-icon { display: none; }

  .course-body {
    padding: 10px 12px 9px 14px;
  }

  .level-title-card {
    min-height: 84px;
    padding: 12px 16px;
  }

  .level-title-card h2 {
    font-size: clamp(2rem, 11vw, 3.1rem);
  }

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

  .level-tile {
    min-height: 104px;
    padding: 12px 12px 10px;
  }

  .level-number {
    font-size: 3rem;
  }

  .level-name {
    margin-top: 4px;
  }

  .level-stars {
    margin-top: 4px;
    min-height: 24px;
    padding: 0 8px;
    font-size: .9rem;
  }

  .level-medal {
    font-size: .62rem;
    min-height: 22px;
    padding-inline: 7px;
  }
}

@media (max-width: 720px) {
  .game-shell {
    width: 100%;
    padding: 8px;
    gap: 0;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  #gameCanvas {
    width: 100%;
    height: 100%;
    aspect-ratio: unset;
    border-radius: 6px;
    box-shadow: none;
  }

  .hud {
    position: absolute;
    top: max(8px, env(safe-area-inset-top));
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    z-index: 5;
    align-items: flex-start;
    justify-content: space-between;
    flex-direction: row;
    gap: 8px;
  }

  .hud h1 {
    font-size: 1rem;
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  }

  .scoreboard {
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 7px;
    background: rgba(17, 21, 28, 0.72);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .scoreboard-shot {
    font-size: 1.05rem;
  }

  .scoreboard-par {
    font-size: 0.75rem;
  }

  .hud-status {
    position: fixed;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 6;
    width: auto;
    max-width: 520px;
    margin: 0 auto;
    padding: 9px 12px;
    border: 1px solid rgba(237, 242, 244, 0.16);
    border-radius: 8px;
    background: rgba(17, 21, 28, 0.78);
    color: #edf2f4;
    font-size: 0.82rem;
    line-height: 1.35;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .hud-status.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  .hud-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .hud-actions button {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 10px;
    border-color: rgba(229, 184, 63, 0.42);
    background:
      linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.12)),
      repeating-linear-gradient(0deg, rgba(0,0,0,.10) 0 2px, transparent 2px 10px),
      linear-gradient(180deg, rgba(40, 54, 64, 0.92), rgba(16, 24, 32, 0.94));
    color: #edf2f4;
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.14),
      inset 0 -4px 0 rgba(0,0,0,.16),
      0 4px 0 rgba(0,0,0,.42),
      0 10px 22px rgba(0, 0, 0, 0.24);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 0;
  }

  .hud-actions button::before {
    width: 26px;
    height: 26px;
    background: transparent;
    box-shadow: none;
    font-size: 1.25rem;
    line-height: 1;
  }

  #muteButton.is-muted::after {
    left: 50%;
    width: 1.35rem;
  }

  .hud-actions button span,
  .minimap-toggle span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .minimap-toggle {
    display: inline-flex;
    left: max(10px, env(safe-area-inset-left));
    top: calc(max(8px, env(safe-area-inset-top)) + 62px);
    min-width: 44px;
    width: 44px;
    min-height: 44px;
    padding: 0;
    font-size: 0;
  }

  .minimap-toggle.is-collapsed {
    background: rgba(17, 21, 28, 0.78);
    color: #edf2f4;
  }

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

@media (max-width: 720px) and (orientation: portrait) {
  .minimap-toggle {
    display: none;
  }

  .portrait-hint {
    position: absolute;
    top: calc(100% + 12px);
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    z-index: 4;
    display: block;
    margin: 0;
    color: rgba(237, 242, 244, 0.82);
    font-size: 0.86rem;
    font-weight: 650;
    line-height: 1.3;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .game-shell {
    width: 100%;
    max-width: none;
    padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
    gap: 0;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  #gameCanvas {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    box-shadow: none;
  }

  .hud {
    position: absolute;
    inset: 0;
    z-index: 5;
    flex-direction: row;
    align-items: flex-start;
  }

  .hud-info {
    position: absolute;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;
    padding: 5px 8px;
    border: 1px solid rgba(237, 242, 244, 0.14);
    border-radius: 8px;
    background: rgba(17, 21, 28, 0.68);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .hud h1 {
    font-size: 0.95rem;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  }

  .scoreboard {
    margin: 0;
    padding: 2px 8px;
    background: rgba(237, 242, 244, 0.08);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .scoreboard-shot {
    font-size: 1.05rem;
  }

  .scoreboard-par {
    font-size: 0.75rem;
  }

  .hud-status {
    position: static;
    flex: 1;
    min-width: 0;
    width: auto;
    max-width: none;
    margin: 0 0 0 4px;
    padding: 0 0 0 10px;
    border: 0;
    border-left: 1px solid rgba(237, 242, 244, 0.16);
    border-radius: 0;
    background: transparent;
    color: #edf2f4;
    font-size: 0.76rem;
    line-height: 1.25;
    text-align: left;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    opacity: 0;
    transform: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .hud-status.is-visible {
    opacity: 1;
    transform: none;
  }

  @media (max-width: 820px) {
    .hud-info {
      flex-wrap: wrap;
      row-gap: 4px;
    }

    .hud-status {
      flex-basis: 100%;
      margin-left: 0;
      padding-left: 0;
      border-left: 0;
    }
  }

  .hud-actions {
    position: absolute;
    top: max(6px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    flex-wrap: nowrap;
    gap: 6px;
  }

  .hud-actions button {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 10px;
    border-color: rgba(229, 184, 63, 0.42);
    background:
      linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.12)),
      repeating-linear-gradient(0deg, rgba(0,0,0,.10) 0 2px, transparent 2px 10px),
      linear-gradient(180deg, rgba(40, 54, 64, 0.92), rgba(16, 24, 32, 0.94));
    color: #edf2f4;
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.14),
      inset 0 -4px 0 rgba(0,0,0,.16),
      0 4px 0 rgba(0,0,0,.42),
      0 10px 22px rgba(0, 0, 0, 0.24);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 0;
  }

  .hud-actions button::before {
    width: 26px;
    height: 26px;
    background: transparent;
    box-shadow: none;
    font-size: 1.25rem;
    line-height: 1;
  }

  .hud-actions button span,
  .minimap-toggle span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .minimap-toggle {
    display: none;
    left: max(10px, env(safe-area-inset-left));
    top: calc(max(6px, env(safe-area-inset-top)) + 60px);
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    font-size: 0;
  }

  .overlay-card {
    width: min(560px, calc(100vw - 72px));
    max-height: calc(100dvh - 28px);
    padding: 14px;
    overflow: auto;
  }

  .overlay-card::before {
    inset: 7px;
  }

  .result-header {
    gap: 10px;
    margin-bottom: 10px;
  }

  .result-kicker {
    margin-bottom: 2px;
    font-size: 0.58rem;
  }

  .result-title {
    font-size: clamp(2.45rem, 10.5vh, 3.35rem);
    letter-spacing: 0.035em;
    line-height: 0.9;
    white-space: nowrap;
  }

  .result-badge {
    min-width: 66px;
    min-height: 50px;
    padding: 6px 8px;
    border-radius: 9px;
  }

  .result-badge b {
    font-size: 1.65rem;
  }

  .result-badge span {
    font-size: 0.5rem;
  }

  .result-summary {
    gap: 10px;
    margin-bottom: 12px;
  }

  .shots-taken,
  .quiet-score {
    min-height: 82px;
    border-radius: 9px;
  }

  .shots-taken strong {
    font-size: clamp(2.55rem, 10.5vh, 3.35rem);
  }

  .shots-taken span {
    font-size: 0.58rem;
  }

  .quiet-score {
    gap: 8px;
    padding: 12px;
  }

  .par-chip {
    min-height: 34px;
    padding: 0 12px;
    font-size: 1.2rem;
  }

  .stars {
    gap: 7px;
    font-size: clamp(1.55rem, 7vh, 2rem);
  }

  .overlay-actions {
    gap: 10px;
  }

  .result-button {
    min-height: 48px;
    padding: 0 12px;
  }

  .button-icon {
    width: 26px;
    height: 26px;
  }
}
