/* Vòng 2 (2026-11-29, theo góp ý của Astra): báo lượt, hướng dẫn lần đầu, màn mở ván, cài đặt, Orin sống động, bố cục điện thoại.
   Nạp sau app.css. */
.card.pad { padding: 14px; }
.btn.on { border-color: #e8c36a; background: linear-gradient(180deg, rgba(232, 195, 106, 0.32), rgba(80, 60, 20, 0.5)); box-shadow: 0 0 14px rgba(232, 195, 106, 0.35); }
.btn.big { min-height: 48px; font-size: 16px; }
.link { appearance: none; background: none; border: 0; color: var(--ink-dim); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; padding: 8px; }
.link:hover { color: var(--ink); }

/* Thanh báo lượt (cố định trên bàn) */
.rail { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; padding: 6px 14px; border-radius: 12px; background: rgba(8, 14, 26, 0.82); border: 1px solid var(--line); font-size: 14px; font-weight: 600; overflow: hidden; }
.rail .who { white-space: nowrap; }
.rail .note { font-weight: 500; font-size: 13px; color: var(--ink-dim); text-align: right; opacity: 0; transition: opacity 0.4s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .note.show { opacity: 1; }
.rail .note.me { color: #f1ece0; }
.rail .note.orin { color: #bae6fd; }
.rail .line { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
.rail.me { border-color: rgba(241, 236, 224, 0.55); box-shadow: 0 0 18px rgba(241, 236, 224, 0.12); }
.rail.me .who { color: #fff; }
.rail.me .line { background: linear-gradient(90deg, #f1ece0, #e8c36a); }
.rail.orin { border-color: rgba(56, 189, 248, 0.45); }
.rail.orin .who { color: #bae6fd; }
.rail.orin .line { background: linear-gradient(90deg, #38bdf8, #1d4ed8); }
.rail.over .who { color: var(--gold); }

/* Hướng dẫn lần đầu */
.coach { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: linear-gradient(180deg, rgba(232, 195, 106, 0.18), rgba(232, 195, 106, 0.08)); border: 1px solid rgba(232, 195, 106, 0.55); font-size: 14px; line-height: 1.45; }
.coach[hidden] { display: none; }
.coach p { margin: 0; flex: 1; }
.coach .bulb { font-size: 18px; }

/* Màn mở ván */
.intro { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at center, rgba(6, 12, 24, 0.72), rgba(3, 6, 12, 0.94)); backdrop-filter: blur(2px); cursor: pointer; }
.intro-box { width: min(560px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.intro .head h2 { margin: 0; font-family: var(--display); font-size: clamp(30px, 7vw, 46px); color: var(--gold); letter-spacing: 0.04em; text-shadow: 0 0 24px rgba(232, 195, 106, 0.45); }
.intro .head span { font-size: 14px; color: var(--ink-dim); letter-spacing: 0.12em; text-transform: uppercase; }
.versus-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; width: 100%; margin: 8px 0; }
.versus-row .side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.versus-row .side img, .versus-row .side .ava { width: clamp(96px, 26vw, 150px); height: clamp(96px, 26vw, 150px); border-radius: 50%; object-fit: cover; object-position: 50% 12%; border: 2px solid rgba(241, 236, 224, 0.7); background: radial-gradient(circle at 50% 35%, #183456, #0a1426 70%); display: grid; place-items: center; font-size: 44px; font-weight: 700; box-shadow: 0 0 40px rgba(241, 236, 224, 0.18); }
.versus-row .side.foe img { border-color: rgba(56, 189, 248, 0.8); box-shadow: 0 0 40px rgba(56, 189, 248, 0.3); }
.versus-row .side b { font-size: 17px; }
.versus-row .vs { font-family: var(--display); font-size: 40px; color: #fff; text-shadow: 0 0 18px rgba(232, 195, 106, 0.8); }
.intro .say { margin: 0; font-style: italic; color: var(--ink); font-size: 16px; }
.intro .opener { margin: 0; font-weight: 700; color: var(--gold); letter-spacing: 0.04em; }
.intro .controls { flex-direction: column; align-items: center; gap: 2px; margin-top: 6px; }

/* Cài đặt */
.dialog.narrow { width: min(420px, 100%); }
.settings h4 { margin: 14px 0 6px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.settings h4:first-child { margin-top: 0; }
.set-row { display: grid; grid-template-columns: 78px 1fr 34px; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; }
.set-row input[type="range"] { width: 100%; height: 44px; accent-color: #e8c36a; background: transparent; }
.set-row output { text-align: right; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.seg { display: flex; gap: 6px; }
.seg .btn { flex: 1; min-height: 44px; padding: 8px 6px; }

/* Orin: khuôn mặt, biểu tượng cảm xúc, viền theo tâm trạng */
.orin .portrait .face { position: absolute; inset: 0; will-change: transform; }
.orin .portrait img { transition: opacity 0.16s ease; }
.orin .emote { position: absolute; right: 10%; top: 8%; z-index: 3; font-size: 30px; font-weight: 800; color: #fff; text-shadow: 0 0 10px rgba(0, 0, 0, 0.9), 0 0 18px var(--mood, rgba(125, 211, 252, 0.8)); opacity: 0; pointer-events: none; }
.orin { transition: border-color 0.4s, box-shadow 0.4s; }
.orin[data-mood="smug"], .orin[data-mood="laugh"] { --mood: rgba(56, 189, 248, 0.9); border-color: rgba(56, 189, 248, 0.5); }
.orin[data-mood="surprised"], .orin[data-mood="impressed"] { --mood: rgba(232, 195, 106, 0.9); border-color: rgba(232, 195, 106, 0.55); }
.orin[data-mood="annoyed"] { --mood: rgba(248, 113, 113, 0.9); border-color: rgba(248, 113, 113, 0.5); }
.orin[data-mood="cast"] { --mood: rgba(125, 211, 252, 1); border-color: rgba(125, 211, 252, 0.8); box-shadow: 0 0 34px rgba(125, 211, 252, 0.3), var(--shadow); }
.orin[data-mood="cast"] .portrait .glow { background: radial-gradient(circle at 50% 40%, rgba(125, 211, 252, 0.35), transparent 60%); }
.orin[data-mood="defeated"] { --mood: rgba(148, 163, 184, 0.9); }
.orin .bubble { cursor: pointer; min-height: 3.6em; }
.orin .bubble .say { display: block; }

/* Thẻ hai đấu thủ: có điểm thì bỏ chữ "đấu" để số không đè lên chữ ở cột hẹp */
.fighter > div { min-width: 0; }
.fighter .score { flex: none; }
.fighter .score:empty { display: none; }
.versus.scored { grid-template-columns: 1fr 1fr; gap: 6px; }
.versus.scored .vs { display: none; }

/* Kết ván */
.end .actions { justify-content: center; flex-wrap: wrap; }
.end .actions .big { flex: 1 1 100%; }
.end .highlight { color: var(--ink); }
.end-invite { margin: 14px 0 4px; padding: 12px; border-radius: 12px; border: 1px dashed rgba(170, 205, 245, 0.3); background: rgba(255, 255, 255, 0.03); align-items: center; }
.end-invite b { color: var(--ink); font-size: 14px; }

/* Bàn cờ vừa chiều cao màn hình trên máy tính */
@media (min-width: 901px) {
  .board.caro, .board.othello, .board.ganh { width: min(100%, 900px, var(--fit-w, calc(100dvh - 170px))); min-width: 340px; }
  /* Cờ Linh Thú: khay lệnh sang cột phải, chân dung Orin thấp lại để khay nằm trọn màn hình */
  .arena[data-game="capsule"] .orin .portrait { aspect-ratio: 16 / 11; }
  .orin-col .cap-dock { width: 100%; }
  .orin-col .cap-forecast { flex-direction: column; align-items: stretch; }
  .orin-col .cap-kinds .btn { flex: 1 1 auto; }
  .orin-col .cap-bar-foot { flex-direction: column; align-items: stretch; }
  .orin-col { display: flex; flex-direction: column; gap: 12px; }
  /* Cột phải hẹp: thẻ đấu thủ có điểm xếp hai hàng, tên và phe không bị cắt */
  .versus.scored { grid-template-columns: 1fr; gap: 4px; }
  .versus.scored .fighter.right { flex-direction: row; text-align: left; }
  .versus.scored .fighter.right .score { margin-left: auto; margin-right: 0; }
  .board.oq .pit:not(.quan) { aspect-ratio: 5 / 6; }
}

/* Điện thoại: thanh tiêu đề gọn, Orin dạng dải, khay thao tác dính đáy vừa ngón cái */
@media (max-width: 900px) {
  .topbar { padding: 8px 10px; gap: 6px; }
  .topbar .crest, .topbar .title span, .topbar .chip.guest { display: none; }
  .topbar .title b { font-size: 17px; }
  .icon-btn { width: 40px; height: 40px; }
  .orin .portrait { width: 84px; min-width: 84px; }
  .orin .emote { font-size: 20px; right: 6%; top: 6%; }
  .orin .bubble { min-height: 0; }
  .stage-col > :not(.stage):not(.rail):not(.coach) { position: sticky; bottom: max(6px, env(safe-area-inset-bottom)); z-index: 15; }
  .stage-col > .card:not(.stage), .stage-col > .cap-dock .cap-bar { background: rgba(10, 18, 34, 0.97); box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.55); }
  .stage-col > .controls, .stage-col > .rps-picks { padding: 8px; border-radius: 14px; background: rgba(10, 18, 34, 0.97); border: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.55); }
  .btn { min-height: 46px; }
}
.lobby-journey { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 14px; border-color: rgba(125, 211, 252, 0.4); }
.lobby-journey > div:first-child { flex: 1; min-width: 240px; }
.lobby-journey h3 { margin-bottom: 4px; }
