/* 《夢想家之路》 Dreamer's Road — game page */
.page-game { background: #071322; }
.page-game .topbar { background: rgba(7, 19, 34, .96); border-bottom-color: rgba(255, 255, 255, .06); }
.page-game .to-top { display: none; }
.game {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 400px;
  height: calc(100vh - 72px); height: calc(100svh - 72px); margin-top: 72px;
  background: #0b1d33; color: #f4efe3; font-family: var(--sans);
}
.game-stage { position: relative; overflow: hidden; min-height: 0; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#game-canvas:active { cursor: grabbing; }

/* stats */
.game-hud { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.st {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 5px;
  padding: 6px 10px 8px; border-radius: 12px; background: rgba(7, 19, 34, .78); backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .12); font-size: 12px; line-height: 1; color: #fff;
}
.st-n { color: rgba(255, 255, 255, .7); }
.st b { font-variant-numeric: tabular-nums; font-size: 13px; }
.st i { position: absolute; left: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, #c9a35b, #e2c88f); transition: width .6s var(--ease); }
.st.neg { border-color: rgba(240, 90, 90, .7); }
.st.neg b, .st.neg .st-n { color: #ff8f8f; }
.st.neg i { background: #e05555; }
.st.low { animation: g-blink 1s infinite; }
@keyframes g-blink { 50% { border-color: rgba(255, 200, 80, .9); } }

/* floating numbers */
.game-fx { position: absolute; left: 0; right: 0; top: 64px; height: 0; pointer-events: none; }
.fx {
  position: absolute; top: 0; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 15px; white-space: nowrap;
  background: rgba(7, 19, 34, .85); animation: g-float 2s var(--ease) both;
}
.fx.up { color: #8fe3a8; } .fx.down { color: #ff9b8f; }
@keyframes g-float { 0% { opacity: 0; transform: translateY(20px) scale(.8); } 15% { opacity: 1; transform: translateY(0) scale(1.05); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }

/* building tooltip */
.game-tip {
  position: absolute; max-width: 230px; padding: 10px 12px; border-radius: 12px; pointer-events: none;
  background: rgba(255, 252, 245, .97); color: #14202e; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); font-size: 13px; line-height: 1.45;
}
.game-tip b { display: block; font-size: 14px; margin-bottom: 2px; color: #8d6a28; }

/* side / bottom panel */
.game-panel {
  overflow-y: auto; padding: 26px 24px 30px; background: linear-gradient(180deg, #0f2440, #0b1d33);
  border-left: 1px solid rgba(255, 255, 255, .08); -webkit-overflow-scrolling: touch;
}
.g-chap { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #e2c88f; }
.g-title { margin: 0 0 14px; font-family: var(--serif); font-size: 30px; font-weight: 700; color: #fff; }
.g-big { margin: 4px 0 12px; font-family: var(--serif); font-size: 40px; line-height: 1.05; font-weight: 700; color: #fff; }
.g-text { margin: 0 0 14px; font-size: 15.5px; line-height: 1.7; color: rgba(255, 255, 255, .86); }
.g-text.drama { padding: 14px 16px; border-left: 3px solid #c9a35b; background: rgba(201, 163, 91, .08); border-radius: 0 12px 12px 0; color: #fff; }
.g-text.reply { font-size: 17px; color: #fff; }
.g-text.small { font-size: 13.5px; color: rgba(255, 255, 255, .7); }
.g-note, .g-hint { margin: 0 0 16px; font-size: 13px; color: rgba(255, 255, 255, .6); }
.g-hint { margin-top: 14px; }
.g-ap { margin: 0 0 12px; font-size: 14px; color: rgba(255, 255, 255, .75); }
.g-ap b { color: #e2c88f; font-size: 18px; }
.g-opts { display: grid; gap: 10px; }
.g-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.g-btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
  padding: 12px 18px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .04);
  color: #fff; font: 600 15px/1.3 var(--sans); transition: transform .15s, background .2s, border-color .2s;
}
.g-btn:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .4); }
.g-btn:active { transform: scale(.97); }
.g-btn.gold { background: linear-gradient(135deg, #e2c88f, #c9a35b); color: #0b1d33; border-color: transparent; box-shadow: 0 10px 24px -10px rgba(201, 163, 91, .8); }
.g-btn.opt { justify-content: flex-start; text-align: left; border-radius: 14px; padding: 14px 16px; }
.g-btn.opt::before { content: "›"; color: #e2c88f; font-size: 20px; line-height: 1; margin-right: 4px; }
.g-btn.ghost { padding: 10px 14px; font-size: 14px; border-color: rgba(201, 163, 91, .5); color: #e2c88f; }
.g-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g-card {
  appearance: none; cursor: pointer; position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
  padding: 12px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .05); color: #fff;
  font-family: var(--sans); transition: transform .15s, border-color .2s, background .2s;
}
.g-card:hover { border-color: rgba(201, 163, 91, .7); background: rgba(201, 163, 91, .1); transform: translateY(-2px); }
.g-card.build { border-color: rgba(201, 163, 91, .45); }
.g-card.build::after { content: "🏗️"; position: absolute; right: 10px; top: 10px; font-size: 13px; opacity: .8; }
.g-card[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.g-ico { font-size: 24px; line-height: 1.1; }
.g-card b { font-size: 14.5px; }
.g-card small { font-size: 12px; line-height: 1.4; color: rgba(255, 255, 255, .65); }
.g-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; font-size: 11.5px; font-weight: 600; }
.g-chips span { padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); }
.g-chips .up { color: #8fe3a8; } .g-chips .down { color: #ff9b8f; }
.g-cover { padding-top: 6px; }
.game[data-step="title"] .game-panel, .game[data-step="end"] .game-panel { background: linear-gradient(180deg, #13294a, #0b1d33); }
.game-noscript { padding: 24px; }

@media (max-width: 860px) {
  .game { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; height: calc(100vh - 64px); height: calc(100svh - 64px); margin-top: 64px; }
  .game-panel { max-height: 46svh; padding: 18px 16px 22px; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .1); border-radius: 18px 18px 0 0; margin-top: -14px; position: relative; z-index: 2; box-shadow: 0 -12px 30px -12px rgba(0, 0, 0, .5); }
  .game[data-step="title"] .game-panel { max-height: 60svh; }
  .g-title { font-size: 24px; margin-bottom: 10px; }
  .g-big { font-size: 32px; }
  .g-text { font-size: 15px; margin-bottom: 12px; }
  .game-hud { left: 8px; right: 8px; top: 8px; gap: 4px; }
  .st { padding: 5px 7px 7px; font-size: 11px; gap: 3px; }
  .st-n { display: none; }
  .game-fx { top: 54px; }
}

/* 3D version: minimap, joystick, view button, character picker */
.game-mini { position: absolute; right: 12px; top: 12px; width: 110px; height: 110px; border-radius: 50%; box-shadow: 0 6px 20px -6px rgba(0, 0, 0, .6); pointer-events: none; }
.game-view {
  position: absolute; right: 12px; top: 130px; padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(7, 19, 34, .78); color: #fff; font: 600 12.5px/1 var(--sans); cursor: pointer; backdrop-filter: blur(6px);
}
.game-joy {
  position: absolute; left: 18px; bottom: 22px; width: 118px; height: 118px; border-radius: 50%; touch-action: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .12), rgba(255, 255, 255, .04)); border: 2px solid rgba(255, 255, 255, .35); display: none;
}
.game-joy i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255, 255, 255, .85); box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
.game-help { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; padding: 6px 12px; border-radius: 999px; background: rgba(7, 19, 34, .7); color: rgba(255, 255, 255, .85); font-size: 12px; white-space: nowrap; pointer-events: none; }
.game-help:empty { display: none; }
.game:not(.walking) .game-mini, .game:not(.walking) .game-view, .game:not(.walking) .game-joy { display: none; }
.game-hud { right: 140px; }
@media (pointer: coarse) {
  .game.walking .game-joy { display: block; }
  .game-help { left: auto; right: 12px; transform: none; bottom: 18px; white-space: normal; max-width: 46%; text-align: right; }
}
.g-looks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.g-look {
  appearance: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px 10px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .16); background: radial-gradient(circle at 50% 35%, rgba(226, 200, 143, .22), rgba(255, 255, 255, .03) 70%); color: #fff; font: 600 13px/1.2 var(--sans);
  transition: transform .15s, border-color .2s;
}
.g-look:hover { border-color: #e2c88f; transform: translateY(-2px); }
.g-look img { width: 100%; max-width: 110px; aspect-ratio: 150 / 190; object-fit: contain; }
@media (max-width: 860px) {
  .game-mini { width: 84px; height: 84px; right: 8px; top: 8px; }
  .game-view { top: 98px; right: 8px; padding: 6px 10px; font-size: 11.5px; }
  .game-hud { right: 100px; }
  .game-joy { width: 104px; height: 104px; left: 14px; bottom: 26px; }
  .g-looks { gap: 8px; }
}
.game-talk { background: #13294a; color: #fff; border: 1px solid rgba(226, 200, 143, .6); }
.game-talk b { color: #e2c88f; }
.game-talk span { font-size: 14px; }

/* v4: objective compass, jump button, dialogue, scene fades */
.game-goal {
  position: absolute; left: 50%; top: 52px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100% - 140px);
  padding: 7px 14px; border-radius: 999px; background: rgba(7, 19, 34, .82); border: 1px solid rgba(226, 200, 143, .55); color: #fff; font-size: 13px; pointer-events: none; white-space: nowrap;
}
.game-goal span { overflow: hidden; text-overflow: ellipsis; }
.game-goal i { font-style: normal; color: #e2c88f; display: inline-block; transition: transform .15s; }
.game-goal b { color: #e2c88f; font-variant-numeric: tabular-nums; }
.game-jump {
  position: absolute; right: 18px; bottom: 64px; width: 64px; height: 64px; border-radius: 50%; display: none; touch-action: none;
  border: 2px solid rgba(255, 255, 255, .5); background: rgba(201, 163, 91, .55); color: #fff; font-size: 26px; font-weight: 700;
}
@media (pointer: coarse) { .game.walking .game-jump { display: block; } }
.game-fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }
.game-fade.on { animation: g-fade .7s ease-out; }
@keyframes g-fade { 0% { opacity: 1; } 100% { opacity: 0; } }
.g-say { padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); margin-bottom: 12px; }
.g-say b { display: block; color: #e2c88f; font-size: 13px; letter-spacing: .06em; margin-bottom: 4px; }
.g-say p { margin: 0; font-size: 17px; line-height: 1.65; color: #fff; }
.g-goal { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: rgba(201, 163, 91, .12); border: 1px solid rgba(201, 163, 91, .45); color: #fff; font-weight: 600; }
.g-btn.small { padding: 8px 14px; font-size: 13px; }
.game[data-step="cut"] .game-panel, .game[data-step="choice"] .game-panel, .game[data-step="reply"] .game-panel { background: linear-gradient(180deg, #13294a, #0b1d33); }
.game.in-space .game-mini { box-shadow: 0 0 0 2px rgba(255, 255, 255, .3); }
@media (max-width: 860px) {
  .game[data-step="play"] .game-panel { max-height: 30svh; }
  .game-goal { top: 46px; font-size: 12px; max-width: calc(100% - 110px); left: calc(50% - 46px); }
  .game-jump { right: 14px; bottom: 60px; width: 58px; height: 58px; }
  .game-help { display: none; }
}

.game-goal[hidden], .game-tip[hidden] { display: none; }
