/* Janggi at night — walnut game table, hanji records, warm lantern light.
   Scoped to the Janggi dark theme: preserve wooden board, hit targets,
   3D renderer, established header controls, game rules and light mode. */
html[data-theme="dark"] body.standalone-hub-page-janggi {
  --deep:#192c25;--green:#41654b;--paper:#1c231e;
  --ink:#f1e4cc;--muted:#c2b49d;--line:#705b43;
  --gold:#d6b477;--red:#d78a77;--wood:#ca9b63;
  min-height:100vh;
  color:var(--ink);
  background:
    radial-gradient(ellipse 82% 31% at 50% 0%,#94734a30 0%,transparent 82%),
    repeating-linear-gradient(90deg,transparent 0 80px,#b2905610 81px 82px,transparent 83px 160px),
    linear-gradient(180deg,#312c24,#242820 340px,#1c241e);
}

/* Traditional hanging scroll over the table, lit softly from the top. */
html[data-theme="dark"] body.standalone-hub-page-janggi .layout {
  max-width:1260px;padding:25px 22px 48px;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .intro {
  isolation:isolate;position:relative;overflow:hidden;min-height:166px;
  margin-bottom:23px;padding:24px 37px;border-radius:3px;
  border:1px solid #866442;
  border-left:8px solid #815b36;border-right:8px solid #815b36;
  background:
    radial-gradient(ellipse at 29% -5%,#ab8a5957,transparent 71%),
    repeating-linear-gradient(0deg,transparent 0 7px,#e0b98606 8px 9px),
    linear-gradient(112deg,#3d382b,#292e27 80%,#303327);
  box-shadow:inset 0 0 0 4px #c4a47818,0 5px 0 #100d0b66,0 14px 24px #080c0980;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .intro::before {
  content:"";position:absolute;inset:0 0 0 auto;width:38%;
  z-index:-1;pointer-events:none;opacity:.17;
  background:
    linear-gradient(45deg,transparent 47%,#dbb77c 48% 51%,transparent 52%) 0 0/56px 56px,
    linear-gradient(-45deg,transparent 47%,#dbb77c 48% 51%,transparent 52%) 0 0/56px 56px;
  mask-image:linear-gradient(90deg,transparent,#000 64%);
}
html[data-theme="dark"] body.standalone-hub-page-janggi .kicker {
  color:#e2bc80;letter-spacing:.075em;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .intro h1 {
  font-family:"Iowan Old Style","AppleMyungjo","Batang",serif;
  font-size:clamp(30px,4vw,49px);
  color:#faf0db;
  text-shadow:0 2px 4px #15120e7a;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .intro h1 em {color:#eab08c}
html[data-theme="dark"] body.standalone-hub-page-janggi .intro-main>p:last-child {
  color:#ddd3bf;line-height:1.8;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .intro-mark {
  display:flex;align-items:center;justify-content:center;position:relative;
  min-width:192px;min-height:110px;
  color:#ecd7ad;font-family:"AppleMyungjo","Batang",serif;
  filter:none;text-shadow:0 3px 7px #14150ed9;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .intro-mark::before {
  content:"";position:absolute;inset:6px 0;
  border-block:1px solid #c8a4777a;pointer-events:none;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .intro-mark span {color:#dc9c78}

/* Walnut table: visual continuity with the light theme's wooden desk.
   Board canvas, intersections, letters and carved counters stay unchanged. */
html[data-theme="dark"] body.standalone-hub-page-janggi .game-layout {
  grid-template-columns:minmax(0,725px) minmax(290px,1fr);
  gap:23px;padding:20px;border:1px solid #936940;border-radius:4px;
  background:
    repeating-linear-gradient(92deg,transparent 0 38px,#130c0870 39px,#d8a8750b 42px,transparent 45px 95px),
    radial-gradient(ellipse at 48% 0%,#88644372,transparent 75%),
    linear-gradient(110deg,#4f3625,#704b30 43%,#412f25);
  box-shadow:inset 0 2px 0 #d8af7857,inset 0 0 0 5px #26190e88,
    0 5px 0 #291b13,0 20px 35px #070b09b8;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .game-column {filter:none}
html[data-theme="dark"] body.standalone-hub-page-janggi .player-bar {
  min-height:66px;padding:9px 15px;
  border:1px solid #8d6b47;border-radius:3px 3px 0 0;
  color:#f5e6c8;
  background:linear-gradient(112deg,#42382a,#302f28);
  box-shadow:inset 0 0 0 2px #c4a57824;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .player-bar.han {border-left:5px solid #bd6555}
html[data-theme="dark"] body.standalone-hub-page-janggi .player-bar.cho {
  border-left:5px solid #78b48a;border-radius:0 0 3px 3px;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .player-bar.active {
  border-top-color:#c7a06d;border-right-color:#c7a06d;border-bottom-color:#c7a06d;
  background:linear-gradient(112deg,#5c4a31,#3b3d2d);
  box-shadow:inset 0 0 0 2px #d3b17d35,0 0 0 2px #e7bd7061;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .player-bar strong {color:#f4e6c9}
html[data-theme="dark"] body.standalone-hub-page-janggi .player-bar :is(small,.material) {color:#d6c19e}
html[data-theme="dark"] body.standalone-hub-page-janggi .board-shell {border-color:#492917}
html[data-theme="dark"] body.standalone-hub-page-janggi .under-board {
  margin-top:28px;margin-bottom:8px;color:#efe1c4;
  text-shadow:0 1px 3px #1e120b;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .legend-target {border-color:#a9d6ab}

/* Board-view controls must stay readable against the original warm board frame. */
html[data-theme="dark"] body.standalone-hub-page-janggi .janggi-board-modes {
  background:#c3a47a;border-color:#7a5632;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .janggi-board-modes button:not([aria-pressed="true"]) {
  color:#47301c;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .janggi-board-modes button[aria-pressed="true"] {
  background:#264838;color:#fff2cf;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .janggi-facing-settings {
  background:#403b2c;border-color:#a2875c;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .janggi-facing-settings>span,
html[data-theme="dark"] body.standalone-hub-page-janggi .janggi-facing-settings small {color:#eddfc3}
html[data-theme="dark"] body.standalone-hub-page-janggi .janggi-facing-settings button:not([aria-pressed="true"]) {
  color:#fff0cd;background:#56442e;border-color:#aa8a5e;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .janggi-3d-stage {
  background:radial-gradient(ellipse at 50% 35%,#455b45,#16231d 83%);
  border-color:#ae8b5f;
}

/* Dark-hanji score sheets, old gold edges, warm text. */
html[data-theme="dark"] body.standalone-hub-page-janggi .sidebar {gap:14px}
html[data-theme="dark"] body.standalone-hub-page-janggi .panel {
  position:relative;padding:21px;border-radius:3px;
  border:1px solid #917652;color:#eee2ca;
  background:
    repeating-linear-gradient(0deg,transparent 0 29px,#e5c49207 30px 31px),
    linear-gradient(154deg,#39382b,#2b342c);
  box-shadow:inset 0 0 0 4px #c9a87919,0 4px 0 #1d1b14b3,0 10px 18px #0c120d82;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .panel h2 {
  color:#f2e5cb;font:700 21px/1.35 "AppleMyungjo","Batang",serif;
}
html[data-theme="dark"] body.standalone-hub-page-janggi :is(
  .panel-note,.formation-help,.notice,.sound-footnote,.sound-credit,.status-heading>span,
  .volume-title,.sound-credit a
) {color:#d6c6aa}
html[data-theme="dark"] body.standalone-hub-page-janggi .mode-switch {
  background:#272a22;border:1px solid #766147;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .mode:not(.active) {color:#e1d2b9}
html[data-theme="dark"] body.standalone-hub-page-janggi :is(.mode.active,.primary) {
  color:#fff2d5;
  background:linear-gradient(125deg,#38634b,#244335);
  border-color:#638665;
}
html[data-theme="dark"] body.standalone-hub-page-janggi :is(.settings label,.formation) {color:#e0d0b3}
html[data-theme="dark"] body.standalone-hub-page-janggi :is(.settings select,.formation select) {
  color:#f7e7ca;
  background:#242f29;border-color:#8b7759;color-scheme:dark;
}
html[data-theme="dark"] body.standalone-hub-page-janggi :is(
  .actions button,.sound-button:not([aria-pressed="true"])
) {
  background:#333a30;color:#f2dec0;border-color:#887456;
}
html[data-theme="dark"] body.standalone-hub-page-janggi :is(
  .actions button:not(:disabled):hover,.sound-button:not([aria-pressed="true"]):hover
) {background:#465443;border-color:#c09b68}
html[data-theme="dark"] body.standalone-hub-page-janggi .sound-button[aria-pressed="true"] {
  background:#344d3d;color:#e2efd6;border-color:#719a7a;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .sound-emblem {
  background:#55452d;color:#f2ce8b;border-color:#b09566;
}
html[data-theme="dark"] body.standalone-hub-page-janggi :is(#audio-volume-value,#audio-effects-volume-value) {color:#e8c58c}
html[data-theme="dark"] body.standalone-hub-page-janggi :is(#audio-volume,#audio-effects-volume) {accent-color:#b9c89a}
html[data-theme="dark"] body.standalone-hub-page-janggi .turn-label {
  border-radius:3px;color:#e0f4dc;border-color:#729677;background:#2b4b3a;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .turn-label.check {
  background:#58372c;border-color:#b37a60;color:#ffe0c5;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .turn-label.end {
  background:#57452b;border-color:#9d8658;color:#f8e5b9;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .history {
  color:#e4d6bd;background:#273029;border-top-color:#786448;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules summary {min-height:54px;color:#f2e1c5}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-kicker {color:#dcb87d}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-summary-sub {color:#cabaa1}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-toggle-mark {color:#dcb87d}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-body {
  border-top-color:#796549;color:#e0d0b8;
}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-callout {background:#262f28;border-color:#7d684b;color:#e8d9c1}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-callout strong {color:#f0cf97}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-section {border-top-color:#79654988}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-section-title {color:#efd09a}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-section-note {color:#c7b79e}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-body dt {color:#e4c897}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-piece-val {background:#383226;border-color:#8b7352;color:#efd09b}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-detail-list li {background:#273029;border-color:#786448;color:#e4d5be}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-detail-list li strong {color:#efd09a}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-guide-chips li {background:#262e27;border-color:#756146;color:#e3d4bd}
html[data-theme="dark"] body.standalone-hub-page-janggi .rules-guide-chips li b {color:#f0cf97}
html[data-theme="dark"] body.standalone-hub-page-janggi footer {color:#d4c3a7}
html[data-theme="dark"] body.standalone-hub-page-janggi footer a {color:#e1c38d}

/* A matching walnut head rail without altering the shared header structure. */
html[data-theme="dark"] body.standalone-hub-page-janggi .ug-header {
  background:linear-gradient(90deg,#222b25,#2f342a,#222b25);
  border-bottom:1px solid #806341;
}
html[data-theme="dark"] body.standalone-hub-page-janggi :is(
  .ug-back,.ug-identity,.ug-header .ug-title,.ug-header .ug-subtitle
) {color:#f1e2c6}

/* Layout parity with the light-theme Janggi room. */
@media(max-width:1060px) {
  html[data-theme="dark"] body.standalone-hub-page-janggi .layout {padding-inline:14px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .game-layout {
    grid-template-columns:minmax(0,1fr) minmax(265px,.72fr);gap:16px;padding:15px;
  }
  html[data-theme="dark"] body.standalone-hub-page-janggi .intro {padding:22px 24px}
}
@media(max-width:720px) {
  html[data-theme="dark"] body.standalone-hub-page-janggi .layout {padding:14px 8px 32px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .intro {
    min-height:0;margin:0 4px 14px;padding:19px;border-left-width:5px;border-right-width:5px;
  }
  html[data-theme="dark"] body.standalone-hub-page-janggi .intro h1 {font-size:29px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .intro-mark {display:none}
  html[data-theme="dark"] body.standalone-hub-page-janggi .game-layout {
    display:block;padding:7px 5px 13px;
    box-shadow:inset 0 1px 0 #b89264,0 4px 0 #291b13,0 10px 15px #0b100ca1;
  }
  html[data-theme="dark"] body.standalone-hub-page-janggi .player-bar {min-height:60px;padding:8px 10px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .board-shell {padding:7px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .sidebar {margin:22px 3px 0}
  html[data-theme="dark"] body.standalone-hub-page-janggi .panel {padding:18px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .rules {padding:0}
  html[data-theme="dark"] body.standalone-hub-page-janggi .rules summary {padding:18px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .rules-body {padding:0 18px 18px}
}
@media(max-width:390px) {
  html[data-theme="dark"] body.standalone-hub-page-janggi .layout {padding-inline:5px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .intro {margin-inline:3px;padding:16px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .game-layout {padding-inline:3px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .board-shell {padding:4px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .panel {padding:15px}
  html[data-theme="dark"] body.standalone-hub-page-janggi .rules {padding:0}
}
