/* 手牌专用页面：所有样式只供独立 decoder.html 使用。 */
:root {
  color-scheme: dark;
  --page: #0b1018;
  --panel: #131c28;
  --line: #263142;
  --text: #eaf0f7;
  --muted: #8292a8;
  --accent: #75ded0;
  --gold: #ddbc7c;
  --green: #7be0b5;
  --red: #f29a9e;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--text);
  background: var(--page);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.app-shell {
  width: min(100%, 1136px);
  margin: 0 auto;
  padding: max(38px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(38px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
}
.hand-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 20px 70px #00000024; }
.hand-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 26px 28px; }
.heading-group { display: flex; gap: 16px; align-items: center; min-width: 0; }
h1 { margin: 0; font-size: 23px; font-weight: 650; letter-spacing: .03em; }
#hand-count { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.hand-mark { position: relative; display: block; width: 42px; height: 42px; flex: 0 0 42px; border: 1px solid #75ded026; border-radius: 12px; background: #75ded00a; }
.hand-mark i { position: absolute; left: 12px; top: 10px; width: 16px; height: 23px; border: 1.5px solid var(--accent); border-radius: 3px; background: #172c34; transform: rotate(-14deg); }
.hand-mark i + i { left: 17px; top: 8px; transform: rotate(10deg); }
.hand-mark i + i::after { content: ""; position: absolute; inset: 8px 5px; background: var(--accent); transform: rotate(45deg); }
.header-actions { display: flex; align-items: center; gap: 22px; flex: 0 0 auto; }
.sync-state { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.live-indicator { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #7b8a9f; }
.live-indicator.connected { background: var(--accent); box-shadow: 0 0 0 4px #75ded00d; }
.live-indicator.connecting { background: var(--gold); }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid #344156; border-radius: 8px; background: #1b2635; color: #d4ddeb; font-size: 12px; font-weight: 500; cursor: pointer; transition: background .16s, border-color .16s; white-space: nowrap; }
.button:hover { background: #243245; border-color: #62778f; }
.button:disabled { opacity: .5; cursor: wait; }
.import-button { background: transparent; color: #a8b6c8; }
.button.primary { background: var(--accent); color: #102b2a; border-color: var(--accent); font-weight: 700; }
.button.primary:hover { background: #9cecdf; }
.button.ghost { background: transparent; }
.top-information { display: grid; grid-template-columns: 2.2fr .8fr 1fr 1fr; gap: 24px; padding: 0 28px 24px; }
.summary-card { min-width: 0; }
.summary-card > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; }
.summary-card > strong { display: block; color: #cbd7e6; font-size: 12px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.summary-card:nth-child(2) > strong { color: var(--accent); }
.table-wrap { width: 100%; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.col-seat { width: 12%; }
.col-player { width: 26%; }
.col-cards { width: 43%; }
.col-score { width: 19%; }
thead { background: #0d152080; }
th { height: 43px; padding: 0 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #7f92aa; text-align: left; font-size: 11px; font-weight: 500; }
th:last-child, td:last-child { text-align: right; }
td { height: 90px; padding: 12px 28px; border-bottom: 1px solid #263142b0; font-size: 14px; }
tbody tr:nth-child(even) { background: #0d152029; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #75ded005; }
.seat-badge { display: inline-grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; background: #75ded00b; color: var(--accent); font: 600 13px system-ui, sans-serif; }
.player-name { display: block; overflow-wrap: anywhere; line-height: 1.6; }
.cards { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.card-face { display: block; width: 45px; height: auto; aspect-ratio: 105 / 150; object-fit: contain; border-radius: 4px; filter: drop-shadow(0 3px 4px #00000030); }
.playing-card { display: inline-grid; place-items: center; min-height: 62px; min-width: 44px; max-width: 92px; padding: 6px; border: 1px solid #4e5e73; border-radius: 4px; color: #d1ddec; font-size: 11px; overflow-wrap: anywhere; }
.score { color: #b4c1d3; font: 500 15px "Cascadia Code", Consolas, monospace; font-variant-numeric: tabular-nums; }
.score.positive { color: var(--green); }
.score.negative { color: var(--red); }
.muted { color: var(--muted); font-size: 12px; }
.empty-table { height: 150px; text-align: center !important; }
.empty-result { display: flex; min-height: 380px; padding: 40px 20px; align-items: center; justify-content: center; flex-direction: column; border-top: 1px solid var(--line); }
.empty-cards { display: grid; place-items: center; width: 46px; height: 64px; margin-bottom: 22px; border: 1px solid #344356; border-radius: 6px; color: #6b8c9c; font: 28px Georgia, serif; transform: rotate(-8deg); }
.empty-result strong { font-size: 16px; font-weight: 500; }
.empty-result p { margin: 10px 0 0; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.8; }
.import-dialog { width: min(660px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 26px; border: 1px solid #37465a; border-radius: 16px; color: var(--text); background: #131d2a; box-shadow: 0 30px 100px #0008; overflow-y: auto; }
.import-dialog::backdrop { background: #040810b8; backdrop-filter: blur(5px); }
html:has(.import-dialog[open]) { overflow: hidden; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.dialog-heading h2 { margin: 0; font-size: 18px; font-weight: 600; }
.dialog-heading p { color: var(--muted); margin: 9px 0 0; font-size: 12px; line-height: 1.7; }
.close-button { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; border: 0; border-radius: 6px; background: transparent; color: #8c9aaf; font-size: 26px; cursor: pointer; }
.close-button:hover { color: var(--text); background: #263446; }
.input-label { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 10px; color: #b4c1d3; font-size: 12px; }
#input-count { color: var(--muted); }
textarea { display: block; width: 100%; min-height: 174px; max-height: 340px; resize: vertical; padding: 14px; border: 1px solid #344156; border-radius: 9px; background: #0c131e; color: #d4e3f5; font: 12px/1.8 "Cascadia Code", Consolas, monospace; overflow-wrap: anywhere; }
textarea::placeholder { color: #5f718b; }
.input-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 15px; }
.keyboard-hint { color: var(--muted); font-size: 11px; }
.button-row { display: flex; gap: 9px; }
.error-box { padding: 10px 12px; border: 1px solid #f29a9e40; border-radius: 7px; color: var(--red); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.live-panel { margin-top: 24px; padding-top: 21px; border-top: 1px solid var(--line); }
.live-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.live-heading h3 { margin: 0; color: #c3d1e2; font-size: 13px; font-weight: 600; }
#live-status { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.live-detail { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; color: var(--muted); font-size: 11px; }
.live-source { color: var(--muted); font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.clipboard-option { display: flex; align-items: center; gap: 8px; margin-top: 15px; color: #a8b7c9; font-size: 11px; }
.clipboard-option input { margin: 0; accent-color: var(--accent); }
.live-warning { margin: 12px 0 0; color: var(--gold); font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
@media (max-width: 640px) {
  .app-shell { padding: max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .hand-panel { border-radius: 12px; }
  .hand-header { padding: 20px 16px; gap: 12px; }
  .heading-group { gap: 10px; }
  .hand-mark { display: none; }
  h1 { font-size: 18px; }
  #hand-count { margin-top: 6px; font-size: 10px; }
  .header-actions { gap: 12px; }
  .sync-state { gap: 6px; font-size: 10px; }
  .import-button { min-height: 31px; padding: 0 10px; font-size: 10px; }
  .top-information { grid-template-columns: .75fr 1.5fr .75fr; gap: 16px 14px; padding: 0 16px 20px; }
  .summary-card > strong { font-size: 11px; }
  .summary-card:first-child { grid-column: 1 / -1; }
  .col-seat { width: 12%; }
  .col-player { width: 24%; }
  .col-cards { width: 48%; }
  .col-score { width: 16%; }
  th { height: 36px; padding: 0 10px; font-size: 10px; }
  td { height: 76px; padding: 10px; font-size: 12px; }
  .seat-badge { width: 23px; height: 26px; border-radius: 6px; font-size: 11px; }
  .cards { gap: 4px; }
  .card-face { width: clamp(26px, 8.2vw, 43px); }
  .playing-card { min-width: 26px; min-height: 42px; max-width: 65px; padding: 3px; font-size: 9px; }
  .score { font-size: 12px; }
  .import-dialog { padding: 20px; }
  .keyboard-hint { display: none; }
  .input-footer { justify-content: flex-end; }
}
@media (max-width: 350px) {
  .hand-header { flex-wrap: wrap; }
  .header-actions { width: 100%; justify-content: space-between; }
  th, td { padding-left: 7px; padding-right: 7px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .app-shell { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .hand-header { padding-top: 16px; padding-bottom: 16px; }
}
