/* 창업 타이쿤 (/game) 전용 — 클래스는 전부 gm- 접두사. 레이아웃 layouts/game.html.erb 에서만 쓴다.
   게임 팔레트(네이비 + 오렌지 · 민트 · 노랑 · 핑크)는 시안 https://claude.ai/artifact/3MwD99R5YYkvKkrXAZZbdP 기준. */

.gm-body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  background: #0d1628;
  color: #eef2ff;
  font-family: "Do Hyeon", "Pretendard", system-ui, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.gm-root { position: fixed; inset: 0; overflow: hidden; }
.gm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; touch-action: none; }
.gm-pixel { font-family: "Press Start 2P", monospace; }

.gm-logo {
  position: absolute; z-index: 30;
  left: calc(12px + env(safe-area-inset-left)); top: calc(8px + env(safe-area-inset-top));
  padding: 10px 4px;
  font-family: "Poppins", sans-serif; font-weight: 700; font-size: 17px; letter-spacing: -0.02em;
  color: #ff7a2e; text-decoration: none;
}
.gm-logo:hover { color: #ffa060; }

.gm-icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #2b3a67; background: #131f38; color: #dfe6fb; border-radius: 10px; cursor: pointer;
}
.gm-icon-btn[aria-pressed="true"] { color: #6b7aa6; border-style: dashed; }
.gm-red { color: #ff8fa3 !important; }
.gm-mint { color: #3ddc97; }
.gm-yellow { color: #ffd23f; }

/* 위 HUD */
.gm-hud {
  position: absolute; z-index: 10; left: 0; right: 0; top: 0;
  max-width: 560px; margin: 0 auto; box-sizing: border-box;
  padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 8px calc(12px + env(safe-area-inset-left));
  background: linear-gradient(#0b1424 80%, rgba(11, 20, 36, 0));
}
.gm-hud[hidden] { display: none; }
.gm-hud-top { position: relative; height: 44px; display: flex; align-items: center; justify-content: center; }
.gm-date { font-size: 18px; color: #fff; }
.gm-hud-btns { position: absolute; right: 0; top: 0; display: flex; gap: 6px; }
.gm-stats-row { margin-top: 4px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.gm-chip {
  padding: 5px 6px; background: #131f38; border: 1px solid #2b3a67; border-radius: 8px;
  font-size: 13px; color: #8d9cc6; display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.gm-chip b { font-weight: 400; font-size: 16px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-chip b.gm-yellow { color: #ffd23f; }
.gm-chip b.gm-mint { color: #3ddc97; }
.gm-goal { margin-top: 6px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: #8d9cc6; }
.gm-goal-label { white-space: nowrap; }
.gm-bar { flex: 1; height: 10px; background: #0b1424; border: 2px solid #2b3a67; border-radius: 6px; overflow: hidden; }
.gm-bar-fill { height: 100%; width: 0; transition: width .3s linear; }
.gm-bar-xp { background: #3ddc97; }
.gm-speed { display: flex; gap: 4px; }
.gm-speed-btn {
  min-width: 36px; height: 32px; padding: 0 6px; border: 2px solid #2b3a67; background: #131f38; color: #8d9cc6;
  border-radius: 8px; font-family: "Do Hyeon", sans-serif; font-size: 15px; cursor: pointer;
}
.gm-speed-btn[aria-pressed="true"] { border-color: #ff7a2e; color: #fff; background: #3a1d0c; }
.gm-effects { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.gm-effects:empty { display: none; }
.gm-effect { padding: 2px 8px; border-radius: 999px; background: #1d2b4f; color: #ffd23f; font-size: 13px; }
.gm-effect-bad { background: #2a0d14; color: #ff8fa3; }
.gm-log { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.gm-log li { color: #b8c4e6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-log li:first-child { color: #fff; }
.gm-log li[data-tone="good"] { color: #8ff0c4; }
.gm-log li[data-tone="bad"] { color: #ff8fa3; }
.gm-log li:not(:first-child) { display: none; }

.gm-toast {
  position: absolute; z-index: 25; left: 50%; transform: translateX(-50%); top: calc(50% - 40px);
  max-width: min(420px, calc(100% - 32px)); padding: 12px 16px; box-sizing: border-box;
  background: #131f38; border: 2px solid #ffd23f; border-radius: 12px; font-size: 16px; color: #fff; text-align: center;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .35); pointer-events: none;
}
.gm-toast[hidden] { display: none; }
.gm-toast[data-tone="good"] { border-color: #3ddc97; }
.gm-toast[data-tone="bad"] { border-color: #ff4d6d; }

/* 아래 행동 패널 */
.gm-panel {
  position: absolute; z-index: 10; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto; box-sizing: border-box;
  padding: 8px calc(10px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));
  background: #0b1424; border-top: 2px solid #1e2c4d; border-radius: 16px 16px 0 0;
}
.gm-panel[hidden] { display: none; }
.gm-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.gm-tab {
  height: 36px; border: 2px solid #2b3a67; background: #131f38; color: #8d9cc6; border-radius: 10px;
  font-family: "Do Hyeon", sans-serif; font-size: 16px; cursor: pointer;
}
.gm-tab[aria-selected="true"] { border-color: #ff7a2e; color: #fff; background: #3a1d0c; }
.gm-actions { margin-top: 6px; height: min(24dvh, 196px); overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.gm-action {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; box-sizing: border-box; text-align: left;
  background: #131f38; border: 2px solid #2b3a67; border-radius: 12px; color: #eef2ff; font-family: "Do Hyeon", sans-serif; cursor: pointer;
}
.gm-action:active { transform: translateY(2px); }
.gm-action[aria-disabled="true"] { opacity: .5; }
.gm-action-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gm-action-title { font-size: 17px; }
.gm-action-desc { font-size: 13px; color: #9fb0d8; line-height: 1.25; }
.gm-action-cost { flex: none; font-size: 16px; color: #ffd23f; }
.gm-brainline { margin: 6px 0 0; display: flex; align-items: center; gap: 6px; font-size: 13px; color: #6b7aa6; }
.gm-dot { width: 8px; height: 8px; border-radius: 50%; background: #6b7aa6; flex: none; }
.gm-dot.is-jev { background: #3ddc97; }

/* 화면(타이틀 · 이벤트 · 결과) */
.gm-screen { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; box-sizing: border-box; }
.gm-screen[hidden] { display: none; }
.gm-dim-bg { background: rgba(6, 10, 20, .84); }
.gm-center { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: stretch; gap: 12px; text-align: center; }

.gm-title { justify-content: space-between; padding-top: calc(110px + env(safe-area-inset-top)); padding-bottom: calc(40px + env(safe-area-inset-bottom)); background: rgba(13, 22, 40, .55); }
.gm-title-sound { position: absolute; right: calc(12px + env(safe-area-inset-right)); top: calc(8px + env(safe-area-inset-top)); }
.gm-title-head { text-align: center; }
.gm-eyebrow { margin: 0; font-size: 10px; letter-spacing: 2px; color: #7f8fb8; }
.gm-title-h1 {
  margin: 14px 0 0; font-family: "Black Han Sans", sans-serif; font-weight: 400; font-size: 58px; line-height: 1.02; color: #fff;
  text-shadow: 4px 4px 0 #ff6b1a, 8px 8px 0 #1b2a4a;
}
.gm-title-sub { margin: 18px 0 0; font-size: 20px; line-height: 1.4; color: #b8c4e6; }
.gm-title-actions { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.gm-hint { margin: 0; font-size: 16px; color: #8d9cc6; }
.gm-dim { color: #5d6c94; font-size: 14px; }

.gm-btn {
  display: block; width: 100%; min-height: 52px; padding: 12px 0; box-sizing: border-box;
  border: 2px solid #2b3a67; background: #131f38; color: #dfe6fb; border-radius: 12px;
  font-family: "Do Hyeon", sans-serif; font-size: 19px; cursor: pointer; text-decoration: none;
}
.gm-btn-primary { border: none; background: #ff6b1a; color: #fff; font-size: 23px; box-shadow: 0 6px 0 #b8460a; }
.gm-btn-primary:active { transform: translateY(3px); box-shadow: 0 3px 0 #b8460a; }

.gm-event { width: 100%; max-width: 400px; padding: 22px; box-sizing: border-box; background: #111a33; border: 3px solid #ffd23f; border-radius: 18px; box-shadow: 0 8px 0 rgba(0, 0, 0, .4); text-align: center; }
.gm-event-eyebrow { margin: 0; font-size: 10px; letter-spacing: 2px; color: #ffd23f; }
.gm-event-title { margin: 10px 0 0; font-size: 28px; font-weight: 400; color: #fff; }
.gm-event-body { margin: 10px 0 0; font-size: 18px; line-height: 1.4; color: #c3d2f2; }
.gm-choices { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.gm-choice {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; text-align: left; width: 100%;
  background: #131f38; border: 2px solid #34508f; border-radius: 12px; color: #eef2ff; font-family: "Do Hyeon", sans-serif; cursor: pointer;
}
.gm-choice:hover, .gm-choice:focus-visible { outline: none; border-color: #ff7a2e; }
.gm-choice-label { font-size: 19px; }
.gm-choice-hint { font-size: 14px; color: #9fb0d8; }

.gm-result-h2 { margin: 6px 0 0; font-family: "Black Han Sans", sans-serif; font-weight: 400; font-size: 38px; color: #fff; }
.gm-stats { margin: 8px 0 4px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gm-stat { padding: 10px 12px; background: #131f38; border: 2px solid #2b3a67; border-radius: 12px; text-align: left; }
.gm-stat span { display: block; font-size: 14px; color: #7f8fb8; }
.gm-stat b { display: block; margin-top: 4px; font-size: 22px; font-weight: 400; }
.gm-cta {
  display: block; padding: 12px 14px; border: 2px dashed #ff7a2e; border-radius: 12px;
  color: #ffd0b0; text-decoration: none; font-size: 16px;
}
