:root {
  font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', system-ui, sans-serif;
  color: #f5f2e8;
  background: #0c2e29;
  font-synthesis: none;
  --card-w: min(70px, calc((100vw - 34px) / 8 - 3px));
  --card-h: calc(var(--card-w) * 1.38);
  --fan-y: clamp(22px, 6.5vw, 31px);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: radial-gradient(circle at 50% 18%, #205b49, #0c2e29 72%); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #ffcf69; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.eyebrow { margin: 0 0 3px; color: #b9d1c6; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.home-shell { max-width: 660px; margin: 0 auto; padding: max(36px, env(safe-area-inset-top)) 22px 40px; }
.home-header { display: flex; align-items: center; gap: 16px; }
.brand-mark { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: #f3eee1; color: #185440; font-size: 39px; box-shadow: 0 9px 26px #0003; }
h1 { margin: 0; font-size: clamp(24px, 6vw, 36px); letter-spacing: .04em; }
.home-lead { color: #d9e9dd; margin: 24px 0 28px; font-size: 18px; }
.mode-switch { display: flex; align-items: center; gap: 14px; min-height: 68px; margin-bottom: 18px; padding: 12px 16px; border: 1px solid #e5f1de33; border-radius: 16px; background: #ffffff12; cursor: pointer; }
.mode-switch input { width: 23px; height: 23px; accent-color: #ffdf83; }
.mode-switch span { display: grid; gap: 3px; }
.mode-switch small { color: #c7ded0; }
.game-grid { display: grid; gap: 12px; }
.game-tile { width: 100%; min-height: 110px; display: flex; align-items: center; gap: 16px; padding: 18px; border: 1px solid #e5f1de33; border-radius: 18px; color: inherit; text-align: left; text-decoration: none; background: #ffffff12; box-shadow: 0 8px 28px #001b1533; }
button.game-tile, a.game-tile { background: #f3eee1; color: #173d34; border-color: #f3eee1; }
button.game-tile:active, a.game-tile:active { transform: scale(.99); }
.tile-icon { display: flex; gap: 2px; align-items: center; justify-content: center; flex: 0 0 66px; width: 66px; height: 66px; border-radius: 13px; background: #dce9d8; font-size: 27px; font-weight: 800; }
.tile-icon i { color: #c44a4b; font-style: normal; transform: translateY(5px); }
.tile-body { display: grid; gap: 5px; min-width: 0; }
.tile-body strong { font-size: 20px; }
.tile-body small { font-size: 13px; opacity: .78; line-height: 1.4; }
.tile-arrow { margin-left: auto; font-size: 26px; }
.upcoming .tile-icon { color: #17483c; background: #e9eee5; }
.tile-state { margin-left: auto; flex: 0 0 auto; font-size: 11px; color: #d1e4d7; }
.home-note { margin: 24px 3px; color: #b9d1c6; font-size: 13px; }
.game-shell { max-width: 960px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 10px max(30px, env(safe-area-inset-bottom)); }
.game-header { display: flex; align-items: center; gap: 12px; min-height: 55px; }
.game-header h1 { font-size: 21px; }
.back-button { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 12px; color: #fff; background: #ffffff20; text-decoration: none; font-size: 25px; }
.move-count { margin-left: auto; color: #d7e7dc; font-size: 14px; white-space: nowrap; }
.toolbar { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; scrollbar-width: none; }
.toolbar button { flex: 1 0 auto; min-height: 44px; min-width: 70px; padding: 6px 10px; border: 1px solid #dbead54d; border-radius: 11px; color: #fff; background: #ffffff1c; font-size: 13px; }
.toolbar button:disabled { opacity: .4; cursor: default; }
.message { min-height: 25px; margin: 2px 0 12px; color: #ffe5a5; font-size: 13px; line-height: 1.5; }
.felt { min-height: 425px; padding: 12px 7px 22px; border: 1px solid #b5d5bb45; border-radius: 17px; background: radial-gradient(circle at 50% 20%, #22745a, #12513e 72%); box-shadow: inset 0 0 45px #092e2188, 0 12px 30px #001e1738; }
.top-piles { display: flex; justify-content: space-between; gap: 7px; margin-bottom: 26px; }
.pile-group { display: grid; grid-template-columns: repeat(4, var(--card-w)); gap: 3px; }
.pile { position: relative; width: var(--card-w); height: var(--card-h); padding: 0; border: 2px dashed #d7e7d766; border-radius: 6px; color: #dcebd2; background: #092f2633; touch-action: manipulation; }
.pile-symbol { font-size: clamp(19px, 5vw, 32px); opacity: .7; }
.pile.selected, .table-card.selected { outline: 3px solid #ffce60; outline-offset: 2px; z-index: 90; }
.pile.suggested, .table-card.suggested, .suggested-column .column-drop { outline: 3px solid #fff499; outline-offset: 2px; }
.playing-card { position: absolute; inset: 0; display: block; overflow: hidden; border: 1px solid #e9e5dc; border-radius: 6px; background: #fffdf7; box-shadow: 0 2px 5px #001b173d; text-align: left; }
.playing-card.red { color: #ba333e; }
.playing-card.black { color: #263b39; }
.corner { position: absolute; top: 3px; left: 4px; display: grid; justify-items: center; line-height: .97; font-size: clamp(10px, 2.8vw, 17px); }
.big-suit { position: absolute; right: 4px; bottom: 0; font-size: clamp(18px, 5.6vw, 34px); line-height: 1; }
.tableau { display: grid; grid-template-columns: repeat(8, var(--card-w)); justify-content: space-between; gap: 3px; }
.column { position: relative; min-width: 0; height: calc((var(--cards) - 1) * var(--fan-y) + var(--card-h)); }
.column-drop { width: var(--card-w); height: var(--card-h); padding: 0; border: 2px dashed #d7e7d766; border-radius: 6px; background: #092f2633; }
.table-card { position: absolute; top: calc(var(--depth) * var(--fan-y)); left: 0; width: var(--card-w); height: var(--card-h); padding: 0; border: 0; border-radius: 6px; background: transparent; touch-action: manipulation; }
.table-card:hover { transform: translateY(-2px); }
.rules-panel { margin: 15px 3px 0; padding: 13px 15px; border: 1px solid #dfebdd37; border-radius: 12px; color: #dbe8dc; background: #ffffff0d; font-size: 13px; line-height: 1.7; }
.rules-panel summary { min-height: 25px; cursor: pointer; font-weight: 700; }
.rules-panel p { margin: 9px 0 0; }
.seed { margin: 10px 3px; color: #9fbbaa; font-size: 11px; }
.win-panel { display: grid; gap: 5px; margin-top: 14px; padding: 18px; border-radius: 12px; color: #173d34; background: #ffdf83; text-align: center; }
@media (min-width: 650px) {
  :root { --card-w: 70px; --fan-y: 31px; }
  .game-shell { padding-inline: 25px; }
  .felt { padding: 24px; min-height: 520px; }
  .top-piles { margin-bottom: 40px; }
  .toolbar { gap: 10px; }
  .toolbar button { font-size: 15px; }
}
@media (max-width: 350px) {
  .tile-state { display: none; }
  .game-tile { gap: 11px; padding: 12px; }
  .top-piles { gap: 3px; }
}
