.arcane-only { display: none; }
.topbar-tools { display: flex; align-items: center; gap: 16px; }
.theme-toggle { border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px; color: var(--ink); background: transparent; font-size: 11px; white-space: nowrap; }
.theme-toggle:hover { background: #b9c6ad20; }

:root[data-theme="arcane"] {
  color-scheme: dark;
  --paper: #101915;
  --ink: #e7e2cb;
  --muted: #929b8a;
  --teal: #3de0a8;
  --coral: #ff6a45;
  --line: #7e84613c;
  --brass: #c3ac74;
  background: #101915;
}
[data-theme="arcane"] body {
  background: radial-gradient(ellipse at 15% 27%, color-mix(in srgb, var(--seat-glow, #326447) 22%, transparent), transparent 55%), radial-gradient(ellipse at 88% 8%, #9847291d, transparent 45%), repeating-linear-gradient(0deg, #aebf8804 0 1px, transparent 1px 5px), var(--seat-paper, #101915);
}
[data-theme="arcane"] body[data-seat="teal"] {
  --seat-paper: #14241b;
  --seat-glow: #3d7a58;
}
[data-theme="arcane"] body[data-seat="coral"] {
  --seat-paper: #1c1714;
  --seat-glow: #8a4a32;
}
[data-theme="arcane"] .lobby-cta { background: #17231b; border-color: #6f7a5244; }
[data-theme="arcane"] .lobby-cta-create { background: linear-gradient(#3f6a4d, #2a4a36); color: #e8efd4; }
[data-theme="arcane"] .lobby-cta-ai { background: #2a1f1a; color: #e2a582; border-top-color: #6a4538 !important; }
[data-theme="arcane"] .lobby-entry { background: #17231b; border-color: #6f7a5244; }
[data-theme="arcane"] .lobby-entry-create button { background: linear-gradient(#3f6a4d, #2a4a36); color: #e8efd4; }
[data-theme="arcane"] .lobby-entry-ai button { background: #2a1f1a; color: #e2a582; }
[data-theme="arcane"] .room-card { background: #17231b; border-color: #6f7a5244; color: #d5dbc4; }
[data-theme="arcane"] .room-card.is-empty { background: #13201888; }
[data-theme="arcane"] .mini-board { background: #3a4f3488; box-shadow: inset 0 0 0 1px #8ea06a33; }
[data-theme="arcane"] .mini-cell { background: linear-gradient(140deg, #4f6844, #3a5135); }
[data-theme="arcane"] .mini-cell.goal-teal { background: linear-gradient(140deg, #5f7d55, #466344); }
[data-theme="arcane"] .mini-cell.goal-coral { background: linear-gradient(140deg, #6a5340, #513d30); }
[data-theme="arcane"] .lobby-pager button { background: #1b281f; color: #c8c9ad; border-color: #6f7a5244; }
[data-theme="arcane"] .game-layout[data-layout="lobby"] { grid-template-columns: minmax(0, 1fr) 280px; }
[data-theme="arcane"] .tabletop { width: min(1120px, calc(100% - 80px)); }
[data-theme="arcane"] .topbar { height: 74px; border-color: #b1ad7840; }
[data-theme="arcane"] .back-link { color: #d1be8d !important; background: #19271d !important; border: 1px solid #9b906055 !important; border-radius: 2px !important; box-shadow: inset 0 1px 0 #e2d0a512; }
[data-theme="arcane"] .brand { color: var(--brass); font-family: "Baskerville", "Palatino", serif; font-size: 11px; letter-spacing: .24em; }
[data-theme="arcane"] .classic-only { display: none; }
[data-theme="arcane"] .arcane-only { display: flex; }
[data-theme="arcane"] .heading .arcane-only { display: block; }
[data-theme="arcane"] .heading { padding: 33px 0 21px; }
[data-theme="arcane"] .heading .eyebrow { color: var(--brass); letter-spacing: .22em; }
[data-theme="arcane"] h1 { font-family: "Songti SC", "STSong", "Baskerville", serif; font-size: clamp(43px, 5.6vw, 66px); letter-spacing: .12em; text-shadow: 0 2px 0 #070d0a, 0 0 32px #9fac6130; }
[data-theme="arcane"] .title-dot { color: var(--brass); }
[data-theme="arcane"] .intro { color: #acb49b; font-family: "Songti SC", "STSong", serif; letter-spacing: .16em; line-height: 1.9; }
[data-theme="arcane"] .theme-toggle { color: #c6c9ad; border-color: #a59d7050; background: linear-gradient(180deg, #a69f7010, #101a16); box-shadow: inset 0 1px 0 #d2c99210; border-radius: 2px; }
[data-theme="arcane"] .theme-toggle:hover { color: #f0e5bc; border-color: #d7bd77; }
[data-theme="arcane"] .realm-banner { align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 28px; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
[data-theme="arcane"] .realm-legend { display: flex; align-items: center; gap: 14px; font-size: 11px; letter-spacing: .06em; }
[data-theme="arcane"] .realm-legend > span { display: inline-flex; align-items: center; gap: 8px; }
[data-theme="arcane"] .realm-legend b { font-family: "Baskerville", serif; font-weight: 400; color: #706b52; font-size: 16px; font-style: italic; }
[data-theme="arcane"] .realm-mark { width: 20px; height: 20px; background: url("assets/fantasy/elf.svg") center 28% / 21px auto no-repeat; border: 1px solid #3de0a888; border-radius: 50%; box-shadow: 0 0 6px #3de0a844; }
[data-theme="arcane"] .realm-mark.orc { background-image: url("assets/fantasy/orc.svg"); border-color: #ff6a4588; box-shadow: 0 0 6px #ff6a4544; }
[data-theme="arcane"] .realm-tools { display: flex; align-items: center; gap: 15px; }
[data-theme="arcane"] .realm-tools button { background: transparent; color: #c8b57f; font-size: 10px; padding: 5px 0; }
[data-theme="arcane"] .realm-tools button:hover { color: #f3d7a1; }
[data-theme="arcane"] #gore-toggle[aria-pressed="true"] { color: #dc9272; }
[data-theme="arcane"] .game-layout { grid-template-columns: minmax(0, 640px) 300px; gap: 54px; }
[data-theme="arcane"] .board-topline { padding: 0 1px; margin-bottom: 11px; }
[data-theme="arcane"] .goal-label { font-size: 11px; letter-spacing: .13em; }
[data-theme="arcane"] .board-shortcuts button { border-radius: 2px; background: #a3b78a08; border-color: #92977340; color: #c1c8a9; }
[data-theme="arcane"] .board-shortcuts button:hover { background: #c4d5a511; border-color: #c4bc81; }
[data-theme="arcane"] .board-frame {
  padding: clamp(21px, 3vw, 34px);
  isolation: isolate;
  border: 1px solid #968257;
  border-radius: 5px;
  background: url("assets/fantasy/battle-map.svg") center / cover, #243c2d;
  box-shadow: 0 4px 0 #262c20, 0 6px 0 #807050, 0 10px 0 #171e16, 0 16px 0 #8b76542c, 0 32px 60px #020b0766, inset 0 0 0 5px #0c1a13aa, inset 0 0 0 7px #b49a6055, inset 0 0 35px 14px #09170d70;
}
[data-theme="arcane"] .board-frame::before {
  content: "";
  position: absolute;
  inset: 11px;
  pointer-events: none;
  border: 1px solid #b2a27378;
  background: linear-gradient(90deg, #d0bd7c 0 9px, transparent 9px) 0 0 / 27px 2px no-repeat, linear-gradient(0deg, #d0bd7c 0 9px, transparent 9px) 0 0 / 2px 27px no-repeat, linear-gradient(270deg, #d0bd7c 0 9px, transparent 9px) 100% 100% / 27px 2px no-repeat, linear-gradient(180deg, #d0bd7c 0 9px, transparent 9px) 100% 100% / 2px 27px no-repeat;
  z-index: -1;
}
[data-theme="arcane"] .board { border-radius: 0; background: #0d1c1718; box-shadow: inset 0 0 0 1px #d4c6a332; }
[data-theme="arcane"] .cell {
  overflow: visible;
  border-radius: 2px;
  background: linear-gradient(130deg, #a0ac8660, #29352ba6 35%, #25312a8c);
  box-shadow: inset 0 1px 0 #d5d0a83b, inset 1px 0 0 #c6ceb126, inset 0 -2px 0 #06100c55, 0 2px 1px #010b0766;
}
[data-theme="arcane"] .cell:nth-child(3n) { background: linear-gradient(115deg, #86947a50, #263c3096 45%, #17291a8c); }
[data-theme="arcane"] .cell:nth-child(5n) { background: linear-gradient(130deg, #a0a28050, #3d40309c); }
[data-theme="arcane"] .cell.goal-teal { background: linear-gradient(150deg, #9bbe8975, #3c6556aa 45%, #203d29aa); box-shadow: inset 0 2px 0 #91c99b88, inset 0 -2px 0 #101c1580, 0 2px 1px #020c0866; }
[data-theme="arcane"] .cell.goal-coral { background: linear-gradient(150deg, #b39b6d70, #6f4f3e90 45%, #332d248c); box-shadow: inset 0 -2px 0 #c1885788, inset 0 1px 0 #d2c09335, 0 2px 1px #020c0866; }
[data-theme="arcane"] .cell.legal::after { position: relative; width: 32%; aspect-ratio: 1; border: 1px solid var(--active-color); background: #acddb817; border-radius: 1px; transform: rotate(45deg); opacity: .85; box-shadow: 0 0 12px #93d3b154, inset 0 0 4px #ddeab733; }
[data-theme="arcane"] .cell.legal:hover { background: #89bc795e; box-shadow: inset 0 0 0 1px #c7eab09a, 0 0 16px #76b99844; }
[data-theme="arcane"] .cell.path { box-shadow: inset 0 0 0 1px #d5d6a4aa, inset 0 0 20px #7eeebd22; }
[data-theme="arcane"] .cell.path::before { background: #d3ecc0; width: 8%; border-radius: 0; transform: rotate(45deg); box-shadow: 0 0 5px #c1f1ac; }
[data-theme="arcane"] .pawn {
  width: 108%; height: 145%; top: -18%; z-index: 4;
  background: url("assets/fantasy/elf.svg") center bottom / contain no-repeat;
  filter: drop-shadow(0 0 5px #3de0a8cc) drop-shadow(0 0 12px #1a8f6a66) drop-shadow(1px 4px 2px #000b);
}
[data-theme="arcane"] .pawn.coral {
  background-image: url("assets/fantasy/orc.svg");
  filter: drop-shadow(0 0 5px #ff6a45cc) drop-shadow(0 0 12px #c0392b66) drop-shadow(1px 4px 2px #000b);
}
[data-theme="arcane"] .pawn::before, [data-theme="arcane"] .pawn::after,
[data-theme="arcane"] .pawn-mini::before, [data-theme="arcane"] .pawn-mini::after,
[data-theme="arcane"] .winner-pawn::before, [data-theme="arcane"] .winner-pawn::after { content: none; }
[data-theme="arcane"] .pawn-mini {
  flex-basis: 45px; width: 45px; height: 58px; margin: -4px 0;
  background: url("assets/fantasy/elf.svg") center bottom / contain no-repeat;
  filter: drop-shadow(0 0 4px #3de0a8aa) drop-shadow(0 3px 2px #040a08aa);
}
[data-theme="arcane"] .coral .pawn-mini,
[data-theme="arcane"] .pawn-mini.coral {
  background-image: url("assets/fantasy/orc.svg");
  filter: drop-shadow(0 0 4px #ff6a45aa) drop-shadow(0 3px 2px #040a08aa);
}
[data-theme="arcane"] .pawn-victor { filter: drop-shadow(0 0 8px var(--pawn-color)) drop-shadow(0 0 14px var(--pawn-color)) drop-shadow(1px 4px 2px #000b); }
[data-theme="arcane"] .winner-pawn {
  width: 120px; height: 150px; margin: 14px auto 24px;
  background: url("assets/fantasy/elf.svg") center bottom / contain no-repeat;
  filter: drop-shadow(0 0 10px #3de0a888) drop-shadow(0 4px 14px #1a8f6a44);
}
[data-theme="arcane"] .winner-pawn.coral {
  background-image: url("assets/fantasy/orc.svg");
  filter: drop-shadow(0 0 10px #ff6a4588) drop-shadow(0 4px 14px #c0392b44);
}
[data-theme="arcane"] .wall { position: relative; border-radius: 0; box-shadow: none; background: none; overflow: visible; }
[data-theme="arcane"] .wall::before { content: ""; position: absolute; inset: -80% 0 -45%; background: url("assets/fantasy/elf-wall-h.svg") center / 100% 100% no-repeat; filter: drop-shadow(0 2px 1px #04110cab); }
[data-theme="arcane"] .wall.coral::before { background-image: url("assets/fantasy/orc-wall-h.svg"); }
[data-theme="arcane"] .wall[data-orientation="v"]::before { inset: 0 -50% 0 -70%; background-image: url("assets/fantasy/elf-wall-v.svg"); }
[data-theme="arcane"] .wall.coral[data-orientation="v"]::before { background-image: url("assets/fantasy/orc-wall-v.svg"); }
[data-theme="arcane"] .wall.preview { opacity: .68; background: transparent; box-shadow: 0 0 0 1px #d5edb589, 0 0 12px #91bca28a; }
[data-theme="arcane"] .wall.preview::before { filter: drop-shadow(0 0 4px var(--pawn-color)) brightness(1.45); }
[data-theme="arcane"] .wall.preview.invalid { box-shadow: 0 0 0 2px #ee775bc9; }
[data-theme="arcane"] .wall.preview.invalid::before { filter: sepia(1) saturate(5) hue-rotate(325deg) brightness(.9); }
[data-theme="arcane"] .wall-target::after { background: #e5dabd39; }
[data-theme="arcane"] .wall-target[data-invalid="true"]::after, [data-theme="arcane"] .wall-target:disabled::after { background: transparent; }
[data-theme="arcane"] .wall-target:not(:disabled):hover { background: #bfd6a51c; }
[data-theme="arcane"] .board-bottomline { margin-top: 18px; padding: 0; }
[data-theme="arcane"] .board-help { color: #8a9b85; font-size: 11px; margin-left: 0; }
[data-theme="arcane"] .board-fx { image-rendering: auto; }
[data-theme="arcane"] .mode-row { margin-bottom: 15px; border-bottom: 1px solid var(--line); padding-bottom: 15px; height: 47px; }
[data-theme="arcane"] select { background: #19251d; border-radius: 2px; border-color: #87936b50; }
[data-theme="arcane"] .players { gap: 12px; }
[data-theme="arcane"] .player-card { padding: 17px 14px; gap: 10px; position: relative; overflow: hidden; border-radius: 2px; border-color: #687b5850; background: linear-gradient(120deg, #293d2d77, #142019); box-shadow: inset 0 1px 0 #b4c49a18, inset 0 0 30px #5f805311; }
[data-theme="arcane"] .player-card.coral { background: linear-gradient(120deg, #41352b66, #1d2019); border-color: #91725555; }
[data-theme="arcane"] .player-card.active { border-color: #a4c68cb3; background: linear-gradient(120deg, #3a654150, #17271b); box-shadow: inset 3px 0 0 #9ac391, 0 0 20px #93b57209; }
[data-theme="arcane"] .player-card.coral.active { border-color: #c49568b3; background: linear-gradient(120deg, #76492c44, #211e16); box-shadow: inset 3px 0 0 #ce8c62, 0 0 20px #bf79520a; }
[data-theme="arcane"] .player-info h2 { font-family: "Songti SC", "STSong", serif; font-size: 14px; letter-spacing: .06em; }
[data-theme="arcane"] .race-label { display: block; font-family: "Baskerville", serif; font-size: 9px; letter-spacing: .12em; font-weight: 400; margin-bottom: 5px; color: var(--pawn-color); }
[data-theme="arcane"] .wall-count { padding-left: 12px; }
[data-theme="arcane"] .wall-count strong { font-family: "Baskerville", serif; font-size: 29px; font-weight: 400; }
[data-theme="arcane"] .turn-light { box-shadow: 0 0 10px #afdb9d77; }
[data-theme="arcane"] .action-panel { padding-top: 26px; }
[data-theme="arcane"] .direct-guide { padding: 15px; background: #293c263f; border: 1px solid #8e936138; border-radius: 2px; }
[data-theme="arcane"] .direct-guide b { color: var(--brass); }
[data-theme="arcane"] .primary-button { border: 1px solid #98a87599; border-radius: 2px; color: #e5eacc; background: linear-gradient(170deg, #597752, #304b37); box-shadow: inset 0 1px 0 #d1d6a425; }
[data-theme="arcane"] .primary-button:not(:disabled):hover { background: linear-gradient(170deg, #748c5f, #3d6547); }
[data-theme="arcane"] .outline-button { border-radius: 2px; border-color: #8e97734d; background: #a7ad8208; }
[data-theme="arcane"] .outline-button:not(:disabled):hover { background: #a6b37915; border-color: #beb387; }
[data-theme="arcane"] .record h2 { color: #d2c99d; letter-spacing: .08em; }
[data-theme="arcane"] .online-panel, [data-theme="arcane"] .room-card { background: #21322355; border-radius: 2px; }
[data-theme="arcane"] .online-field input, [data-theme="arcane"] .share-link { background: #142019; border-color: #83906a55; border-radius: 2px; }
[data-theme="arcane"] .board-help.error, [data-theme="arcane"] .status.error { color: #e69475; }
[data-theme="arcane"] .page-footer { border-color: #81826732; margin-top: 46px; }
[data-theme="arcane"] .battle-caption { background: #102117ef; border-color: #c8b47a98; color: #ece1b7; border-radius: 1px; box-shadow: 0 3px 15px #06110bab; padding: 10px 17px; letter-spacing: .12em; }
[data-theme="arcane"] dialog { border-radius: 3px; border-color: #ae9f66; background: radial-gradient(ellipse at 20% 0, #42634025, transparent 65%), #172019; box-shadow: inset 0 0 0 4px #ae9f6613, 0 24px 80px #030a0788; }
[data-theme="arcane"] dialog::backdrop { background: #030c08b0; }
[data-theme="arcane"] .dialog-actions { gap: 12px; }

@media (max-width: 1000px) {
  [data-theme="arcane"] .tabletop { width: min(920px, calc(100% - 40px)); }
  [data-theme="arcane"] .game-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 30px; }
}
@media (min-width: 701px) and (max-height: 1000px) {
  [data-theme="arcane"] .topbar { height: 64px; }
  [data-theme="arcane"] .heading { padding: 21px 0 15px; }
  [data-theme="arcane"] h1 { font-size: 54px; }
  [data-theme="arcane"] .realm-banner { padding: 9px 0; margin-bottom: 18px; }
  [data-theme="arcane"] .game-layout { grid-template-columns: minmax(0, min(620px, max(350px, calc(100dvh - 350px)))) 300px; gap: 44px; }
  [data-theme="arcane"] .board-frame { padding: 26px; }
}
@media (min-width: 701px) and (max-height: 800px) {
  [data-theme="arcane"] .topbar { height: 58px; }
  [data-theme="arcane"] .heading { padding: 16px 0 12px; }
  [data-theme="arcane"] h1 { font-size: 47px; }
  [data-theme="arcane"] .realm-banner { padding: 7px 0; margin-bottom: 15px; }
  [data-theme="arcane"] .game-layout { grid-template-columns: minmax(0, min(520px, max(330px, calc(100dvh - 330px)))) 290px; gap: 38px; }
  [data-theme="arcane"] .board-frame { padding: 21px; }
  [data-theme="arcane"] .board-help { margin-top: 8px; }
}
@media (max-width: 700px) {
  .topbar-tools { gap: 12px; }
  .theme-toggle { padding: 7px 9px; font-size: 10px; }
  [data-theme="arcane"] .brand { display: none; }
  [data-theme="arcane"] .tabletop { width: min(550px, calc(100% - 32px)); }
  [data-theme="arcane"] .topbar { height: 62px; }
  [data-theme="arcane"] .heading { padding: 26px 0 17px; align-items: flex-end; }
  [data-theme="arcane"] h1 { font-size: clamp(38px, 10.9vw, 51px); letter-spacing: .08em; }
  [data-theme="arcane"] .heading .eyebrow { font-size: 8px; letter-spacing: .17em; }
  [data-theme="arcane"] .intro { font-size: 10px; letter-spacing: .08em; }
  [data-theme="arcane"] .realm-banner { flex-wrap: wrap; gap: 10px; padding: 10px 0; margin-bottom: 20px; }
  [data-theme="arcane"] .realm-legend { width: 100%; justify-content: space-between; gap: 8px; font-size: 10px; }
  [data-theme="arcane"] .realm-tools { width: 100%; justify-content: space-between; }
  [data-theme="arcane"] .realm-tools button { font-size: 10px; }
  [data-theme="arcane"] .game-layout { grid-template-columns: 1fr; gap: 23px; }
  [data-theme="arcane"] .board-frame { padding: 20px; box-shadow: 0 4px 0 #262c20, 0 6px 0 #807050, 0 10px 0 #171e16, 0 22px 30px #020b0755, inset 0 0 0 4px #0c1a13aa, inset 0 0 0 6px #b49a6055, inset 0 0 20px 8px #09170d70; }
  [data-theme="arcane"] .board-frame::before { inset: 9px; }
  [data-theme="arcane"] .goal-label { font-size: 10px; letter-spacing: .06em; }
  [data-theme="arcane"] .board-topline { gap: 8px; }
  [data-theme="arcane"] .board-shortcuts { gap: 4px; }
  [data-theme="arcane"] .board-shortcuts button { padding: 6px; font-size: 10px; }
  [data-theme="arcane"] .board-bottomline { margin-top: 14px; }
  [data-theme="arcane"] .board-help { margin-top: 6px; font-size: 10px; }
  [data-theme="arcane"] .players { grid-template-columns: 1fr 1fr; gap: 8px; }
  [data-theme="arcane"] .player-card { padding: 13px 9px; gap: 5px; }
  [data-theme="arcane"] .pawn-mini { flex-basis: 32px; width: 32px; height: 45px; }
  [data-theme="arcane"] .player-info h2 { font-size: 11px; letter-spacing: 0; }
  [data-theme="arcane"] .race-label { font-size: 7px; letter-spacing: .03em; margin-bottom: 4px; }
  [data-theme="arcane"] .player-info p { font-size: 9px; }
  [data-theme="arcane"] .wall-count { padding-left: 7px; }
  [data-theme="arcane"] .wall-count strong { font-size: 24px; }
  [data-theme="arcane"] .wall-count span { font-size: 8px; }
  [data-theme="arcane"] .direct-guide { padding: 13px; font-size: 11px; }
  [data-theme="arcane"] .battle-caption { font-size: 9px; padding: 8px 10px; bottom: 15px; letter-spacing: .03em; }
}
@media (max-width: 360px) {
  [data-theme="arcane"] .tabletop { width: calc(100% - 24px); }
  [data-theme="arcane"] .intro { font-size: 9px; }
  [data-theme="arcane"] .board-frame { padding: 17px; }
  [data-theme="arcane"] .pawn-mini { width: 27px; height: 37px; flex-basis: 27px; }
}
