/* =========================================================================
   그랜드투어 전용 (style.css 다음에 불러온다)
   ========================================================================= */
.logo.sm { font-size: 32px; letter-spacing: -1px; }
button.accent { background: var(--accent-soft); color: var(--accent); border-color: rgba(245,200,76,.45); }
button.accent:hover:not(:disabled) { background: rgba(245,200,76,.24); }
button.danger { color: #fca5a5; border-color: rgba(248,113,113,.35); }
button.big-roll { padding: 11px 20px; font-size: var(--fs-3); display: inline-flex; align-items: center; gap: 8px; }
button.big-roll kbd { background: rgba(0,0,0,.15); border-color: rgba(0,0,0,.2); color: var(--accent-ink); }
button .ic { display: inline-block; vertical-align: -3px; }

/* 위 막대 */
.topbar { gap: 16px; }
.tb-chips { flex: 1; display: flex; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.chip-stat { display: flex; flex-direction: column; line-height: 1.2; padding: 4px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.chip-stat small { font-size: 11px; color: var(--muted); }
.chip-stat b { font-size: var(--fs-2); }
.chip-stat.half b { color: var(--accent); }
.chip-stat.half.second { border-color: rgba(180,138,230,.5); background: rgba(180,138,230,.12); }
.chip-stat.half.second b { color: #cfb4f5; }
.chip-stat.stock b { font-weight: 500; font-size: var(--fs-1); }

/* 주사위 */
.die { display: inline-grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 44px; height: 44px; padding: 6px; gap: 2px;
  border-radius: 10px; background: linear-gradient(160deg, #fffdf7, #e7e0d0); box-shadow: 0 3px 0 #b8ae98, 0 6px 14px rgba(0,0,0,.4); }
.die i { border-radius: 50%; place-self: center; width: 7px; height: 7px; }
.die i.on { background: #1d2230; }
.die.sm { width: 24px; height: 24px; padding: 3px; gap: 1px; border-radius: 6px; box-shadow: 0 2px 0 #b8ae98; }
.die.sm i { width: 4px; height: 4px; }
.tb-dice { display: inline-flex; gap: 4px; margin-left: 4px; }

/* 플레이어 알약 */
.pill { align-items: flex-start; border-left: 3px solid var(--ac); }
.pill.out { opacity: .45; }
.pill-sub { flex-wrap: wrap; gap: 3px; }
.dotsep { color: var(--faint); }
.flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.flags:empty { display: none; }
.flag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; padding: 1px 7px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--muted); }
.flag.warn { background: rgba(251,191,36,.14); color: var(--warn); }
.flag.info { background: rgba(180,138,230,.16); color: #cfb4f5; }
.flag.bad { background: rgba(248,113,113,.14); color: #fca5a5; }
.flag.good { background: rgba(74,222,128,.12); color: var(--good); }

/* 2D 보드 */
.gs2d { background: radial-gradient(ellipse 70% 60% at 40% 40%, #121a26, var(--bg) 75%); min-height: 100vh; }
.board-wrap { position: fixed; top: 124px; bottom: 150px; left: 16px; right: var(--right); display: grid; place-items: center; container-type: size; transition: bottom .25s var(--ease); }
.gs2d.sheet-open .board-wrap { bottom: 330px; }
.board2d {
  position: relative; display: grid; grid-template-columns: repeat(11, 1fr); grid-template-rows: repeat(11, 1fr); gap: 2px;
  width: min(100cqw, 100cqh); aspect-ratio: 1; padding: 6px; border-radius: var(--r-lg);
  background: #0c1118; border: 1px solid rgba(214,176,92,.35); box-shadow: var(--shadow), inset 0 0 0 3px #121820;
}
.board2d .cell {
  position: relative; border-radius: 4px; background: #f1ece0; color: #1d2230; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 1px;
  padding: 2px; min-width: 0; font-size: clamp(7px, 1.05cqmin, 12px); line-height: 1.1;
  transition: transform .12s var(--ease), box-shadow .12s;
}
.board2d .cell:hover { box-shadow: 0 0 0 2px var(--accent); z-index: 2; }
.board2d .zone { position: absolute; background: var(--z); }
.cell.side0 .zone { left: 0; right: 0; top: 0; height: 18%; }
.cell.side1 .zone { top: 0; bottom: 0; right: 0; width: 18%; }
.cell.side2 .zone { left: 0; right: 0; bottom: 0; height: 18%; }
.cell.side3 .zone { top: 0; bottom: 0; left: 0; width: 18%; }
.c-name { font-weight: 700; word-break: keep-all; overflow-wrap: anywhere; }
.c-price { font-size: .85em; color: #5c5446; }
.c-icon { font-size: 1.5em; line-height: 1; }
.cell.corner { background: #e4dcc8; }
.cell.corner .c-name { font-size: 1.15em; }
.cell.t-key { background: #f6e7b8; }
.cell.t-space { background: #1f1940; color: #e5dcff; }
.cell.t-space .c-price { color: #b6a8e8; }
.cell.t-island { background: #cfe7ea; }
.cell.t-fundOut, .cell.t-fundIn { background: #f4d9d4; }
.cell.owned { box-shadow: inset 0 0 0 2px var(--o); }
.cell.owned .c-price { color: #1d2230; font-weight: 700; }
.c-owner { position: absolute; top: 2px; left: 2px; width: 1.5em; height: 1.5em; border-radius: 50%; background: var(--o); color: #fff; font-size: .8em; font-weight: 700; display: grid; place-items: center; }
.cell.side0 .c-owner { top: 22%; }
.c-bld { display: flex; gap: 1px; }
.c-bld i { width: .8em; height: .8em; border-radius: 2px; background: #3c8e5a; }
.c-bld i.building { background: #3d6fb8; height: 1em; }
.c-bld i.hotel { background: #c2412d; height: 1.15em; }
.cell.pick { outline: 2px dashed rgba(180,138,230,.8); outline-offset: -2px; }
.cell.sel { box-shadow: 0 0 0 3px #b48ae6, 0 0 18px rgba(180,138,230,.7); z-index: 3; transform: scale(1.06); }
.cell.hot { box-shadow: 0 0 0 3px var(--accent), 0 0 16px rgba(245,200,76,.6); z-index: 3; }
.b-center { grid-row: 2 / 11; grid-column: 2 / 11; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(ellipse at center, #17202c, #0e141c); border-radius: 8px; }
.b-center .logo { font-size: clamp(22px, 5cqmin, 46px); }
.bc-row { display: flex; gap: 12px; min-height: 48px; align-items: center; }
.bc-stats { display: flex; gap: 22px; }
.bc-stats span { display: flex; flex-direction: column; align-items: center; }
.bc-stats small { color: var(--muted); font-size: var(--fs-1); }
.tokens2d { position: absolute; inset: 6px; pointer-events: none; }
.tok { position: absolute; width: 4.2%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: var(--ac);
  color: #fff; font: 700 clamp(8px, 1.1cqmin, 12px) var(--sans); display: grid; place-items: center; font-style: normal;
  border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.55); transition: left .14s ease-out, top .14s ease-out; z-index: 4; }
.tok.acting { animation: tokPulse 1.2s ease-in-out infinite; }
@keyframes tokPulse { 50% { box-shadow: 0 0 0 4px rgba(245,200,76,.6), 0 3px 8px rgba(0,0,0,.55); } }

/* 내 정보 */
.dock { display: flex; align-items: center; gap: 16px; padding: 10px 14px; max-width: 100%; flex-wrap: wrap; }
.dock.active { border-color: rgba(245,200,76,.45); }
.dock-cash { display: flex; flex-direction: column; line-height: 1.15; }
.dock-cash small { font-size: 11px; color: var(--muted); }
.dock-cash b { font-size: var(--fs-5); letter-spacing: -.5px; }
.dock-deeds { display: flex; flex-wrap: wrap; gap: 4px; max-width: 520px; }
.deed-chip { padding: 3px 8px 3px 10px; font-size: var(--fs-1); border-radius: 6px; position: relative; overflow: hidden; display: inline-flex; gap: 5px; align-items: center; }
.deed-chip::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--z); }
.deed-chip .lv { font-style: normal; font-size: 10px; background: var(--accent); color: var(--accent-ink); border-radius: 4px; padding: 0 4px; }

/* 행동 시트 */
.sheet { width: min(760px, 100%); max-height: calc(100vh - 300px); }
.act { display: flex; flex-direction: column; gap: 10px; }
.build-list { display: flex; flex-direction: column; gap: 4px; max-height: 210px; overflow-y: auto; }
.build-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); background: var(--surface-2); }
.build-row.tut-target { box-shadow: 0 0 0 2px var(--accent); animation: tutGlow2 1.1s ease-in-out infinite; }
@keyframes tutGlow2 { 50% { box-shadow: 0 0 0 3px var(--accent), 0 0 18px rgba(245,200,76,.5); } }
.zone-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--z); flex: none; }
.b-name { font-weight: 600; font-size: var(--fs-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-name small { font-weight: 400; color: var(--muted); }
.lvdots { display: inline-flex; gap: 3px; }
.lvdots i { width: 9px; height: 9px; border-radius: 2px; background: rgba(255,255,255,.1); }
.lvdots i.on.villa { background: #4ade80; }
.lvdots i.on.building { background: #60a5fa; }
.lvdots i.on.hotel { background: #f87171; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kv { display: flex; justify-content: space-between; font-size: var(--fs-2); color: var(--muted); padding: 4px 0; border-bottom: 1px solid var(--line); }
.kv b { color: var(--text); }
.act.buy { flex-direction: row; gap: 16px; align-items: stretch; }
.buy-side { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.buy-side .sheet-foot { margin-top: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.debt-sec h3 { margin-bottom: 6px; }
.split { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: rgba(248,113,113,.25); }
.split .have { display: block; height: 100%; background: var(--good); transition: width .25s var(--ease); }
.stepper { display: inline-flex; align-items: center; gap: 2px; background: rgba(0,0,0,.3); border-radius: 9px; padding: 2px; }
.stepper button { width: 28px; height: 28px; padding: 0; display: grid; place-items: center; border: 0; background: transparent; border-radius: 7px; }
.stepper output { min-width: 80px; text-align: center; font-weight: 700; }
.pick-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 12px 8px 14px; position: relative; overflow: hidden; text-align: left; }
.pick-chip::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--z); }
.pick-chip.on { border-color: var(--accent); background: var(--accent-soft); }
.pick-chip small { font-size: 11px; color: var(--warn); }

/* 증서 */
.deed { width: 250px; flex: none; border-radius: var(--r-md); overflow: hidden; background: #f6f1e6; color: #1d2230; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.deed-top { background: var(--z); color: #10141b; padding: 10px 12px 8px; display: flex; flex-direction: column; line-height: 1.2; }
.deed-top small { font-size: 11px; opacity: .75; }
.deed-top b { font-size: 20px; }
.deed-top .mono { font-size: 11px; letter-spacing: .1em; opacity: .7; }
.deed-price { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 12px 2px; }
.deed-price .muted { color: #6a6151; }
.deed-table { font-size: var(--fs-1); margin: 0 4px; width: calc(100% - 8px); }
.deed-table th, .deed-table td { border-color: rgba(0,0,0,.08); color: #1d2230; padding: 4px 8px; }
.deed-table th { color: #6a6151; }
.deed-table .muted { color: #8a8170; }
.deed-table tr.hot td { background: rgba(245,200,76,.35); font-weight: 700; }
.deed p { padding: 6px 12px 10px; color: #6a6151 !important; }

/* 행운 카드 팝업 */
#luck { position: fixed; left: calc((100vw - 262px) / 2); top: 30vh; transform: translate(-50%, 0); z-index: 32; pointer-events: none; opacity: 0; }
#luck.show { pointer-events: auto; animation: luckIn 4.2s var(--ease) forwards; cursor: pointer; }
.luck-card { width: 300px; border-radius: 16px; padding: 16px 18px 14px; color: #1d1608;
  background: linear-gradient(150deg, #ffe7a3, #f5c84c 60%, #d9a52e); box-shadow: 0 20px 60px rgba(0,0,0,.6), inset 0 0 0 2px rgba(255,255,255,.4); }
.luck-top { display: flex; align-items: center; gap: 6px; font-size: var(--fs-1); font-weight: 700; letter-spacing: .04em; }
.luck-top small { margin-left: auto; opacity: .6; }
.luck-card h3 { font-size: 22px; color: #1d1608; margin: 8px 0 6px; letter-spacing: -.3px; }
.luck-card p { font-size: var(--fs-2); line-height: 1.55; }
.luck-foot { margin-top: 10px; font-size: 11px; opacity: .7; }
@keyframes luckIn {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(.85); }
  10% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  88% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -14px); }
}

/* 땅 목록 */
.modal-card.narrow { width: min(420px, 100%); }
.modal-card.narrow .deed { width: 100%; }
.deeds-table tr { cursor: pointer; }
.deeds-table tr:hover td { background: var(--surface-2); }
.deeds-table tr.mine td:first-child { color: var(--accent); font-weight: 600; }
.deeds-table .zone-row td { color: var(--muted); font-size: var(--fs-1); padding-top: 12px; cursor: default; background: none !important; }
.table-scroll { overflow-x: auto; }

@media (max-width: 900px) {
  .board-wrap { position: static; order: -1; padding: 8px; container-type: inline-size; }
  .board2d { width: 100%; }
  .board2d .cell { font-size: clamp(6px, 2.1cqw, 11px); }
  .tb-chips { order: 3; flex-basis: 100%; }
  .act.buy { flex-direction: column; }
  .deed { width: 100%; }
  .dock-deeds { max-width: none; }
  #luck { left: 50%; top: 22vh; }
  .market { overflow-x: auto; }
}

/* 내 정보 막대의 굴리기 */
.dock-act { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.dock-hint { font-size: var(--fs-2); color: var(--accent); }

/* 넓은 화면: 왼쪽 열에 튜토리얼 → 내 정보 → 행동 패널 */
@media (min-width: 1200px) {
  .bottom { top: 124px; bottom: 16px; left: 16px; right: auto; width: 420px; justify-content: flex-start; align-items: stretch; overflow-y: auto; scrollbar-width: thin; }
  .bottom > .sheet { width: 100%; max-height: none; }
  .bottom .tut { position: static; transform: none; width: 100%; }
  .dock { width: 100%; }
  .dock-act { margin-left: 0; width: 100%; }
  .dock-act .big-roll { flex: 1; justify-content: center; }
  .act.buy { flex-direction: column; }
  .deed { width: 100%; }
  .gs2d .board-wrap, .gs.tut-on .board-wrap { left: 452px; bottom: 16px; }
  .gs2d.sheet-open .board-wrap { bottom: 16px; }
  .turnbar, #banner, #luck, #announce { left: calc(436px + (100vw - 436px - var(--right)) / 2); }
}

/* 결과 화면은 넓게 가운데 */
@media (min-width: 1200px) {
  .bottom:has(.result) { left: 16px; right: var(--right); width: auto; align-items: center; background: rgba(2,4,10,.35); border-radius: var(--r-lg); padding: 0 0 8px; }
  .bottom:has(.result) > .sheet { width: min(860px, 100%); }
}
.result .rest { max-width: 360px; margin-left: auto; margin-right: auto; }

@media (max-width: 900px) {
  .bottom { position: static; order: 0; padding: 0 10px; align-items: stretch; }
  .bottom .tut { position: static; transform: none; width: auto; margin: 0; }
  .dock-act { margin-left: 0; width: 100%; }
  .dock-act .big-roll { flex: 1; justify-content: center; }
  #banner { padding: 12px 22px; width: max-content; max-width: calc(100vw - 40px); }
  #banner .b-title { font-size: 24px; }
  #banner .b-sub { font-size: var(--fs-2); }
  .luck-card { width: min(300px, calc(100vw - 40px)); }
}
