@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;600;700;800&display=swap");

:root { color-scheme: dark; font-family: Manrope, sans-serif; color: #e8e2d5; background: #101313; font-synthesis: none; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% 32%, #202a29 0, #101313 60%); }
button, input { font: inherit; }
button { border: 1px solid #536157; border-radius: 3px; color: #e8e2d5; background: #202a28; cursor: pointer; padding: 11px 15px; transition: background .15s, border-color .15s; }
button:hover:not(:disabled) { border-color: #c9a662; background: #293532; }
button:disabled { cursor: not-allowed; opacity: .45; }
[hidden] { display: none !important; }
.shell { width: min(1180px, 100%); margin: 0 auto; padding: 34px 28px 48px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.eyebrow { color: #8a9990; font: 500 10px "DM Mono", monospace; letter-spacing: .16em; margin: 0 0 8px; }
h1 { font-size: clamp(34px, 5vw, 50px); letter-spacing: -.07em; margin: 0; line-height: 1; }
h1 span, .intro h2 span { color: #d2a85a; }
.panel { border: 1px solid #35413d; border-radius: 5px; background: rgba(25, 32, 31, .9); box-shadow: 0 24px 80px #0003; }
.home { min-height: 440px; display: grid; grid-template-columns: 1fr 340px; align-items: center; gap: 60px; padding: clamp(28px, 7vw, 78px); }
.intro h2 { font-size: clamp(35px, 6vw, 62px); line-height: 1.08; letter-spacing: -.065em; margin: 0 0 20px; }
.intro > p:last-child, .help-copy { color: #aab4ab; font-size: 14px; line-height: 1.8; max-width: 480px; }
.lobby-controls { display: grid; gap: 12px; }
.primary { background: #c9a662; border-color: #c9a662; color: #171a17; font-weight: 800; padding: 14px; }
.primary:hover:not(:disabled) { background: #e0bd75; border-color: #e0bd75; }
.join-row { display: flex; gap: 8px; }
input { min-width: 0; flex: 1; border: 1px solid #35413d; background: #141a18; border-radius: 3px; color: #e8e2d5; padding: 11px; text-transform: uppercase; letter-spacing: .12em; }
input:focus { outline: 1px solid #c9a662; }
.notice { min-height: 20px; margin: 8px 0 0; color: #d8b56c; font-size: 12px; line-height: 1.5; }
.game-layout { display: grid; grid-template-columns: minmax(0, 760px) 320px; justify-content: center; gap: 16px; align-items: stretch; }
.board-panel { padding: clamp(12px, 2.5vw, 24px); }
.board-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 0 2px 18px; }
.board-toolbar .eyebrow { margin-bottom: 5px; }
.board-toolbar h2 { font-size: 17px; margin: 0; font-weight: 700; }
.toolbar-actions { display: flex; gap: 8px; }
.secondary { padding: 8px 10px; font-size: 11px; white-space: nowrap; }
.board-area { display: flex; flex-direction: column; gap: 7px; }
.board-area > [data-clock-role="host"] { order: 2; }
.board-area > [data-clock-role="guest"] { order: 0; }
.board-area > .board { order: 1; }
.board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); width: 100%; aspect-ratio: 1; border: 5px solid #252d29; box-shadow: 0 10px 36px #0005; }
.square { border: 0; border-radius: 0; padding: 0; display: grid; place-items: center; position: relative; aspect-ratio: 1; font-family: Georgia, "Times New Roman", serif; font-size: clamp(23px, 6.5vw, 66px); line-height: 1; user-select: none; }
.square.light { background: #d6c9a9; color: #18201b; }
.square.dark { background: #65806d; color: #f0e8d2; }
.square.threatened { background-image: linear-gradient(rgba(190, 48, 48, .22), rgba(190, 48, 48, .22)); }
.square.fogged, .square.fogged:hover:not(:disabled) { filter: none; opacity: 1; cursor: default; }
.square.fogged::before { display: none; }
.square.fogged::after { content: ""; position: absolute; inset: 0; z-index: 3; background: rgba(8, 13, 14, .48); pointer-events: none; }
.square:hover:not(:disabled) { filter: brightness(1.12); }
.square.selected { box-shadow: inset 0 0 0 4px #e4ba5e; z-index: 1; }
.square.last-move::after { content: ""; position: absolute; inset: 0; background: #e4c85b55; pointer-events: none; }
.square.legal::before, .square.build-legal::before { content: ""; position: absolute; width: 24%; aspect-ratio: 1; border-radius: 50%; background: #18201855; z-index: 1; }
.square.legal:has(.piece-image)::before { width: 88%; border: 5px solid #18201866; background: transparent; }
.square.build-legal { box-shadow: inset 0 0 0 3px #d7aa4d; z-index: 1; }
.square.build-legal::before { width: 38%; background: #d7aa4dcc; box-shadow: 0 0 0 3px #332b19; }
.piece-image {
  position: relative;
  z-index: 2;
  display: block;
  width: 92%;
  height: 92%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.remembered-piece { opacity: .32; filter: grayscale(.65); }
.clock-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto auto 10px; align-items: center; gap: 9px; min-height: 38px; padding: 5px 10px; border: 1px solid #35413d; border-radius: 3px; background: #151c19; color: #aab4ab; }
.clock-row.active { border-color: #c9a662; background: #211f18; }
.clock-row b { overflow: hidden; color: #e8e2d5; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.clock-color { color: #8a9990; font: 9px "DM Mono", monospace; text-transform: uppercase; }
.player-clock { min-width: 48px; color: #e8e2d5; font: 700 15px "DM Mono", monospace; font-variant-numeric: tabular-nums; text-align: right; }
.player-clock.low-time { color: #e98771; }
.build-panel { margin: 10px 0 0; padding: 0; border: 0; background: transparent; }
.build-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.build-group-title { grid-column: 1 / -1; margin: 6px 0 0; color: #8a9990; font: 10px "DM Mono", monospace; letter-spacing: .14em; }
.build-option { position: relative; display: grid; grid-template-rows: minmax(42px, 1fr) auto; justify-items: center; align-content: center; gap: 3px; min-width: 0; min-height: 72px; padding: 5px 4px; border-color: #46534b; background: linear-gradient(145deg, #26312c, #171e1b 75%); text-align: center; }
.build-option:hover:not(:disabled) { background: linear-gradient(145deg, #354239, #202924 75%); }
.build-option:disabled { opacity: .55; }
.build-option.active { border-color: #e4ba5e; box-shadow: inset 0 0 0 1px #e4ba5e, 0 0 12px #d7aa4d55; }
.build-sprite { width: 44px; height: 44px; object-fit: contain; }
.build-name { max-width: 100%; overflow: hidden; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.build-cost-corner { position: absolute; top: 4px; right: 5px; padding: 2px 4px; border: 1px solid #92753e; border-radius: 2px; background: #171a16ed; color: #f0cb73; font: 9px "DM Mono", monospace; }
.build-hotkey { position: absolute; top: 3px; left: 4px; padding: 1px 4px; border: 1px solid #68776e; border-radius: 2px; background: #111916e8; color: #d5ded7; font: 9px "DM Mono", monospace; }
.gold-readout { margin: 14px 0 0; padding: 9px 10px; border: 1px solid #594a2d; background: #141916; color: #f0cb73; font: 11px "DM Mono", monospace; }
.settings-dialog { width: min(420px, calc(100vw - 28px)); max-height: 85vh; padding: 0; border: 1px solid #536157; border-radius: 5px; background: #19201f; color: #e8e2d5; box-shadow: 0 24px 90px #000a; }
.settings-dialog::backdrop { background: #080c0bd9; }
.settings-content { display: grid; gap: 16px; padding: 22px; }
.hotkey-settings { display: grid; gap: 8px; }
.hotkey-row { display: grid; grid-template-columns: 1fr 100px; align-items: center; gap: 12px; color: #b9c2ba; font-size: 12px; }
.hotkey-row input { flex: initial; width: 100%; padding: 7px 9px; text-align: center; letter-spacing: .05em; cursor: pointer; }
.side-panel { display: flex; flex-direction: column; align-self: stretch; padding: 18px 16px; }
.color-chip { width: 19px; height: 19px; border-radius: 50%; }.white-chip { background: #e5dbc1; border: 1px solid #968c73; }.black-chip { background: #272e2b; border: 1px solid #a89e82; }
.turn-marker { width: 8px; height: 8px; border-radius: 50%; background: transparent; }.turn-marker.active { background: #73b688; box-shadow: 0 0 10px #73b688; }
.divider { border-top: 1px solid #35413d; margin: 22px 0; }.help-copy { font-size: 11px; margin: 8px 0 14px; }
.piece-credit { margin-top: auto; color: #b9a77d; font-size: 10px; line-height: 1.6; text-underline-offset: 2px; }
.credits-back { color: #b9a77d; font: 11px "DM Mono", monospace; text-underline-offset: 3px; }
.credits-content { max-width: 760px; padding: clamp(22px, 5vw, 48px); }
.credits-content h2 { margin: 0 0 20px; font-size: clamp(22px, 4vw, 32px); }
.credits-content p:not(.eyebrow) { color: #aab4ab; font-size: 14px; line-height: 1.8; }
.credits-content a { color: #d2b46f; text-underline-offset: 3px; }
.credits-content code { color: #e8e2d5; font: 12px "DM Mono", monospace; }
.leave-link { display: block; width: 100%; margin-top: 12px; color: #9aa79e; background: transparent; font-size: 11px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 850px) { .shell { padding: 22px 14px 36px; }.home { grid-template-columns: 1fr; gap: 25px; padding: 32px 24px; }.game-layout { grid-template-columns: minmax(0, 700px); }.side-panel { min-height: 0; }.side-panel > .piece-credit { margin-top: 18px; } }
@media (max-width: 520px) { .shell { padding: 18px 10px 28px; }.topbar { align-items: start; flex-direction: column; gap: 12px; margin-bottom: 20px; }.tagline { margin: 0; }.board-toolbar { align-items: flex-start; }.toolbar-actions { flex-direction: column; }.square { font-size: clamp(25px, 10vw, 48px); }.board { border-width: 3px; }.side-panel { padding: 16px 13px; }.clock-row { gap: 6px; padding: 5px 7px; }.clock-row b { font-size: 10px; }.player-clock { min-width: 42px; font-size: 14px; }.build-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }.build-sprite { width: 40px; height: 40px; }.build-option { min-height: 68px; } }