/* ============ 掼蛋宗师模拟器 · 牌桌视觉 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --felt-1: #0c3b2c; --felt-2: #072419;
  --gold: #e8b34b; --gold-deep: #b9822a;
  --ink: #eef3ee; --ink-dim: #9db4a6;
  --card-bg: #fdfdf7;
  --red: #c93a2e; --panel: #0e2f24; --panel-line: rgba(232, 179, 75, .25);
}
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: radial-gradient(120% 100% at 50% 0%, var(--felt-1) 0%, var(--felt-2) 78%);
  color: var(--ink); overflow: hidden;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
select { background: #123527; color: var(--ink); border: 1px solid var(--panel-line); border-radius: 8px; padding: 5px 10px; }

.btn { border: 1px solid var(--panel-line); background: rgba(255,255,255,.06); color: var(--ink); border-radius: 10px; padding: 9px 22px; font-size: 15px; letter-spacing: 2px; transition: transform .12s, box-shadow .2s; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn.gold { background: linear-gradient(160deg, #f3ca6f, var(--gold-deep)); color: #241a05; border-color: #f6dc9b; font-weight: 700; text-shadow: 0 1px 0 rgba(255,255,255,.35); }
.btn.dark { background: #14231d; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 12px; font-size: 12.5px; letter-spacing: 1px; border-radius: 8px; }
.btn.glow { animation: glowpulse 1s 5; box-shadow: 0 0 0 2px #52d98a, 0 0 18px rgba(82,217,138,.7); }
@keyframes glowpulse { 50% { box-shadow: 0 0 0 2px #52d98a, 0 0 4px rgba(82,217,138,.3); } }
.btn.big { padding: 13px 44px; font-size: 18px; }
.btn.danger { border-color: rgba(201,58,46,.6); color: #ff9d94; }

/* ---------- 开始界面 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(3, 15, 10, .78); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 50; opacity: 0; pointer-events: none; transition: opacity .25s; }
.overlay.show { opacity: 1; pointer-events: auto; }
.start-box { width: min(640px, 92vw); text-align: center; padding: 46px 40px 34px; border: 1px solid var(--panel-line); border-radius: 22px; background: linear-gradient(175deg, rgba(20,60,44,.92), rgba(7,30,21,.95)); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.start-emblem { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 16px; background: linear-gradient(160deg, #f3ca6f, var(--gold-deep)); color: #241a05; font-size: 34px; font-weight: 900; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(232,179,75,.35); }
.start-box h1 { font-size: 34px; letter-spacing: 6px; margin-bottom: 8px; }
.start-sub { color: var(--gold); letter-spacing: 2px; font-size: 14px; margin-bottom: 26px; }
.start-feats { list-style: none; text-align: left; margin: 0 auto 30px; max-width: 460px; display: grid; gap: 14px; }
.start-feats li { display: grid; grid-template-columns: 118px 1fr; gap: 12px; font-size: 13.5px; color: var(--ink-dim); line-height: 1.65; }
.start-feats b { color: var(--gold); font-weight: 600; border-right: 1px solid var(--panel-line); padding-right: 12px; }
.start-btns { display: flex; gap: 14px; justify-content: center; }
.start-tip { margin-top: 18px; font-size: 12px; color: var(--ink-dim); }

/* ---------- 顶栏 ---------- */
#app { display: flex; flex-direction: column; height: 100vh; }
#topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-bottom: 1px solid var(--panel-line); background: rgba(4,20,13,.55); }
.tb-left { display: flex; align-items: center; gap: 10px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(160deg, #f3ca6f, var(--gold-deep)); color: #241a05; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; }
.tb-title { font-size: 15px; letter-spacing: 2px; }
.tb-center { display: flex; gap: 22px; }
.stat { text-align: center; line-height: 1.15; }
.stat i { display: block; font-style: normal; font-size: 10.5px; color: var(--ink-dim); letter-spacing: 2px; }
.stat b { font-size: 16px; color: var(--gold); font-variant-numeric: tabular-nums; }
.tb-right { display: flex; gap: 8px; align-items: center; }

/* ---------- 主区 ---------- */
#table-wrap { flex: 1; display: grid; grid-template-columns: 1fr 300px; min-height: 0; }
#table { position: relative; }
.seat { position: absolute; }
.seat-tag { display: inline-flex; align-items: center; gap: 8px; background: rgba(6,24,16,.75); border: 1px solid var(--panel-line); padding: 3px 12px; border-radius: 20px; font-size: 12.5px; }
.seat-tag em { font-style: normal; color: var(--gold); font-weight: 700; }
.seat-n { top: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.seat-w { left: 18px; top: 45%; transform: translateY(-50%); }
.seat-e { right: 18px; top: 45%; transform: translateY(-50%); }
.seat-s { bottom: 0; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.turn-dot { width: 9px; height: 9px; border-radius: 50%; margin: 6px auto 0; background: transparent; }
.turn-dot.on { background: var(--gold); box-shadow: 0 0 12px var(--gold); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.thinking { font-size: 12px; color: var(--gold); letter-spacing: 3px; animation: pulse 1.1s infinite; }

.hand-backs { display: flex; }
.hand-backs .bk { width: 24px; height: 34px; border-radius: 4px; background: repeating-linear-gradient(45deg, #1b4a37 0 5px, #173f2f 5px 10px); border: 1px solid #2f6b51; margin-left: -13px; }
.hand-backs .bk:first-child { margin-left: 0; }
.seat-w .hand-backs, .seat-e .hand-backs { flex-direction: column; margin-top: 6px; }
.seat-w .hand-backs .bk, .seat-e .hand-backs .bk { margin-left: 0; margin-top: -24px; }
.seat-w .hand-backs .bk:first-child, .seat-e .hand-backs .bk:first-child { margin-top: 0; }

/* ---------- 中央出牌区 ---------- */
#center-zone { position: absolute; inset: 90px 130px 190px; display: grid; grid-template-areas: ". n ." "w mid e" ". s ."; grid-template-columns: 1fr auto 1fr; grid-template-rows: 1fr auto 1fr; }
.drop { grid-area: mid; display: flex; align-items: center; justify-content: center; gap: -10px; }
.drop-n { align-self: start; } .drop-s { align-self: end; }
#drop-1 { justify-self: end; } #drop-3 { justify-self: start; }
.drop .mini-card, .drop .card { margin-left: -14px; }
.drop .mini-card:first-child, .drop .card:first-child { margin-left: 0; }
.pass-badge { font-size: 13px; color: var(--ink-dim); background: rgba(255,255,255,.05); border: 1px dashed rgba(255,255,255,.25); border-radius: 14px; padding: 4px 14px; }
#level-banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; color: rgba(255,255,255,.16); font-size: 12px; letter-spacing: 3px; pointer-events: none; user-select: none; }
#level-banner b { display: block; font-size: 58px; color: rgba(232,179,75,.22); }

/* ---------- 扑克牌 ---------- */
.card { position: relative; width: 58px; height: 82px; background: var(--card-bg); border-radius: 8px; border: 1px solid #c9c9b8; box-shadow: 0 3px 8px rgba(0,0,0,.4); color: #1c1c14; display: flex; flex-direction: column; justify-content: space-between; padding: 5px 6px; user-select: none; flex: 0 0 auto; }
.card .tl { font-size: 15px; font-weight: 800; line-height: 1; }
.card .tl small { display: block; font-size: 11px; font-weight: 600; }
.card .big-suit { align-self: flex-end; font-size: 22px; line-height: 1; }
.card.red { color: var(--red); }
.card.joker { align-items: center; justify-content: center; font-weight: 900; font-size: 15px; letter-spacing: 1px; writing-mode: vertical-lr; }
.card.joker.big { color: #d92b1c; background: linear-gradient(160deg, #fff 60%, #ffe9c2); }
.card.joker.small { color: #2b57c9; background: linear-gradient(160deg, #fff 60%, #dfe9ff); }
.card.lvl { border-color: var(--gold-deep); box-shadow: 0 3px 8px rgba(0,0,0,.4), 0 0 0 1.5px rgba(232,179,75,.55) inset; }
.card.wild { border-color: #2ba97a; box-shadow: 0 3px 8px rgba(0,0,0,.4), 0 0 0 2px rgba(43,169,122,.6) inset; }
.card .wmark { position: absolute; top: -7px; right: -5px; background: #2ba97a; color: #fff; font-size: 10px; border-radius: 50%; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; }
.card.sm { width: 44px; height: 62px; padding: 4px; border-radius: 6px; }
.card.sm .big-suit { font-size: 15px; }

/* 我的手牌 */
#my-hand { display: flex; justify-content: center; padding: 0 20px; min-height: 96px; align-items: flex-end; flex-wrap: wrap; }
#my-hand .card { margin-left: -22px; transition: transform .12s; cursor: pointer; }
#my-hand .card:first-child { margin-left: 0; }
#my-hand .card:hover { transform: translateY(-8px); z-index: 3; }
#my-hand .card.sel { transform: translateY(-20px); box-shadow: 0 8px 18px rgba(232,179,75,.4), 0 0 0 2px var(--gold); z-index: 4; }
#my-hand .card.hintglow { box-shadow: 0 0 0 2.5px #52d98a, 0 6px 16px rgba(82,217,138,.5); animation: pulse 1s 2; }
#my-hand .card.dim { opacity: .55; }
#my-hand .card.gone { display: none; }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px);} 75% { transform: translateX(4px);} }

/* ---------- 操作栏 ---------- */
#my-zone { border-top: 1px solid var(--panel-line); background: rgba(4,20,13,.6); padding: 8px 18px 14px; position: relative; }
#action-bar { display: flex; align-items: center; justify-content: space-between; max-width: 1080px; margin: 6px auto 0; }
#sel-info { font-size: 13px; color: var(--ink-dim); min-width: 260px; }
#sel-info b { color: var(--gold); }
.ab-btns { display: flex; gap: 10px; align-items: center; }
#badge-pill { position: absolute; right: 22px; top: -58px; background: linear-gradient(160deg, #123b2a, #0a281c); border: 1px solid var(--panel-line); border-radius: 14px; padding: 8px 16px; font-size: 13px; max-width: 520px; line-height: 1.5; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: floatin .35s; z-index: 9; }
#badge-pill .g { display: inline-block; font-weight: 900; font-size: 17px; margin-right: 8px; }
#badge-pill .g.S { color: #ffd35e; } #badge-pill .g.A { color: #52d98a; } #badge-pill .g.B { color: #6db9ff; } #badge-pill .g.C { color: #d0a1ff; } #badge-pill .g.D { color: #ff8d84; }
@keyframes floatin { from { transform: translateY(10px); opacity: 0; } }

/* ---------- 日志 ---------- */
#log-panel { border-left: 1px solid var(--panel-line); background: rgba(4,18,12,.65); display: flex; flex-direction: column; min-height: 0; }
.log-head { padding: 12px 16px 8px; font-size: 14px; letter-spacing: 1px; border-bottom: 1px solid rgba(255,255,255,.06); }
.log-sub { font-size: 11px; color: var(--ink-dim); margin-left: 6px; }
#log-list { flex: 1; overflow-y: auto; padding: 8px 14px 16px; font-size: 12.5px; line-height: 1.6; }
.lg { padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,.06); }
.lg .who { color: var(--gold); margin-right: 6px; }
.lg .who.me { color: #52d98a; }
.lg .why { color: var(--ink-dim); font-size: 11.5px; display: block; }
.lg.trick-line { color: rgba(255,255,255,.28); text-align: center; font-size: 11px; letter-spacing: 4px; border: 0; padding: 3px; }
.lg .score-tag { float: right; font-weight: 800; }
.lg.evt { color: #ffb46b; }
.lg.big { color: #ffd35e; font-weight: 700; }

/* ---------- 弹窗 ---------- */
.modal { width: min(520px, 92vw); max-height: 86vh; overflow-y: auto; background: linear-gradient(175deg, #134030, #0a2318); border: 1px solid var(--panel-line); border-radius: 18px; padding: 26px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.modal.wide { width: min(720px, 94vw); } .modal.xwide { width: min(980px, 95vw); }
.modal h3 { font-size: 19px; letter-spacing: 2px; margin-bottom: 8px; color: #ffe6ae; }
.modal-sub { font-size: 13px; color: var(--ink-dim); margin-bottom: 14px; line-height: 1.7; }
.modal-btns { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }
.rules-body p { font-size: 13px; line-height: 1.85; margin-bottom: 9px; color: var(--ink-dim); }
.rules-body b { color: var(--gold); margin-right: 4px; }

#interpret-list { display: grid; gap: 8px; }
.intp { border: 1px solid var(--panel-line); border-radius: 10px; padding: 10px 14px; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; }
.intp:hover { background: rgba(232,179,75,.12); }
.intp i { font-style: normal; color: var(--ink-dim); font-size: 12px; }

.tribute-cards { display: flex; flex-wrap: wrap; gap: 8px; max-height: 44vh; overflow-y: auto; padding: 6px 2px; }
.tribute-cards .card { cursor: pointer; }
.tribute-cards .card.sel { transform: translateY(-8px); box-shadow: 0 0 0 2px var(--gold); }
.tribute-cards .card.nope { opacity: .3; cursor: not-allowed; }

/* ---------- 复盘报告 ---------- */
.rep-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0 18px; }
.rep-cell { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); border-radius: 12px; padding: 12px; text-align: center; }
.rep-cell i { display: block; font-style: normal; font-size: 11px; color: var(--ink-dim); letter-spacing: 1px; margin-bottom: 4px; }
.rep-cell b { font-size: 22px; color: #ffe6ae; }
.rep-grade { font-size: 40px !important; }
.rep-banner { text-align: center; padding: 14px; border-radius: 14px; font-size: 17px; letter-spacing: 2px; margin-bottom: 6px; font-weight: 700; }
.rep-banner.win { background: linear-gradient(160deg, rgba(232,179,75,.25), rgba(232,179,75,.08)); color: #ffd35e; border: 1px solid rgba(232,179,75,.4); }
.rep-banner.lose { background: rgba(255,255,255,.05); color: var(--ink-dim); border: 1px solid rgba(255,255,255,.1); }
table.rep-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rep-tbl th { text-align: left; color: var(--gold); font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--panel-line); white-space: nowrap; }
.rep-tbl td { padding: 7px 8px; border-bottom: 1px dashed rgba(255,255,255,.08); vertical-align: top; line-height: 1.55; }
.rep-tbl td.g { font-weight: 900; font-size: 14px; }
.rep-tbl .why { color: var(--ink-dim); font-size: 11.5px; display: block; margin-top: 2px; }
.rep-tbl .alt { color: #7fceff; }
.rep-dist { display: flex; gap: 8px; margin: 4px 0 16px; justify-content: center; }
.rep-dist span { font-size: 12px; background: rgba(255,255,255,.06); padding: 4px 10px; border-radius: 20px; }
.rep-sec-h { margin: 18px 0 8px; color: var(--gold); font-size: 14px; letter-spacing: 2px; border-left: 3px solid var(--gold); padding-left: 10px; }

.his-trend { margin: 10px 0 18px; }
.his-item { display: grid; grid-template-columns: 118px 1fr 64px 52px; gap: 10px; font-size: 12.5px; padding: 8px 4px; border-bottom: 1px dashed rgba(255,255,255,.08); align-items: center; }
.his-item .g { font-weight: 900; font-size: 15px; text-align: right; }
.his-empty { color: var(--ink-dim); text-align: center; padding: 30px; font-size: 13px; }

.set-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 2px; font-size: 14px; border-bottom: 1px dashed rgba(255,255,255,.08); }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  #table-wrap { grid-template-columns: 1fr 220px; }
  #center-zone { inset: 80px 110px 180px; }
}
@media (max-width: 860px) {
  #table-wrap { grid-template-columns: 1fr; }
  #log-panel { display: none; }
  .tb-center { display: none; }
  #my-hand .card { width: 44px; height: 64px; margin-left: -26px; }
}
