@font-face {
  font-family: 'Moneygraphy';
  src: url('../assets/Moneygraphy-Pixel.ttf') format('truetype');
  font-display: swap;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #10182c; }
body {
  margin: 0;
  color: #fff8e9;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}
#stage { position: relative; width: 100%; height: 100dvh; overflow: hidden; isolation: isolate; transform: translateZ(0); }
#game { display: block; width: 100%; height: 100%; touch-action: none; }
.back-link {
  position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; z-index: 10;
  padding: 7px 12px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  background: rgba(10,20,38,.56); color: rgba(255,255,255,.92); box-shadow: 0 4px 18px rgba(0,0,0,.25);
  backdrop-filter: blur(8px); font-size: 12px; text-decoration: none;
}
#title {
  position: absolute; top: max(17px, env(safe-area-inset-top)); left: 78px; right: 78px; z-index: 3;
  text-align: center; pointer-events: none; text-shadow: 0 2px 12px rgba(0,0,0,.7); transition: opacity .18s ease;
}
#title.faded { opacity: 0; }
.title-name { font-size: 20px; font-weight: 850; letter-spacing: -.045em; }
#title p { margin: 3px 0 0; color: rgba(255,246,220,.82); font-size: 12px; }
#hud {
  position: absolute; top: max(73px, calc(env(safe-area-inset-top) + 57px)); left: 0; right: 0; z-index: 3;
  display: flex; justify-content: center; gap: 36px; pointer-events: none;
  color: #fff; font-family: 'Pretendard Variable', Pretendard, sans-serif; text-shadow: 0 2px 8px rgba(0,0,0,.75);
}
#hud[hidden] { display: none; }
.hud-chip {
  min-width: 72px; text-align: center;
}
.hud-chip span { display: block; color: rgba(255,255,255,.86); font-size: 11px; font-weight: 500; }
.hud-chip strong { display: block; margin-top: 1px; color: #fff; font-size: 20px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
#intro, #result {
  position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 24px;
  background: rgba(4,11,27,.34); backdrop-filter: blur(3px);
}
#intro[hidden], #result[hidden] { display: none; }
.card {
  width: min(100%, 350px); padding: 30px 26px 24px; border: 1px solid rgba(255,248,226,.68); border-radius: 24px;
  background: linear-gradient(150deg,rgba(255,252,241,.98),rgba(248,235,203,.96)); box-shadow: 0 18px 60px rgba(0,0,0,.4);
  color: #263244; text-align: center; animation: card-in .26s cubic-bezier(.2,1.2,.35,1);
}
@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.card-mark { color: #d79230; font-size: 39px; line-height: 1; }
.card-title { margin-top: 12px; font-size: 25px; font-weight: 850; letter-spacing: -.055em; }
.card p { margin: 10px 0 20px; color: #687284; font-size: 14px; line-height: 1.65; }
.card button {
  width: 100%; padding: 13px 18px; border: 0; border-radius: 999px; background: linear-gradient(135deg,#d38c29,#b66120);
  box-shadow: 0 6px 16px rgba(138,74,21,.28); color: #fff9ea; cursor: pointer; font: inherit; font-size: 16px; font-weight: 800;
}
.card button:active { transform: translateY(1px); }
.card small { display: block; margin-top: 11px; color: #8b7a61; font-size: 11px; line-height: 1.4; }
#intro .card {
  width: min(100%, 430px); display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 44px 28px 36px;
  color: #172039; background: rgba(250,252,255,.96); border-color: rgba(255,255,255,.75); border-radius: 25px;
  box-shadow: 0 20px 70px rgba(0,0,0,.45); font-family: 'Moneygraphy', 'Pretendard Variable', Pretendard, sans-serif;
}
#intro { background: rgba(3,7,18,.46); backdrop-filter: blur(5px); }
.intro-title { margin: 0; color: #172039; font-size: clamp(24px, 5vw, 32px); font-weight: 400; line-height: 1.2; letter-spacing: -.02em; }
#intro .card button {
  width: auto; margin-top: 8px; padding: 13px 34px; background: #151c31; color: #fff;
  box-shadow: 0 5px 15px rgba(17,26,50,.22); font-family: inherit; font-size: 17px; font-weight: 400;
}
#result { background: rgba(3,7,18,.30); backdrop-filter: none; }
#result .result-card {
  width: min(100%, 320px); padding: 30px 28px 26px; border: 1px solid rgba(255,255,255,.75); border-radius: 25px;
  background: rgba(250,252,255,.96); box-shadow: 0 20px 70px rgba(0,0,0,.45);
  color: #172039; font-family: 'Moneygraphy', 'Pretendard Variable', Pretendard, sans-serif; text-shadow: none;
}
#result .card-title { margin: 0; color: #172039; font-size: 24px; font-weight: 700; letter-spacing: -.04em; }
#result .card p { margin: 9px 0 18px; color: #6c7488; font-size: 13px; line-height: 1.2; }
#result .card button { width: auto; padding: 11px 26px; background: #151c31; box-shadow: 0 5px 15px rgba(17,26,50,.22); font-family: inherit; font-size: 15px; font-weight: 600; }
.doc-jump {
  position: absolute; right: 13px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 5; padding: 8px 12px;
  border: 1px solid rgba(255,248,226,.3); border-radius: 999px; background: rgba(12,21,39,.65); color: rgba(255,255,255,.92);
  box-shadow: 0 4px 16px rgba(0,0,0,.24); backdrop-filter: blur(8px); font-size: 12px; text-decoration: none;
}
.gdoc .game-return {
  display: inline-flex; margin: 0 0 28px; padding: 10px 15px; border: 1px solid #e1d9c7; border-radius: 999px;
  background: #fffdf7; color: #544838; cursor: pointer; font: inherit; font-size: 14px; font-weight: 700;
}
@media (max-height: 620px) {
  #title { top: 12px; }
  #hud { top: 52px; }
  .card { padding: 22px 24px 21px; }
  #intro .card { gap: 12px; padding: 28px 24px 24px; }
  .card-title { margin-top: 8px; font-size: 23px; }
  .card p { margin: 7px 0 14px; }
}
@media (max-width: 370px) {
  .hud-chip { min-width: 60px; padding-left: 6px; padding-right: 6px; }
  .hud-chip strong { font-size: 15px; }
}
