/* The lobby mark and white masthead frame the game's own workshop. */
.gc-rail {
  position:relative; z-index:1; flex:none; color:#1d1d1f; background:#fff;
  padding:env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  border-bottom:1px solid #e8e8ed;
  font:500 14px/1.3 "Pretendard Variable",-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo",system-ui,sans-serif;
}
.gc-rail [hidden] { display:none!important; }
.gc-rail-inner {
  width:min(1024px,calc(100% - 44px)); min-height:74px; margin-inline:auto;
  display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:16px;
}
.gc-rail-brand {
  display:inline-flex; align-items:center; gap:11px; color:inherit; text-decoration:none;
  min-height:44px; font-size:21px; font-weight:730; letter-spacing:-.015em; white-space:nowrap;
}
.gc-rail-mark {
  width:35px; height:35px; flex:none; display:grid; place-items:center; color:#fff; border-radius:10px;
  background:linear-gradient(155deg,#454548,#1d1d1f); box-shadow:inset 0 1px 1px #fff3;
}
.gc-rail-mark .gc-icon { width:24px; height:24px; }
.gc-rail-game {
  grid-column:2; display:flex; align-items:center; gap:8px; min-width:0;
  padding-inline-start:16px; border-inline-start:1px solid #e8e8ed;
}
.gc-rail-title { min-width:0; margin:0; color:#3d3d43; font-size:var(--gc-fs-16,16px); font-weight:740; line-height:1.22; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.gc-rail-game-actions,.gc-rail-global { display:flex; align-items:center; gap:6px; }
.gc-rail-game-actions { flex:none; }
.gc-rail-global { grid-column:3; justify-content:flex-end; }
.gc-rail .gc-rail-button,.gc-rail-coins {
  display:inline-flex; align-items:center; justify-content:center; gap:6px; min-width:44px; min-height:44px;
  padding:0 11px; border:1px solid #e8e8ed; border-radius:999px; box-shadow:none;
  background:#fff; color:#303039; font:inherit; font-weight:700; cursor:pointer; touch-action:manipulation;
}
.gc-rail .gc-rail-button:not(:disabled):hover,.gc-profile-chip:hover { background:#f5f5f7; }
.gc-rail .gc-rail-button { width:44px; padding:0; }
.gc-rail .gc-rail-button:disabled { color:#767681; background:#f7f7f8; cursor:default; }
.gc-rail-button .gc-icon,.gc-profile-chip .gc-icon { width:20px; height:20px; }
.gc-rail-coins {
  flex:none; padding:0 12px; border-color:#e2cf9a; background:#fff8e2; color:#5d4710;
  font:700 14px/1.3 "Pretendard Variable",-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo",system-ui,sans-serif;
  font-variant-numeric:tabular-nums; white-space:nowrap;
}
.gc-rail-coins[hidden] { display:none; }
.gc-rail-coins:hover { background:#fff0c1; }
.gc-rail-coins .gc-icon { width:21px; height:21px; }
.gc-profile-chip {
  box-sizing:border-box; display:grid; place-items:center; flex:none; width:44px; height:44px;
  padding:0; border:1px solid #e8e8ed; border-radius:50%; background:#fff; color:#303039;
  cursor:pointer; touch-action:manipulation;
}
.gc-profile-chip[hidden] { display:none; }
.gc-profile-chip:focus-visible { outline:2px solid #786ac4; outline-offset:3px; }
.gc-profile-chip img { width:32px; height:32px; border-radius:50%; object-fit:cover; }
.gc-rail-compact { display:none; }
@media(max-width:480px){
  .gc-rail-amount { display:none; }
  .gc-rail-compact { display:block; }
}
.gc-help-copy { white-space:pre-line; }
@media(max-width:700px){
  .gc-rail-inner { width:calc(100% - 32px); min-height:59px; grid-template-columns:minmax(0,1fr) auto; grid-template-rows:minmax(59px,auto) auto; gap:0 6px; }
  .gc-rail-brand { font-size:19px; gap:9px; }
  .gc-rail-mark { width:30px; height:30px; border-radius:9px; }
  .gc-rail-mark .gc-icon { width:21px; height:21px; }
  .gc-rail-global { grid-column:2; grid-row:1; gap:4px; }
  .gc-rail-coins { padding:0 7px; gap:4px; }
  .gc-rail-game { grid-column:1/-1; grid-row:2; justify-content:space-between; min-height:45px; padding:0; border:0; border-top:1px solid #ededf0; }
  .gc-rail-game-actions .gc-rail-button { border-color:transparent; }
}
@media(max-width:359px){
  .gc-rail-inner { width:calc(100% - 16px); }
  .gc-rail-brand { gap:6px; font-size:17px; }
}
.gc-sheet {
  --gc-play-accent:#2c2b60; --gc-play-paper:#fbf8f0; --gc-play-ink:#201f2e;
  box-sizing:border-box; position:fixed; inset:calc(env(safe-area-inset-top) + 84px) max(14px,env(safe-area-inset-right)) auto auto; margin:0;
  width:min(420px,calc(100vw - 28px)); max-height:calc(var(--app-h,100dvh) - 80px - env(safe-area-inset-top)); overflow:auto; overscroll-behavior:contain;
  color:var(--gc-play-ink); background:linear-gradient(132deg,#fff,var(--gc-play-paper));
  border:1px solid #d3c9b8;border-radius:var(--gc-play-radius,19px);padding:18px;
  box-shadow:0 0 0 4px #ffffffb0 inset,0 0 0 5px #d9cbb248 inset,0 16px 48px #17172536;
  font:var(--gc-fs-16,16px)/var(--gc-body-leading,1.5) var(--gc-play-font,var(--gc-font,system-ui));
  scrollbar-width:thin;
}
.gc-sheet[open] { animation:gc-sheet-in calc(.22s * var(--gc-motion-scale,1)) cubic-bezier(.22,.75,.28,1) }
.gc-sheet::backdrop { background:linear-gradient(120deg,#171e2a38,#1618285c) }
@keyframes gc-sheet-in { from{opacity:0;translate:0 -6px} to{opacity:1;translate:0 0} }
.settings-head,.ledger-head { display:flex; align-items:center; gap:10px; padding-bottom:14px; }
.settings-head h2,.ledger-head h2 { margin:0; font-size:var(--gc-fs-28,28px); line-height:1.18; letter-spacing:-.04em }
.settings-head form,.ledger-head form { margin-left:auto; }
.gc-heading-plaque {
  flex:none; display:grid; place-items:center; height:44px; width:44px; border:1px solid #cfc4ac; border-radius:11px;
  background:linear-gradient(#fff,#eee5d3); color:var(--gc-play-accent); box-shadow:0 1px 0 #fff inset,0 2px 3px #57412916;
}
.gc-heading-plaque .gc-icon { width:22px; height:22px }
.gc-sheet .gc-close {
  min-width:44px; min-height:44px;
  display:grid; place-items:center; padding:0; border:1px solid #ddd4c9; border-radius:12px;
  color:inherit; background:linear-gradient(#fff,#f4eee3); box-shadow:0 1px 0 #fff inset,0 2px 0 #e9dfd0; cursor:pointer; touch-action:manipulation;
}
.gc-close .gc-icon { width:19px;height:19px }
.gc-inlaid {
  display:grid; border:1px solid #d9cebd; border-radius:13px; padding:0 12px;
  background:linear-gradient(145deg,#fffdf7,#f7f2e8); box-shadow:0 1px 4px #5b463310 inset,0 1px 0 #fff;
}
.settings-row { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:48px; padding:2px 0; }
.settings-row+.settings-row { border-top:1px solid #e3dbcf; }
.gc-row-label { min-width:0; display:flex; align-items:center; gap:8px; font-weight:720; letter-spacing:-.02em }
.gc-row-label .gc-icon { width:20px;height:20px;color:var(--gc-play-accent); }
label.settings-row { cursor:pointer }
.gc-switch { position:relative; display:grid; place-items:center; flex:none; width:55px; min-height:44px; }
.gc-switch input,.gc-motion-options input { position:absolute; width:1px;height:1px;margin:0;opacity:0;clip-path:inset(50%); }
.gc-switch-track { position:relative; display:block; width:50px; height:28px; border:1px solid #bcb5ab; border-radius:18px; background:#e0d9cd; box-shadow:0 2px 3px #55473824 inset; }
.gc-switch-track::after { content:""; position:absolute; inset:3px auto auto 3px; width:20px; height:20px; border-radius:50%; border:1px solid #fff; background:linear-gradient(#fff,#f5ecdb); box-shadow:0 2px 3px #2b263753; transition:transform calc(.22s * var(--gc-motion-scale,1)) cubic-bezier(.22,.8,.26,1.3); }
.gc-switch input:checked+.gc-switch-track { background:linear-gradient(color-mix(in srgb,var(--gc-play-accent),#fff 15%),var(--gc-play-accent)); border-color:var(--gc-play-accent); }
.gc-switch input:checked+.gc-switch-track::after { transform:translateX(22px); }
.settings-row.v-volume { display:grid; grid-template-columns:minmax(max-content,1fr) minmax(64px,2.25fr) 3em; }
.gc-wave { position:relative; display:grid; align-items:center; min-width:0; height:44px; --gc-level:80%; }
.gc-wave-art { width:100%; height:23px; color:var(--gc-play-accent); opacity:.76; mask-image:linear-gradient(to right,#000 0 var(--gc-level),#0004 var(--gc-level) 100%); }
.gc-wave input { position:absolute; inset:0; margin:0; width:100%;height:100%;appearance:none; background:none; cursor:ew-resize; touch-action:pan-y; }
.gc-wave input::-webkit-slider-thumb { appearance:none; width:19px; height:25px; border:1px solid #8e7251; border-radius:6px; background:linear-gradient(100deg,#eee0bd,#fff9de,#d5ba7e); box-shadow:0 1px 3px #36274765; }
.gc-wave input::-moz-range-thumb { width:19px;height:25px; border:1px solid #8e7251; border-radius:6px; background:linear-gradient(100deg,#eee0bd,#fff9de,#d5ba7e); }
.settings-sheet[data-muted] .gc-wave-art { opacity:.34; }
.gc-wave[data-preview] .gc-wave-art { animation:gc-wave-pulse calc(.25s * var(--gc-motion-scale,1)) ease-out; }
@keyframes gc-wave-pulse { from {transform:scaleY(1.19)} to {transform:scaleY(1)} }
#gc-volume-out { text-align:right; color:#514661; font-variant-numeric:tabular-nums; font-weight:750; font-size:var(--gc-fs-14,14px); }
.gc-motion { min-width:0; border:0; padding:12px 0 0; margin:0; }
.gc-motion legend { float:left; display:block; width:100%; margin-bottom:8px; padding:0; }
.gc-motion-options { clear:both; display:grid; grid-template-columns:repeat(3,1fr); gap:3px; padding:3px; background:#efe8dc; border:1px solid #d9cebd; border-radius:12px; }
.gc-motion-options label { position:relative; cursor:pointer; }
.gc-motion-options span { display:grid;place-items:center;min-height:44px;padding:3px 1px;border-radius:8px;text-align:center;color:#554947;font:700 var(--gc-fs-14,14px)/1.2 var(--gc-play-font,var(--gc-font,system-ui)); }
.gc-motion-options input:checked+span { background:var(--gc-play-accent); color:#fff; box-shadow:0 1px 0 #ffffff31 inset,0 2px 2px #2f254344; }
.gc-rail :focus-visible,.gc-sheet .gc-close:focus-visible,.gc-wave input:focus-visible,.gc-sheet input:focus-visible+span { outline:2px solid #786ac4;outline-offset:3px; }
.settings-row:has(#gc-haptics:checked):active .gc-vibrate { animation:gc-vibrate calc(.26s * var(--gc-motion-scale,1)) ease-out; }
@keyframes gc-vibrate { 30%{rotate:-13deg} 60%{rotate:12deg} 80%{rotate:-5deg} }
.ledger { --gc-play-accent:#513724; --gc-play-paper:#faf3e2; width:min(438px,calc(100vw - 28px)); }
.ledger-ticket { position:relative; margin:0 0 12px; padding:12px 16px; border-block:1px dashed #b99c6b; min-height:100px; display:flex;align-items:center; gap:16px; background:repeating-linear-gradient(0deg,#faf3df 0 15px,#e8d8b83d 15px 16px); }
.ledger-ticket::before,.ledger-ticket::after { content:"";position:absolute;left:-2px; width:7px;height:7px;border:1px solid #b89d75;border-radius:50%;background:#fffafa; }
.ledger-ticket::before{top:-4px}.ledger-ticket::after{bottom:-4px}
.gc-coin-mint { position:relative; display:grid; place-items:center; flex:none; width:72px; aspect-ratio:1; filter:drop-shadow(0 5px 3px #5b391b39); }
.gc-coin-mint .gc-icon,.gc-coin-mint canvas { width:100%; height:100%; }
.gc-coin-mint canvas { position:absolute; inset:0 }
.gc-coin-mint[data-webgl] > .gc-icon { visibility:hidden; }
.ledger-ticket small { color:#6c5335; font-weight:700; }
#ledgerTotal { margin:1px 0 0; color:#382919; font-size:var(--gc-fs-28,28px); line-height:1.18; letter-spacing:-.045em; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.ledger .note { margin:4px 0 14px;color:#645b53;font-size:var(--gc-fs-14,14px); }
.ledger ol { list-style:none; margin:0; padding:0; }
.ledger li { display:flex; justify-content:space-between; align-items:baseline; gap:8px; padding:9px 0; border-top:1px solid #e0d5c1; font-size:var(--gc-fs-14,14px); font-variant-numeric:tabular-nums; }
.ledger li b { flex:none; }
.ledger li .plus{color:#305d49}.ledger li .minus{color:#a44231}
.gc-earn { position:fixed; z-index:4; top:calc(env(safe-area-inset-top) + 84px); right:max(14px,env(safe-area-inset-right)); display:flex; align-items:center; gap:7px; padding:5px 13px 5px 7px; border:1px solid #c29e60; border-radius:18px; background:#fff4d9; color:#63401f; box-shadow:0 2px 0 #dcb477,0 5px 14px #5841274c; pointer-events:none; font:800 16px/1.1 var(--gc-font,system-ui); font-variant-numeric:tabular-nums; }
.gc-earn .gc-coin-mint { width:44px; }
.gc-earn[data-active] { animation:gc-earn-in .32s cubic-bezier(.19,.8,.26,1.23); }
.gc-earn i { position:absolute; top:50%; left:28px; width:6px; height:6px; border-radius:2px; background:#e9c077; animation:gc-mote .68s var(--gc-delay) ease-out both; }
.gc-earn i:nth-of-type(3n) { background:#6a678f; width:4px; height:4px; }
@keyframes gc-mote { 0%{transform:scale(.4);opacity:0} 20%{opacity:1} 100%{transform:translate(var(--gc-x),var(--gc-y)) rotate(var(--gc-turn)) scale(.7);opacity:0} }
@keyframes gc-earn-in { from{opacity:0;transform:translateY(-8px) scale(.93)} to{opacity:1;transform:none} }
@media(max-width:540px) {
  .gc-earn { top:calc(env(safe-area-inset-top) + 114px); }
  .gc-sheet { inset:auto 0 0; width:100%; max-width:100%; max-height:calc(var(--app-h,100dvh) - 60px); border-radius:var(--gc-play-radius,20px) var(--gc-play-radius,20px) 0 0; padding:12px 18px max(18px,env(safe-area-inset-bottom)); }
  .gc-sheet::before { content:"";display:block;width:40px;height:4px;margin:0 auto 12px;border-radius:3px;background:#a89f91; }
}
@media(prefers-reduced-motion:reduce) { :root[data-gc-motion="system"] .gc-earn { animation:none; } }
:root[data-gc-motion="on"] .gc-earn,
:root[data-gc-motion="on"] .gc-earn i { animation:none }

/* Active games own the viewport. The existing rail supplies the two accessible controls. */
:root {
  --gc-safe-top:env(safe-area-inset-top,0px); --gc-safe-right:env(safe-area-inset-right,0px);
  --gc-safe-bottom:env(safe-area-inset-bottom,0px); --gc-safe-left:env(safe-area-inset-left,0px);
}
html[data-gc-immersive]:has(#stage) { overflow:hidden; overscroll-behavior:none; }
html[data-gc-immersive] body:has(#stage) { height:100dvh; }
html[data-gc-immersive] #stage { margin:0; }
html[data-gc-immersive] #gc-masthead {
  position:fixed; z-index:3; inset:calc(var(--gc-safe-top) + 4px) calc(var(--gc-safe-right) + 8px) auto auto;
  padding:0; border:0; background:none; pointer-events:none;
}
html[data-gc-immersive] #gc-masthead .gc-rail-inner {
  display:flex; align-items:center; width:auto; min-height:0; margin:0; padding:0; gap:3px;
}
html[data-gc-immersive] #gc-masthead :is(.gc-rail-game,.gc-rail-global,.gc-rail-game-actions) {
  display:flex; width:auto; min-height:0; border:0; margin:0; padding:0; gap:0; background:none;
}
html[data-gc-immersive] #gc-masthead :is(.gc-rail-brand,.gc-rail-title,.gc-profile-chip,#gc-settings-trigger,.gc-rail-amount,.gc-invite-inbox) { display:none; }
html[data-gc-immersive] #gc-masthead .gc-rail-global { order:-1; }
html[data-gc-immersive] #gc-masthead .gc-rail-compact { display:inline; }
html[data-gc-immersive] #gc-masthead :is(button:not([hidden]),.gc-rail-brand) {
  pointer-events:auto; min-height:44px; border:4px solid transparent; background:#18302ac9; background-clip:padding-box;
  border-radius:24px; box-shadow:none; color:#fff9e9; font-size:12px;
}
html[data-gc-immersive] #gc-masthead #coins { padding-inline:5px; gap:3px; }
html[data-gc-immersive] #gc-masthead #coins svg { width:17px; }
html[data-gc-unpausable] #gc-masthead .gc-rail-game { display:none; }
html[data-gc-unpausable] #gc-masthead .gc-rail-brand { display:grid; width:44px; place-items:center; }
html[data-gc-unpausable] #gc-masthead .gc-rail-brand>span:last-child { display:none; }
html[data-gc-unpausable] #gc-masthead .gc-rail-mark { width:24px; height:24px; background:none; box-shadow:none; }

/* Play frame navigation. The standalone app and lobby retain their own rails. */
.game-header .frame-row {display:flex;align-items:center;gap:6px;max-width:1180px;height:51px;margin:auto;padding:0 8px;}
.game-header .gc-rail-brand,.game-header .frame-action {display:grid;place-items:center;width:44px;height:44px;flex:none;padding:0;border:0;background:transparent;box-shadow:none;}
.game-header .gc-rail-brand svg,.game-header .frame-action svg {width:21px;height:21px;}
.game-header .gc-rail-title {flex:1;font-size:17px;}
.game-header .frame-action {font-size:24px;}
.game-header .gc-rail-compact {display:inline;}
.game-header .gc-rail-amount {display:none;}
html[data-gc-immersive] #gc-masthead.game-header .frame-row {width:max-content;height:44px;padding:0;gap:0;border-radius:24px;background:#182c27c9;color:white;}
html[data-gc-immersive] #gc-masthead.game-header :is(#coins,.frame-action) {background:transparent;color:inherit;border:0;border-radius:22px;}
html[data-gc-immersive] #gc-masthead.game-header #coins {padding:0 6px;}
.frame-menu[open] {display:flex;flex-direction:column;gap:0;}
.frame-menu header {display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;}
.frame-menu header h2 {margin:0;font-size:21px;}
.frame-menu > button {display:flex;align-items:center;justify-content:space-between;border:0;border-bottom:1px solid #dfdfdc;background:transparent;box-shadow:none;min-height:48px;border-radius:0;text-align:left;padding:8px 6px;}
.frame-menu > [data-action=resume] {justify-content:center;background:#214c3a;color:white;border-radius:12px;}
.frame-menu[data-play=false] :is([data-action=resume],[data-action=coins],.during-play),.frame-menu[data-play=true] .during-menu {display:none;}
.frame-menu [data-action=home] {color:#983e34;}
