/* Super Chess: tactile tabletop theme. All surfaces are local, dependency-free CSS. */
:root {
  color-scheme: dark;
  --bg: #080f19;
  --panel: #142132;
  --muted: #a2b0c3;
  --mint: #81ead2;
  --line: #314052;
  --text: #eef4fc;
  --wood-line: #69451f99;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 8% 10%, #204a4b70, transparent 45%),
    radial-gradient(ellipse at 95% 35%, #40315435, transparent 45%),
    radial-gradient(ellipse at 45% 85%, #1a263b70, transparent 55%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.5 system-ui, 'Microsoft JhengHei', sans-serif;
}
button, select { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button, a, select, summary { touch-action: manipulation; }
button:focus-visible, summary:focus-visible, a:focus-visible, select:focus-visible {
  outline: 3px solid var(--mint); outline-offset: 4px;
}
header, footer {
  max-width: 1240px; margin: auto; padding: 23px 30px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
header { border-bottom: 1px solid #96c8d018; }
.brand {
  display: flex; align-items: center; gap: 13px;
  color: #f4fafc; text-decoration: none; font-size: 22px; font-weight: 750;
  letter-spacing: 1px;
}
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px;
  font-size: 31px; line-height: 1; color: #a5f7df;
  border: 1px solid #9af9d840; border-radius: 13px;
  background: linear-gradient(145deg, #3c786c, #1c453e 50%, #102825);
  box-shadow: inset 0 1px 1px #d6ffef55, 0 3px 0 #061a17, 0 7px 16px #0007;
  text-shadow: 0 2px 2px #09271f;
}
.brand small { font-size: 11px; font-weight: 600; letter-spacing: 3px; color: #91acae; margin-left: 8px; }
.version {
  padding: 7px 13px; font-size: 12px; color: #abc2c5;
  border: 1px solid #44606766; border-radius: 20px;
  background: #12252b80; box-shadow: inset 0 1px #ffffff08;
}
main {
  max-width: 1160px; margin: 30px auto 24px; padding: 0 26px;
  display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 38px;
  align-items: start;
}
.arena { min-width: 0; }
.arena-top { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 2.5px; color: var(--mint); }
h1 { font-size: 28px; letter-spacing: 1px; line-height: 1.35; margin: 7px 0 0; text-shadow: 0 3px 14px #0006; }
h2 { font-size: 17px; margin: 0; letter-spacing: .5px; }
.secondary {
  flex-shrink: 0; padding: 10px 14px; border: 1px solid #556579; border-radius: 9px;
  color: #d9e3ef; background: linear-gradient(#2c3d50, #182737);
  box-shadow: inset 0 1px #ffffff1a, 0 3px 0 #09111b, 0 6px 10px #0003;
  font-size: 14px; transition: transform .16s, filter .16s;
}
.players { display: flex; align-items: center; gap: 12px; margin-bottom: 23px; }
.player {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border: 1px solid #3a4c61; border-radius: 12px;
  background: linear-gradient(145deg, #26394b, #152232 72%);
  box-shadow: inset 0 1px #ffffff12, 0 4px 0 #060d17, 0 9px 17px #0003;
  transition: border-color .25s, box-shadow .25s;
}
.player.active {
  border-color: #74d9c1;
  background: linear-gradient(130deg, #2b4f51, #172d37 70%);
  box-shadow: inset 0 1px #c4ffee33, 0 4px 0 #081f21, 0 0 24px #65dcc619, 0 10px 18px #0005;
}
.player strong { display: block; font-size: 15px; }
.player small { display: block; color: #a9bacb; font-size: 12px; margin-top: 2px; }
.fragments { margin-left: auto; color: #d3bfff; font-size: 14px; white-space: nowrap; text-shadow: 0 0 12px #bd9eff44; }
.versus { font-size: 11px; font-weight: 700; color: #8297aa; letter-spacing: 1px; }
.stone { display: inline-block; width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; }
.black {
  background:
    radial-gradient(ellipse at 32% 22%, #d8e0e185 0%, #bbcbd01c 20%, transparent 37%),
    radial-gradient(circle at 38% 30%, #596671 0, #242e39 30%, #111821 58%, #060a10 85%);
  border: 1px solid #0b111b;
  box-shadow: inset 0 1px 1px #d8e9ef75, inset -2px -3px 4px #000c,
    0 3px 0 #020508, 2px 6px 5px #20160d73, 3px 9px 10px #261c104d;
}
.white {
  background:
    radial-gradient(ellipse at 32% 22%, #fff 0, #ffffffd9 13%, transparent 43%),
    radial-gradient(circle at 35% 27%, #fffefa 0, #eeeae0 43%, #c7c5bf 75%, #9c9d98 100%);
  border: 1px solid #ddd9cd;
  box-shadow: inset 0 1px 2px #fff, inset -2px -3px 4px #62676955,
    0 3px 0 #92968e, 2px 6px 5px #30231666, 3px 9px 10px #36251140;
}
.board-wrap {
  --rim: 28px;
  position: relative; isolation: isolate; padding: var(--rim);
  border: 1px solid #dbae79; border-radius: 15px;
  background:
    linear-gradient(135deg, #f1ce9e4d 0%, transparent 40%, #31160755 100%),
    repeating-linear-gradient(3deg, #4d230911 0 1px, transparent 1px 5px, #eab37315 5px 6px, transparent 6px 11px),
    linear-gradient(105deg, #81502c, #ae7944 26%, #8a532c 64%, #b37f48);
  box-shadow: inset 0 2px 2px #ffe1ae8c, inset 2px 0 2px #ebba7844, inset 0 -3px 3px #43220eb3,
    0 2px 0 #4a260f, 0 5px 0 #7e4b27, 0 8px 0 #63381d, 0 11px 0 #392012,
    0 12px 0 #bc864859, 0 24px 28px #0008, 0 38px 60px #0005;
  margin-bottom: 30px;
}
.board-wrap::before {
  content: ''; position: absolute; inset: 9px; border: 1px solid #f3cd9359;
  border-radius: 8px; box-shadow: 0 1px #341d1699, inset 0 1px #351c143b;
  pointer-events: none;
}
#board {
  display: grid; grid-template-columns: repeat(15, minmax(0, 1fr));
  position: relative; aspect-ratio: 1; touch-action: manipulation;
  border: 1px solid #765331; border-radius: 2px;
  background:
    radial-gradient(ellipse at 25% 14%, #fff3d25c, transparent 67%),
    repeating-linear-gradient(1deg, transparent 0 4px, #65331206 4px 5px, transparent 5px 9px),
    repeating-linear-gradient(92deg, #fff1d20c 0 2px, transparent 2px 8px),
    linear-gradient(115deg, #eac590, #d8ad72 65%, #cea066);
  box-shadow: 0 1px 1px #ffdc9e99, 0 -2px 5px #39220b99, -2px 0 4px #43260866,
    inset 0 0 28px #87521b29;
}
.cell {
  appearance: none; position: relative; display: grid; place-items: center; min-width: 0;
  padding: 0; border: 0; aspect-ratio: 1; border-radius: 0;
  background:
    linear-gradient(transparent calc(50% - .5px), var(--wood-line) calc(50% - .5px), var(--wood-line) calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(90deg, transparent calc(50% - .5px), var(--wood-line) calc(50% - .5px), var(--wood-line) calc(50% + .5px), transparent calc(50% + .5px));
}
.cell:focus-visible { outline: 2px solid #146d5b; outline-offset: -2px; z-index: 3; }
.cell.star::before { content: ''; position: absolute; width: 6px; height: 6px; background: #65441f; border-radius: 50%; box-shadow: 0 1px #ffeecc77; }
.cell .stone { position: relative; width: 84%; height: 84%; z-index: 1; transform: translateY(-2px); pointer-events: none; }
.cell.last { z-index: 2; }
.cell.last .stone::after {
  content: ''; position: absolute; width: 19%; height: 19%; border-radius: 50%; top: 40%; left: 40%;
  background: #e77654; border: 1px solid #ffc3a3; box-shadow: 0 0 5px #e8836655;
}
.cell:disabled { cursor: default; }
.board-files, .board-ranks {
  position: absolute; display: grid; pointer-events: none; user-select: none;
  color: #f3d7ad; font-size: 10px; font-weight: 650; line-height: 1;
  text-shadow: 0 1px 1px #3c1e09;
}
.board-files { grid-template-columns: repeat(15, 1fr); left: var(--rim); right: var(--rim); bottom: 8px; }
.board-ranks { grid-template-rows: repeat(15, 1fr); top: var(--rim); bottom: var(--rim); left: 7px; width: 15px; }
.board-files span, .board-ranks span { display: grid; place-items: center; }
.veil {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%); z-index: 4;
  padding: 9px 17px; white-space: nowrap; border: 1px solid #b994d6; border-radius: 20px;
  color: #f1e3ff; background: linear-gradient(#58416c, #2b1f43);
  box-shadow: inset 0 1px #ffffff3d, 0 4px 0 #180f29, 0 9px 25px #0008;
  font-size: 14px; pointer-events: none;
}
.board-wrap:has(.veil:not([hidden])) { --wood-line: #5e457066; }
.board-wrap:has(.veil:not([hidden])) #board { background: radial-gradient(ellipse at top, #ded0e0, #b4a0c4); }
.result {
  position: absolute; inset: 15%; z-index: 5; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 20px;
  color: #eef9f7; background: linear-gradient(140deg, #243d47f5, #101c2df5);
  backdrop-filter: blur(12px); border: 1px solid #96e3d3; border-radius: 20px;
  box-shadow: inset 0 1px #e5fffa4d, 0 7px 0 #081722, 0 22px 55px #000a;
}
.result h2 { font-size: 32px; margin: 14px 0 0; }
.result p { color: #b4c7d4; font-size: 14px; }
.primary {
  border: 1px solid #b4ffe8; border-radius: 10px; padding: 12px 24px;
  color: #103e36; font-weight: 750; background: linear-gradient(#a9f6df, #60d0b4);
  box-shadow: inset 0 1px #fff8, 0 4px 0 #287963, 0 8px 15px #0005;
  transition: transform .16s, filter .16s;
}
.turnbar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 16px; border: 1px solid #40506680; border-radius: 11px;
  background: linear-gradient(110deg, #223344, #152331);
  box-shadow: inset 0 1px #ffffff0d, 0 3px 10px #0002;
}
#status { font-size: 15px; font-weight: 600; }
.clock { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
#seconds { font-size: 26px; line-height: 1.2; font-weight: 750; color: #a6f4df; font-variant-numeric: tabular-nums; text-shadow: 0 0 14px #81ead226; }
.clock small { font-size: 12px; color: var(--muted); }
.time-track { height: 5px; margin: 10px 3px 0; border-radius: 3px; background: #060d17; box-shadow: 0 1px #ffffff0d; overflow: hidden; }
#time-fill { width: 100%; height: 100%; background: var(--mint); border-radius: inherit; box-shadow: 0 0 8px #81ead280; transition: width .2s; }
.notice { min-height: 22px; margin: 12px 3px; color: var(--muted); font-size: 14px; line-height: 1.7; }
aside { padding-top: 3px; min-width: 0; }
aside section {
  position: relative; padding: 21px; margin-bottom: 19px;
  border: 1px solid #405066; border-bottom-color: #1d2b3f; border-radius: 16px;
  background: linear-gradient(135deg, #26364b, #172435 60%, #132030);
  box-shadow: inset 0 1px #ffffff12, 0 5px 0 #070f1c, 0 12px 24px #0003;
}
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.section-title > span { font-size: 12px; color: #adbecd; }
.powers .section-title > span { background: #101f30; padding: 4px 8px; border: 1px solid #41516a; border-radius: 5px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 10px 0 20px; }
.power {
  --accent: #96f8db; --edge: #5bb69a; --shade: #122d29; --surface: #294f48; --base: #183731;
  position: relative; display: flex; align-items: center; gap: 12px; text-align: left;
  width: 100%; padding: 17px 12px; margin: 0 0 16px;
  border: 1px solid var(--edge); border-radius: 12px; color: #edf9f5;
  background: linear-gradient(120deg, #ffffff0c, transparent 65%), linear-gradient(var(--surface), var(--base));
  box-shadow: inset 0 1px #ffffff33, inset 0 -1px #0004, 0 4px 0 var(--shade), 0 5px 0 #ffffff12, 0 9px 14px #0004;
  transition: transform .16s, filter .16s, box-shadow .16s;
}
.power.blind { --accent: #d9bdff; --edge: #9c79c3; --shade: #241934; --surface: #4b3a64; --base: #302641; }
.power.control { --accent: #ffdaa3; --edge: #c19458; --shade: #322418; --surface: #5c4833; --base: #3f3025; }
.power-icon {
  display: grid; place-items: center; flex: 0 0 43px; width: 43px; height: 46px;
  border: 1px solid var(--edge); border-radius: 12px; color: var(--accent);
  font-size: 30px; line-height: 1;
  background: radial-gradient(ellipse at 25% 0, #ffffff2b, transparent 65%), linear-gradient(var(--surface), var(--shade));
  box-shadow: inset 0 1px #ffffff4d, inset 0 -2px 3px #0004, 0 3px 0 #0005, 0 5px 10px #0003;
  text-shadow: 0 1px 2px #0009, 0 0 14px currentColor;
}
.power > span:nth-child(2) { flex: 1; min-width: 0; }
.power strong { display: block; font-size: 16px; font-weight: 700; letter-spacing: .5px; text-shadow: 0 1px 2px #0008; }
.power small { display: block; color: #c3cfdc; font-size: 12px; line-height: 1.65; margin-top: 5px; }
.power em { flex-shrink: 0; font-size: 12px; font-weight: 600; font-style: normal; color: var(--accent); }
.power:disabled { opacity: .55; cursor: not-allowed; filter: saturate(.55); box-shadow: inset 0 1px #ffffff14, 0 2px 0 var(--shade), 0 4px 6px #0003; }
.test-note { color: #afbdce; font-size: 12px; line-height: 1.8; margin-top: 18px; padding-top: 14px; border-top: 1px solid #8298b326; }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; margin-top: 14px; }
.settings select { padding: 7px 10px; background: #0d1928; color: #eef4fc; border: 1px solid #46586d; border-radius: 7px; box-shadow: inset 0 2px 5px #0005, 0 1px #ffffff0d; }
.settings small { display: block; color: var(--muted); font-size: 12px; margin-top: 12px; }
.history ol { list-style: none; padding: 0; margin: 15px 0 0; max-height: 154px; overflow: auto; scrollbar-width: thin; scrollbar-color: #53687e transparent; }
.history li { font-size: 13px; color: #adbed2; line-height: 1.7; padding: 7px 0; border-bottom: 1px solid #ffffff0a; }
.history li:first-child { color: #e4f6f2; }
details { padding: 5px 6px 15px; color: var(--muted); font-size: 14px; line-height: 1.8; }
summary { cursor: pointer; color: #bdcfdf; }
footer { border-top: 1px solid #96c8d018; font-size: 12px; color: #8a9eaf; padding-top: 18px; padding-bottom: 18px; }
[hidden] { display: none !important; }
@media (hover: hover) {
  .secondary:hover, .primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
  .power:not(:disabled):hover { filter: brightness(1.12); transform: translateY(-3px); box-shadow: inset 0 1px #ffffff40, 0 6px 0 var(--shade), 0 13px 20px #0005; }
  .cell:not(:disabled):not(:has(.stone)):hover::after { content: ''; position: absolute; width: 72%; height: 72%; border-radius: 50%; border: 2px solid #15584699; background: #144a3624; box-shadow: 0 2px 5px #153d2c26; pointer-events: none; }
}
.secondary:active, .primary:active { transform: translateY(2px); }
.power:not(:disabled):active { transform: translateY(3px); box-shadow: inset 0 1px #ffffff20, 0 1px 0 var(--shade), 0 3px 8px #0005; }
@media (max-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr); max-width: 666px; gap: 16px; padding: 0 22px; margin-top: 24px; }
  .brand small { display: none; }
  header { padding: 17px 22px; }
  .brand { font-size: 20px; }
  h1 { font-size: 25px; }
  aside { padding-top: 0; }
  .power { gap: 14px; }
  footer { padding: 18px 22px; }
}
@media (max-width: 480px) {
  header { padding: 14px 16px; gap: 8px; }
  .brand { gap: 9px; font-size: 18px; white-space: nowrap; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 27px; }
  .version { font-size: 11px; padding: 5px 9px; }
  main { padding: 0 16px; margin-top: 20px; gap: 10px; }
  h1 { font-size: 22px; }
  .eyebrow { font-size: 10px; letter-spacing: 1.7px; }
  .arena-top { margin-bottom: 17px; gap: 8px; }
  .secondary { padding: 9px 10px; font-size: 13px; }
  .players { gap: 7px; margin-bottom: 20px; }
  .player { padding: 11px 9px; gap: 8px; border-radius: 10px; }
  .player .stone { width: 24px; height: 24px; }
  .player strong { font-size: 14px; }
  .player small { font-size: 10px; }
  .fragments { font-size: 12px; }
  .versus { font-size: 9px; }
  .board-wrap { --rim: 21px; border-radius: 12px; margin-bottom: 26px; }
  .board-wrap::before { inset: 6px; border-radius: 7px; }
  .board-files { bottom: 6px; font-size: 8px; }
  .board-ranks { left: 4px; width: 12px; font-size: 8px; }
  .cell.star::before { width: 4px; height: 4px; }
  .cell .stone { transform: translateY(-1px); box-shadow: inset 0 1px 1px #ffffff4d, inset -1px -2px 2px #0003, 0 2px 0 #42362666, 1px 4px 4px #25170866; }
  .turnbar { padding: 10px 12px; }
  #status { font-size: 13px; }
  #seconds { font-size: 25px; }
  .notice { font-size: 13px; }
  aside section { padding: 18px; border-radius: 13px; }
  .power { padding: 16px 11px; gap: 11px; }
  .power-icon { flex-basis: 39px; width: 39px; height: 43px; }
  .power strong { font-size: 15px; }
  .power small { font-size: 12px; }
  .result { inset: 10%; padding: 16px; }
  .result h2 { font-size: 27px; }
  .veil { font-size: 12px; padding: 7px 11px; }
  footer { flex-wrap: wrap; gap: 4px; padding: 17px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.power.haste { --accent: #addbff; --edge: #70a7d8; --shade: #172839; --surface: #2c4b66; --base: #1c344a; }
.haste .power-icon { font-size: 25px; }
.turn-info { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.time-effect { color: #addbff; font-size: 12px; line-height: 1.5; }
.turnbar.accelerated { border-color: #70a7d8; background: linear-gradient(110deg, #253f58, #152331); }
