/* Colourful shell; the artwork and per-game palettes live in the generated catalogue. */
:root {
  --paper: #f8f5f4;
  --ink: #302742;
  --muted: #71687c;
  --green: #68429b;
  --green-hover: #50317d;
  --line: #e5dfe9;
  --wash: #f1eaf5;
  --accent: #b23a63;
  --skin-accent: #ffc2da;
}
body { background: radial-gradient(ellipse at 0 15%, #fae4ee 0, transparent 35%), radial-gradient(ellipse at 100% 45%, #e9e4ff 0, transparent 38%), var(--paper); }
.header { background: #fffcfaf2; border-bottom-color: #e9ddeb; }
.brand-icon, .avatar { background: linear-gradient(145deg,#8252b2,#ce608f); color: #fff; }
.button.primary { background: linear-gradient(120deg,#794ab0,#643c92); box-shadow: 0 5px 16px #6d3c9522; }
.button.primary:hover { background: #58327e; }
.hero h1 em { color: #a93369; }
.hero-table { background: linear-gradient(#22173532,#28172d88), url('/media/themes/chess-sakura_samurai/scene.webp') center/cover; border-color: #cc9cac; box-shadow: 0 28px 70px #60315830; }
.hero-table-top, .hero-table-bottom { color: #fff3ef; }
.hero-table-top { background: #21162d96; }
.hero-table-bottom { background: #21162ddd; }
.hero-table-bottom small { color: #ffbfda; }
.hero-board { background: url('/media/themes/chess-sakura_samurai/board.webp') center/100% 100%; border: 7px solid #563046; box-shadow: 0 10px 30px #180d2855; grid-template-rows: repeat(8,minmax(0,1fr)); }
.hero-board .hero-square { background: transparent; min-width: 0; min-height: 0; overflow: hidden; }
.hero-square img { display: block; width: 92%; height: 92%; object-fit: contain; filter: drop-shadow(0 3px 2px #170e2755); }
.floating-note { border-color: #eac5db; background: #fff9fc; }
.floating-note > span { color: #c3467d; }
.values-strip b { color: #b0356d; background: #f8e3ee; }
.game-card { background: #fffcff; border: 1px solid #e6d9eb; border-radius: 16px; overflow: hidden; box-shadow: 0 6px 20px #55346608; transition: transform .2s, box-shadow .2s; }
.game-card:hover { transform: translateY(-5px); box-shadow: 0 15px 30px #55346618; }
.game-card .card-copy { padding: 18px; }
.game-card:nth-child(4n+2) { border-bottom: 3px solid #79b4db; }
.game-card:nth-child(4n+3) { border-bottom: 3px solid #87ba98; }
.game-card:nth-child(4n) { border-bottom: 3px solid #e5ab59; }
.game-card:nth-child(4n+1) { border-bottom: 3px solid #d990b2; }
.discovery-banner { background: linear-gradient(110deg,#352342ee,#472349ad), url('/media/themes/go-jade/scene.webp') center/cover; }
.universe-discovery { margin: 48px 0 65px; }
.universe-gallery { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 20px; }
.universe-card { position: relative; min-height: 260px; border-radius: 16px; overflow: hidden; isolation: isolate; color: white; display: flex; align-items: end; box-shadow: 0 10px 25px #32234720; }
.universe-scene { position: absolute; inset: 0; height: 100%; width: 100%; object-fit: cover; z-index: -2; transition: transform .5s; }
.universe-card::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(transparent 15%,#161326f2); }
.universe-token { position: absolute; width: 90px; height: 100px; object-fit: contain; top: 18px; right: 15px; filter: drop-shadow(0 8px 10px #0008); transform: rotate(8deg); transition: transform .3s; }
.universe-card:hover .universe-token { transform: rotate(0deg) translateY(-5px); }
.universe-card:hover .universe-scene { transform: scale(1.045); }
.universe-card > div { padding: 22px; width: 100%; }
.universe-card small { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #ffddb5; }
.universe-card h3 { font: 27px Georgia,serif; margin: 6px 0 10px; }
.universe-card h3 span { float: right; }
.universe-card p { font-size: 12px; color: #e9deef; line-height: 1.5; }

/* A scenic table, with opaque reading surfaces and no artwork over the rules. */
body.immersive { background: #181626; color: #fbf2ff; }
body.immersive::before { content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: linear-gradient(90deg,#141222bb,#14122270 50%,#141222bd),var(--scene) center/cover; }
.immersive.theme-contrast::before { background: #191724; }
.immersive > .header, .immersive > main, .immersive > .footer { position: relative; }
.immersive .header { height: 80px; }
.immersive .play-page { padding-top: 20px; }
.immersive .play-heading { margin-bottom: 20px; }
.immersive .header { background: #211d30ee; color: #faf0ff; border-bottom: 1px solid #ffffff1f; }
.immersive .main-nav a { color: #e7d8ed; }
.immersive .profile-button { color: #fff0fa; border-color: #ffffff2b; }
.immersive .back-link { color: #eee1f4; }
.immersive .play-heading .eyebrow { color: var(--skin-accent); }
.immersive .play-heading h1 { text-shadow: 0 3px 12px #0006; }
.immersive .icon-button { background: #292139de; border-color: #ffffff35; color: #fff4fd; }
.immersive .game-layout { gap: 30px; }
.immersive .panel { color: var(--ink); background: #fffbfffa; border-color: #ffffff55; box-shadow: 0 10px 30px #090b161a; border-radius: 14px; }
.immersive .guide-panel { background: #f2ebfcfa; }
.immersive .mode-button { background: #faf6fd; border-color: #e1d4ea; }
.immersive .mode-button:hover { background: #f0e3fc; border-color: #ac7ccc; }
.immersive .mode-button:nth-of-type(2) .mode-icon { background: #e2f0f4; color: #256b80; }
.immersive .mode-button:nth-of-type(3) .mode-icon { background: #fbe4ee; color: #a22c61; }
.immersive .mode-button:nth-of-type(4) .mode-icon { background: #f9ecd5; color: #86611a; }
.table-universe { display: flex; align-items: center; gap: 12px; padding: 13px 17px; background: #211b30e8; border: 1px solid #ffffff2b; border-radius: 14px; margin-bottom: 12px; box-shadow: 0 5px 22px #07081222; }
.table-universe small { display: block; font-size: 9px; letter-spacing: .16em; color: #cdbcd8; }
.table-universe strong { font: 22px Georgia,serif; color: #fff2fb; }
.universe-spark { color: var(--skin-accent); font-size: 31px; text-shadow: 0 0 22px var(--skin-accent); }
.table-universe .universe-button { margin-left: auto; background: #fff1f8; color: #472748; border: none; padding: 10px 13px; font-size: 11px; min-height: 42px; }
.immersive .player-bar { color: #fff3fc; padding: 13px 9px; }
.immersive .player-bar small { color: #dfd0e6; }
.immersive .player-avatar { background: #ffe7bd; color: #583824; box-shadow: 0 0 0 3px #fbc96c25; }
.immersive .player-avatar.opponent { background: #493051; color: #ffd9e9; box-shadow: 0 0 0 3px #e89bc333; }
.immersive .side-tag { background: #272033dd; color: #ede2f5; border: 1px solid #ffffff25; }
.immersive .board-frame { padding: 15px; background: linear-gradient(135deg,#ffffff2b,#0005),var(--skin-dark); border: 2px solid var(--skin-accent); box-shadow: 0 0 0 5px #17122088,0 20px 50px #08071066; border-radius: 12px; }
.immersive .turn-status { background: #251e33ee; color: #fff3fc; border: 1px solid #ffffff2c; border-radius: 10px; padding: 13px; margin-top: 9px; }
.immersive .board-controls { background: #211b30df; padding: 12px; border-radius: 10px; }
.immersive .board-controls .text-link { color: #efe2f5; }
.immersive .board-controls .danger { color: #ffb2c7; }
.immersive .special-actions, .immersive .hand, .immersive .move-confirm { color: var(--ink); }
.immersive .footer { color: #daccdf; border-color: #ffffff26; }
.immersive .dialog { color: var(--ink); }
.immersive .toast { background: #fff5fa; color: #432949; border: 1px solid #e6b9d2; }

/* Real textures, never a baked grid stretched onto a different game's geometry. */
.native-art .board { background-color: var(--skin-light); background-image: var(--board-art); background-size: cover; }
.native-art .board.squares .square.light { background: linear-gradient(var(--skin-light),var(--skin-light)); background-color: var(--skin-light); }
.native-art .board.squares .square.dark { background: linear-gradient(var(--skin-dark),var(--skin-dark)); background-color: var(--skin-dark); }
.native-art .board.squares .square::before { content: ''; position: absolute; inset: 0; background: var(--board-art) center/cover; opacity: .22; pointer-events: none; mix-blend-mode: soft-light; }
.native-full-board .board.squares .square { background: transparent; }
.native-full-board .board.squares .square::before { display: none; }
.native-art .board.shogi .square { background: transparent; border-color: var(--skin-line); }
.native-art .board-lines line { stroke: var(--skin-line); stroke-width: 1.5; }
.native-art .board .native-piece { display: grid; place-items: center; width: 86%; height: 86%; font-size: inherit; background: none; border: 0; border-radius: 0; clip-path: none; box-shadow: none; text-shadow: none; filter: drop-shadow(0 3px 2px #09081166); }
.native-art .native-piece .piece-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.piece-image { transform: translate(var(--piece-offset-x, 0%), var(--piece-offset-y, 0%)) scale(var(--piece-scale, 1)); transform-origin: 50% 50%; }
.native-art .board[data-game="go"] .native-piece { width: 90%; height: 90%; }
.native-art .board.shogi .native-piece { width: 85%; height: 93%; }
.native-art .board .piece-glyph { position: relative; z-index: 1; font-size: .52em; line-height: 1.1; font-weight: 700; color: #291824; background: #fff4dfec; text-shadow: none; padding: 1px 3px; border-radius: 5px; }
.native-art .board .side-2 .piece-glyph { color: #fff2da; background: #261526eb; }
.native-art .board.xiangqi .side-1 .piece-glyph { color: #ab1533; }
.native-art .board .piece-glyph.promoted { color: #aa123c; background: #fff1d9; }
.native-art .board .long-label .piece-glyph { font-size: .37em; }
.native-art .board .piece-badge { position: absolute; right: -5%; bottom: -3%; min-width: 48%; padding: 2px; border: 1px solid #fff8eb; border-radius: 30%; color: #fff8dd; background: #342339; font-size: .4em; font-weight: 800; line-height: 1.1; text-align: center; text-shadow: none; box-shadow: 0 2px 4px #0006; }
.native-art .board.mancala .piece-badge, .native-art .board.track .piece-badge { font-size: .55em; right: 8%; bottom: 0; }
.native-art .board .coord { z-index: 3; color: #fffbe8; background: #221b32c9; opacity: 1; padding: 1px 2px; border-radius: 2px; font-size: 8px; }
.native-art .board .square.selected { background-color: #f3c958 !important; box-shadow: inset 0 0 0 4px #fff0a2,inset 0 0 0 6px #654723 !important; }
.native-art .board .square.destination::after { background: #ffcf67; box-shadow: 0 0 0 3px #282034,0 0 0 5px #fff4dc; }
.native-art .board .square.destination.side-1::after, .native-art .board .square.destination.side-2::after { background: transparent; border-color: #ffdd80; box-shadow: 0 0 0 2px #282034; }
.native-art .board .square.last-move { box-shadow: inset 0 0 0 3px #ffd868; }
.native-art .board.track .square, .native-art .board.cross_track .square { background-color: var(--skin-light); }
.native-art .board.track .square:nth-child(2n) { background-color: var(--skin-dark); }
.native-art .board[data-game="tafl"] .square.special { background-color: #ffc568; box-shadow: inset 0 0 0 3px #6c3c21; }
.native-art .board.cross_track .square.special { background-color: #fbe394; border: 2px solid #7b381e; }
.native-art .board.mancala .square { background: #21132bbd; }

/* Exact game/theme production-board previews, not unrelated sample stones. */
.themes-dialog { width: min(860px, calc(100vw - 30px)); max-width: 860px; padding: 32px; background: #fff9fd; }
.themes-dialog > .muted { max-width: 650px; margin: 12px 0 22px; }
.theme-options { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin: 25px 0; }
.theme-option { position: relative; min-width: 0; background: white; border: 2px solid #e4d7e9; border-radius: 12px; padding: 5px; text-align: left; transition: transform .15s,border-color .15s; }
.theme-option:hover { transform: translateY(-3px); border-color: #a76fb9; }
.theme-option[aria-pressed="true"] { border-color: #8d3a9d; background: #f6e5fa; box-shadow: 0 0 0 2px #8d3a9d25; }
.theme-preview { position: relative; display: block; height: 156px; border-radius: 7px; overflow: hidden; background: #251b34; }
.theme-preview > img { width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.theme-option > strong { display: block; padding: 10px 5px 7px; font-size: 12px; line-height: 1.35; }
.theme-check { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; display: none; place-items: center; border-radius: 50%; color: white; background: #813795; border: 2px solid white; font-size: 13px; }
.theme-option[aria-pressed="true"] .theme-check { display: grid; }
@keyframes table-arrive { from { opacity: .5; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduce-motion) .table-universe, body:not(.reduce-motion) .hero-table { animation: table-arrive .65s ease-out; }
}
.reduce-motion *, .reduce-motion *::before { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
@media (max-width: 1050px) {
  .universe-gallery { gap: 12px; }
  .universe-card { min-height: 245px; }
  .universe-card > div { padding: 16px; }
  .universe-card h3 { font-size: 23px; }
}
@media (min-width: 1051px) {
  .immersive:not(.zen) .board-area { width: 100%; max-width: 650px; margin-inline: auto; }
}
@media (max-width: 780px) {
  .universe-gallery { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .universe-discovery { margin: 35px 0; }
  .immersive .game-layout { gap: 20px; }
  .immersive .board-frame { padding: 7px; border-width: 1px; }
  .table-universe { padding: 10px; gap: 8px; }
  .table-universe strong { font-size: 19px; }
  .table-universe .universe-button { font-size: 10px; padding: 9px; }
  .universe-spark { font-size: 26px; }
  .theme-options { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .themes-dialog { padding: 24px 18px; }
  .theme-preview { height: 144px; }
  .native-art .board .coord { font-size: 7px; }
  .immersive .player-bar { padding: 12px 3px; }
  .immersive #setup { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 17px; }
  .immersive #setup > :not(.mode-button) { grid-column: 1/-1; }
  .immersive #setup h2 { font-size: 25px; margin-bottom: 0; }
  .immersive #setup .mode-button { min-width: 0; margin: 0; padding: 10px; gap: 5px; align-items: start; }
  .immersive #setup .mode-button > .mode-icon, .immersive #setup .mode-button > span:last-child { display: none; }
  .immersive #setup .mode-button strong { font-size: 11px; }
  .immersive #setup .mode-button small { font-size: 10px; line-height: 1.4; }
  .immersive #setup .service-note { margin-top: 2px; padding: 8px; }
}
@media (max-width: 480px) {
  .immersive .header { height: auto; min-height: 100px; }
  .game-card .card-copy { padding: 11px; }
  .universe-card h3 { font-size: 21px; }
  .universe-card p { font-size: 11px; }
}

/* A narrow desktop panel is still a desktop: never select low-resolution
   portrait artwork from width alone. Keep Unity panoramas on mouse devices. */
body.immersive::before {
  background: linear-gradient(90deg,#14122278,#14122235 50%,#14122282),var(--scene) center/cover;
}
.immersive.theme-contrast::before { background: #191724; }
.native-art.has-native-frame .board-frame {
  padding: 0;
  border: clamp(18px,3vw,38px) solid transparent;
  border-image-source: var(--arena-frame);
  border-image-slice: var(--frame-slice);
  border-image-repeat: stretch;
  /* Continue the table material under the transparent inner lip of each frame. */
  background: var(--skin-dark) var(--board-art) center/cover;
  border-radius: 12px;
  box-shadow: 0 18px 45px #07091155;
}
.native-art.has-square-art .board.squares .square.light { background: var(--square-light) center/100% 100%; }
.native-art.has-square-art .board.squares .square.dark { background: var(--square-dark) center/100% 100%; }
.native-art.has-square-art .board.squares .square::before { display: none; }
.native-art.has-square-art .board-frame { background: var(--skin-dark); }
.native-art.board-wash .board {
  background-image: linear-gradient(color-mix(in srgb,var(--skin-light) 72%,transparent),color-mix(in srgb,var(--skin-light) 72%,transparent)),var(--board-art);
}
.native-art .board .native-piece { filter: drop-shadow(0 2px 1px #09081166); }
.native-art .board .native-piece .piece-image { filter: none; }
.native-art.has-native-frame .board-frame:has(.board.track) { border-width: 20px 32px; border-radius: 60px; }
.native-art .board-frame:not(.shaped-table) .board.track { aspect-ratio: 5 !important; }
.immersive .special-actions:not(:empty), .immersive .hand:not(:empty) { background: #fff5fa; padding: 12px; border-radius: 10px; }
.immersive .play-heading .eyebrow { text-shadow: 0 1px 4px #080613,0 0 12px #080613; }
@media (max-width: 780px) {
  .immersive.theme-contrast::before { background: #191724; }
  .native-art.has-native-frame .board-frame { border-width: 16px; }
  .native-art.has-native-frame .board-frame:has(.board.track) { border-width: 14px 18px; }
}
@media (max-width: 780px) and (hover: none) and (pointer: coarse) {
  body.immersive::before { background: linear-gradient(#14122265,#14122296),var(--scene-mobile,var(--scene)) center/cover; }
  .immersive.theme-contrast::before { background: #191724; }
}
