﻿:root{
  --cell: clamp(30px, 8vw, 52px);
  --gap: 2px;
  --pad: 8px;
  --coord: 16px;
}

/* ---------- Buttons ---------- */
.btn{
  padding:6px 12px;
  border-radius:8px;
  background: var(--accent, #E2B76F);
  color:#000;
  text-decoration:none;
  font-size:14px;
  border:1px solid transparent;
}
.btn.ghost{
  background: transparent;
  color: var(--accent, #E2B76F);
  border:1px solid var(--accent, #E2B76F);
}
.btn-user.btn.ghost{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p20), #ffffff);
}
.btn.active{
  background: var(--accent, #E2B76F);
  color:#000;
  border-color:transparent;
}

/* ---------- Chess Layout ---------- */
.chess-page{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
  transform: translateY(-12px);
}
.chess-play-card{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p10), #ffffff);
  border: var(--accent, #E2B76F); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p30), #ffffff);
  border-radius:18px;
  padding:14px 14px 12px;
  box-shadow: 0 16px 36px rgba(31,20,10,0.12);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  width: min(800px, calc(100vw - 24px));
  min-height: 540px;
  position: relative;
}
.top-actions{
  width: 100%;
  display:flex;
  justify-content:center;
  margin-top: 8px;
}
.chipbar{
  width: 100%;
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap:10px;
  padding: 2px 2px 4px;
}
.chipbar-left,
.chipbar-right{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:9px 12px;
  border-radius:12px;
  border:1px solid color-mix(in srgb, var(--accent, #E2B76F) 26%, #ffffff);
  background: #ffffff;
  color:#1d2214;
  font-weight:800;
  font-size:13px;
  line-height:1.1;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #E2B76F) 18%, #ffffff);
  text-decoration:none;
}
.chip-action{
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.chip-action:hover{
  transform: translateY(-1px);
  box-shadow: 0 9px 18px rgba(0,0,0,0.14);
  background: color-mix(in srgb, var(--accent, #E2B76F) 12%, #ffffff);
}
.chip-move{
  background: #ffffff;
  border-color: color-mix(in srgb, var(--accent, #E2B76F) 26%, #ffffff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #E2B76F) 18%, #ffffff);
}
.chip-info{
  background: color-mix(in srgb, var(--accent, #E2B76F) 65%, #fff7d8);
  border-color: color-mix(in srgb, var(--accent, #E2B76F) 50%, #ffffff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #E2B76F) 45%, #ffffff);
}

.turn-indicator{
  height:34px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
  font-weight:600;
  color:#111;
  -webkit-user-select:none;
  -ms-user-select:none;
  user-select:none;
  position:relative;
  z-index:10;
}
.turn-indicator.is-empty{ visibility:hidden; }

/* ---------- Chess (Auth-like) ---------- */
.chess-shell{
  min-height: auto;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:12px 16px 48px;
  background:
    radial-gradient(
      1200px 600px at 80% 0%,
      color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff) 0%,
      transparent 60%
    ),
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff) 0%,
      color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff) 45%,
      color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff) 100%
    );
}

.chess-card{
  width: min(920px, 96vw);
  padding: 24px 24px 20px;
  border-radius: 24px;
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff);
  border: var(--accent, #caa48a); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  box-shadow: 0 18px 50px rgba(31,20,10,0.1);
  backdrop-filter: blur(10px);
}

.turn-indicator{
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff);
  border: var(--accent, #caa48a); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  border-radius: 999px;
  padding: 6px 14px;
}

.bottom-actions{
  margin-top: 10px;
}

.chess-replay-session{
  /* margin-top: 12px; */
  font-size: 11px;
  color: #8a7c72;
  font-weight: 500;
  text-align: center;
}

.chess-center{
  display:flex;
  justify-content:center;
  align-items:flex-start;
  padding-top:8px;
}

/* Lower preview board in settings without stretching card */
.settings-center .board{
  transform: translateY(22px);
}

.chess-layout{
  width: 100%;
  display:grid;
  grid-template-columns: minmax(0, 0.35fr) max-content minmax(0, 0.65fr);
  column-gap: 12px;
  align-items: center;
}

.chess-spacer{
  width: 12px;
}

.chess-side{
  width: 170px;
  height: auto;
  display:flex;
  flex-direction:column;
  gap:18px;
  align-items:center;
  justify-content:center;
  transform: translateY(0);
  padding: 8px 0;
}

.chess-entry-card{
  cursor: default;
  aspect-ratio: auto;
  width: 170px;
  min-height: calc((8 * var(--cell) + 7 * var(--gap) + 2 * var(--pad)) / 4 + 12px);
  padding: 10px 8px;
  gap: 8px;
  text-align: center;
}

.chess-entry-card.is-clickable{
  cursor: pointer;
}

.chess-entry-card.is-active{
  border-color: var(--accent, #caa48a); /* fallback */
  border-color: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p60), #ffffff);
  box-shadow:
    0 10px 20px rgba(31,20,10,0.12),
    0 0 0 2px color-mix(in srgb, var(--accent, #caa48a) var(--accent-p40), #ffffff);
}

.chess-entry-icon{
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.chess-entry-time{
  font-size: 11px;
  color: #6b5b52;
}

.chess-entry-card .game-icon{
  width: 44px;
  height: 44px;
  padding: 6px;
  border-radius: 10px;
}

.chess-entry-card--center{
  align-items: center;
  text-align: center;
}

.chess-entry-title{
  font-weight: 700;
  font-size: 32px;
  color:#2c2320;
}

/* Compact title for in-game side cards (separate from entry page header) */
.chess-status-title{
  font-weight: 700;
  font-size: 14px;
  color:#2c2320;
}

.chess-entry-sub{
  font-size: 11px;
  color:#6b5b52;
  white-space: normal;
}

.chess-entry-body{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
}

.chess-entry-card .game-title{
  font-size: 12px;
}

.board-frame{ width:max-content; }
.board-frame{
  display:flex;
  flex-direction:column;
  align-items:center;
}

/* coords */
.coord.top, .coord.bottom{
  display:grid;
  grid-template-columns: var(--coord) repeat(8, var(--cell)) var(--coord);
  align-items:center;
  justify-items:center;
  height: var(--coord);
  column-gap: var(--gap);
  padding: 0 var(--pad);
  color:#444;
  font-size:12px;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  user-select:none;
}
.middle{
  display:grid;
  grid-template-columns: var(--coord) max-content var(--coord);
  align-items:start;
}
.coord.left, .coord.right{
  display:grid;
  grid-template-rows: repeat(8, var(--cell));
  align-items:center;
  justify-items:center;
  width: var(--coord);
  row-gap: var(--gap);
  padding: var(--pad) 0;
  color:#444;
  font-size:12px;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  user-select:none;
}
html[data-mode="dark"] .coord.top,
html[data-mode="dark"] .coord.bottom,
html[data-mode="dark"] .coord.left,
html[data-mode="dark"] .coord.right{
  color:#f5f5f5;
}

/* board */
.board{
  display:grid;
  grid-template-columns: repeat(8, var(--cell));
  gap: var(--gap);
  padding: var(--pad);
  background: var(--bg, #0B0F0C);
  width:max-content;
}

/* squares */
.square{
  width: var(--cell);
  height: var(--cell);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  -ms-user-select:none;
  -webkit-user-select:none;
  -ms-user-select:none;
  user-select:none;

  /* Required so .legal::after can position absolutely */
  position: relative;
}
.square.light{ background: var(--cell-light, #EEEED2); }
.square.dark { background: var(--cell-dark,  #769656); }

/* piece img */
.square img{
  width: calc(var(--cell) * 0.78);
  height: calc(var(--cell) * 0.78);
  pointer-events:none;
}

/* bottom buttons */
.center-actions{ display:flex; justify-content:center; gap:12px; }
.bottom-actions{
  display:flex;
  justify-content:center;
  gap:12px;
  position:relative;
  z-index:9999;
  pointer-events:auto;
}

/* ---------- Prevent board click interception by surrounding layers ---------- */
.board-frame,
.board-frame *:not(.board):not(.board *){
  pointer-events:none;
}
.board, .board *{
  pointer-events:auto;
}

/* ---------- Highlights ---------- */

/* selected square */
.square.selected{
  outline: 3px solid var(--accent, #E2B76F);
  outline-offset: -3px;
}

/* last-move origin/destination */
.square.last-from,
.square.last-to{
  box-shadow: inset 0 0 0 3px var(--last-move-color, #333333);
}

/* legal move dot */
.square.legal::after{
  content:"";
  width: 22%;
  height: 22%;
  border-radius: 999px;
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p50), #ffffff);
  position:absolute;
  left:50%;
  top:50%;
  transform: translate(-50%, -50%);
}

/* capture ring (show only when a target piece exists) */
.square.legal.capture::after{
  width: 82%;
  height: 82%;
  background: transparent;
  border: var(--accent, #E2B76F); /* fallback */
  border: 3px solid color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p50), #ffffff);
}

/* check highlight (king square) */
.square.check-king{
  outline: 3px solid #ff4d4f;
  outline-offset: -3px;
}

/* ---------- Auth ---------- */
.auth-shell{
  min-height: calc(100vh - 64px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:32px 16px;
  background:
    radial-gradient(
      1200px 600px at 80% 0%,
      color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff) 0%,
      transparent 60%
    ),
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff) 0%,
      color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff) 45%,
      color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff) 100%
    );
}

.auth-card{
  width: min(360px, 92vw);
  padding: 42px 26px 38px;
  border-radius: 22px;
  margin: 0 auto;
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(31,20,10,0.12);
  border: var(--accent, #caa48a); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  color:#2c2320;
}

.auth-card__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:12px;
}

.auth-brand{
  font-size:14px;
  letter-spacing:0.08em;
  color:#6b5b52;
}

.auth-title{
  font-size:28px;
  margin: 6px 0 16px;
}

.auth-form{ display:flex; flex-direction:column; gap:10px; }
.auth-label{ font-size:12px; color:#7a6b61; }
.auth-field{
  display:flex;
  align-items:center;
  gap:10px;
  height:44px;
  padding:0 14px;
  border-radius:999px;
  border: var(--accent, #caa48a); /* fallback */
  border:1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}
.auth-field--alt{
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff);
  border-color: var(--accent, #caa48a); /* fallback */
  border-color: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff);
}
.auth-icon{
  width:22px;
  height:22px;
  border-radius:50%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  color:#6b5b52;
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
}
.auth-input{
  border:0;
  outline:none;
  background:transparent;
  width:100%;
  height:100%;
  font-size:13px;
  color:#2c2320;
}
.profile-grid{
  width: min(1400px, 98vw);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 24px;
  row-gap: 44px;
  padding: 0 20px;
  align-items: stretch;
  justify-content: space-between;
}
.profile-grid .profile-card + .profile-card{
  margin-top: 20px;
}
.profile-grid .auth-card{
  width: 90%;
  justify-self: center;
}
.profile-card .auth-input{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
}
.auth-field:focus-within{
  border-color: var(--accent, #caa48a);
  box-shadow: var(--accent, #caa48a); /* fallback */
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
}

.auth-row{ display:flex; align-items:center; justify-content:space-between; }
.auth-link{ color:#7a6b61; font-size:12px; text-decoration:none; }
.auth-link.auth-pill{
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.auth-link.auth-pill:hover{
  transform: translateY(-1px);
  border-color: var(--accent, #caa48a); /* fallback */
  border-color: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p50), #ffffff);
  box-shadow: 0 6px 14px rgba(31,20,10,0.08);
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff);
}
.auth-pill{
  padding:2px 8px;
  border-radius:999px;
  border: var(--accent, #caa48a); /* fallback */
  border:1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p30), #ffffff);
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff);
}
.auth-forgot{
  align-self: flex-end;
  margin-top: 6px;
}

.auth-cta{
  margin-top:6px;
  width:100%;
  padding: 10px 16px;
  border-radius:999px;
  border: var(--accent, #caa48a); /* fallback */
  border:1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p40), #ffffff);
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p40), #ffffff);
}

.auth-error{ color:#b00020; font-size:12px; }
.auth-footnote{ margin-top:12px; font-size:11px; color:#8a7c72; text-align:center; }
.auth-divider{ margin:16px 0 12px; text-align:center; color:#8a7c72; font-size:12px; letter-spacing:0.02em; }
.auth-google{
  width:100%;
  justify-content:center;
  align-items: center;
  border-radius:999px;
  padding: 10px 0;
  margin-bottom: 18px;
  display: flex;
  text-align: center;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  pointer-events: auto;
}
.auth-google img{
  display: block;
  margin: 0 auto;
}

.auth-google-icon{
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

/* ---------- Home (Auth-like) ---------- */
.home-card{
  width: min(980px, 96vw);
  padding: 26px 24px 30px;
  border-radius: 24px;
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff);
  border: var(--accent, #caa48a); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  box-shadow: 0 18px 50px rgba(31,20,10,0.1);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.home-card::before{
  content:"";
  position:absolute;
  inset:-40% -10% auto auto;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%,
    color-mix(in srgb, var(--accent, #caa48a) var(--accent-p30), #ffffff) 0%,
    transparent 60%);
  pointer-events:none;
}

.home-card::after{
  content:"";
  position:absolute;
  inset:auto auto -45% -15%;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle at 70% 30%,
    color-mix(in srgb, var(--accent, #caa48a) var(--accent-p30), #ffffff) 0%,
    transparent 65%);
  pointer-events:none;
}

.mode-pill{
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff);
  border: var(--accent, #caa48a); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p30), #ffffff);
  color:#6b5b52;
}

.divider{
  border-top: var(--accent, #caa48a); /* fallback */
  border-top: 1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  position: relative;
  z-index: 1;
}

.game-card{
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff) 0%,
      #ffffff 65%);
  border: var(--accent, #caa48a); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  border-radius: 18px;
  box-shadow:
    0 10px 24px rgba(31,20,10,0.06),
    0 12px 30px color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  position: relative;
  overflow: hidden;
}

.game-card:hover{
  border-color: var(--accent, #caa48a); /* fallback */
  border-color: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p60), #ffffff);
  box-shadow: 0 18px 32px rgba(31,20,10,0.12);
}

.game-icon{
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  border-radius: 14px;
  position: relative;
  z-index: 2;
  border: var(--accent, #caa48a); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p30), #ffffff);
  box-shadow:
    0 6px 14px rgba(31,20,10,0.08),
    inset 0 0 0 1px rgba(255,255,255,0.6);
  transform: translateZ(0);
}

.game-card:hover .game-icon{
  transform: translateY(-2px);
  box-shadow:
    0 10px 20px rgba(31,20,10,0.12),
    inset 0 0 0 1px rgba(255,255,255,0.7);
  border-color: var(--accent, #caa48a); /* fallback */
  border-color: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p50), #ffffff);
}

.game-card::after{
  content:"";
  position:absolute;
  inset:0;
  background-image:
    radial-gradient(rgba(0,0,0,0.035) 0.5px, transparent 0.5px);
  background-size: 6px 6px;
  opacity: 0.35;
  pointer-events:none;
  mix-blend-mode: multiply;
  z-index: 0;
}

.game-card > *{
  position: relative;
  z-index: 1;
}

/* ---------- Settings ---------- */
.settings-shell{
  min-height: auto;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding: 0px 16px 0px;
  overflow: hidden;
  background: transparent;
}

.settings-card{
  width: min(900px, 96vw);
  padding: 24px 22px 20px;
  border-radius: 20px;
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p10), #ffffff);
  border: var(--accent, #E2B76F); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p10), #ffffff);
  box-shadow: 0 10px 24px rgba(0,0,0,0.05);
  backdrop-filter: none;
  margin: 12px 0 24px;
}
.settings-title-wrap{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom: 12px;
}
.settings-select-wrap select{
  min-width: 160px;
}
.theme-list.visually-hidden{
  display:none;
}
.settings-layout{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:16px 18px;
  margin-top: 6px;
}
.settings-layout.with-panel{
  display:grid;
  grid-template-columns: 1fr 1fr;
  /* gap:20px 20px; */
  justify-items:center;
  align-items:center;
}
@media (max-width: 960px){
  .settings-layout{
    flex-wrap:wrap;
    justify-content:flex-start;
  }
}
@media (max-width: 640px){
  .settings-layout.with-panel{
    display:flex;
    flex-direction:column;
    align-items:stretch;
    justify-content:flex-start;
  }
  .settings-layout.with-panel .settings-board-frame{
    transform:none !important;
    width:100%;
    max-width:100%;
    margin-inline:auto;
    justify-content:center;
    overflow:hidden;
  }
  .settings-board-frame.board-frame{
    width:100%;
    max-width:100%;
  }
  .custom-panel,
  .custom-panel.is-open,
  .color-panel{
    width:100%;
    max-width:100%;
  }
  .custom-name,
  .theme-dropdown{
    min-width:0;
    width:100%;
    max-width:100%;
  }
}
.custom-panel{
  flex:0 0 280px;
  max-width:280px;
  display:none;
}
.custom-panel.is-open{
  display:block;
  max-height:520px;
}
.color-panel{
  width: 100%;
  max-width:280px;
  min-height:280px;
  background: #f8f8f8;
  border:1px solid #e5e5e5;
  border-radius: 18px;
  padding: 16px 20px 16px;
  box-shadow: 0 16px 28px rgba(0,0,0,0.10);
}
.color-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin: 14px 0;
  color:#2a2a2a;
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight:500;
  letter-spacing:0.2px;
}
.color-label{
  font-size:15px;
  color: inherit;
}
.color-chip-input{
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 46px;
  border-radius: 23px;
  border:1px solid #b3b3b3;
  padding:0;
  cursor:pointer;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.12);
}
.color-chip-input::-webkit-color-swatch-wrapper{
  padding:0;
  border-radius: 23px;
}
.color-chip-input::-webkit-color-swatch{
  border:none;
  border-radius: 23px;
}
.color-form .btn{
  width:100%;
  height:44px;
  border-radius:10px;
  font-weight:700;
  background:#f4f4f4;
  color:#a0a0a0;
  border:1px solid #e0e0e0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}
.color-form .btn:disabled{
  cursor:not-allowed;
}
.color-save-btn{
  width:100%;
}
.color-msg{
  margin: 10px 0 0;
  font-size:13px;
  color:#b00020;
}
.color-delete-wrap{
  margin-top:10px;
}
.custom-actions{
  margin-top:8px;
  display:flex;
}
.custom-delete{
  display:none;
  width:100%;
  height:44px;
  border-radius:10px;
  font-weight:700;
  background:#f4f4f4;
  color:#a0a0a0;
  border:1px solid #e0e0e0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
  cursor:pointer;
}
.settings-center{
  display:flex;
  justify-content:center;
  margin-top: 6px;
}
.settings-board-frame{
  transform: none;
  transform-origin: center;
  margin: 0;
  flex:0 0 auto;
}

.settings-layout.with-panel .settings-board-frame{
  transform: translateX(40px);
}

.settings-title{
  font-weight:700;
  font-size:18px;
  color:#2c2320;
}
html[data-mode="dark"] .settings-title{
  color:#111111;
}
.custom-row{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-top: 14px;
}
.custom-row__title{
  display:flex;
  align-items:center;
  gap:10px;
}
.custom-name-label{
  font-weight:700;
  color:#2c2320;
  display:none;
}
html[data-mode="dark"] .custom-name-label{
  color:#111111;
}
.custom-name{
  min-width: 240px;
  display:none;
  height:28px;
  padding: 4px 10px;
  border-radius:12px;
  border: var(--accent, #caa48a); /* fallback */
  border:1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p30), #d0d7e8);
  background:#ffffff;
  box-shadow: 0 8px 18px rgba(0,0,0,0.06);
  font-size:14px;
}
.custom-row.is-open .custom-name,
.custom-row.is-open .custom-name-label{
  display:block;
}
.pill-btn{
  width:38px;
  height:38px;
  border-radius:50%;
  border: var(--accent, #caa48a); /* fallback */
  border:1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p12), #ffffff);
  font-weight:800;
  font-size:18px;
  color: var(--accent, #caa48a); /* fallback */
  color:color-mix(in srgb, var(--accent, #caa48a) var(--accent-p70), #1c1c1c);
  box-shadow: 0 6px 12px rgba(0,0,0,0.08);
  cursor:pointer;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.pill-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0,0,0,0.12);
  border-color: var(--accent, #E2B76F); /* fallback */
  border-color: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p40), #ffffff);
}
.pill-btn[aria-expanded="true"]{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p20), #ffffff);
}

.settings-select-wrap select{
  border-radius:999px;
  padding:6px 14px;
  border: var(--accent, #caa48a); /* fallback */
  border:1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p10), #ffffff);
  color:#2c2320;
  max-height: 38px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--accent, #E2B76F); /* fallback */
  scrollbar-color: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p40), #ffffff) #f4f7ff;
}

.theme-dropdown{
  position: relative;
  min-width: 180px;
}
.theme-dropdown__button{
  width: 100%;
  border-radius: 14px;
  padding: 8px 12px;
  border: var(--accent, #caa48a); /* fallback */
  border:1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  background: var(--accent, #caa48a); /* fallback */
  background: color-mix(in srgb, var(--accent, #caa48a) var(--accent-p8), #ffffff);
  color:#2c2320;
  font-weight: 600;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.theme-dropdown__button span{
  color: inherit;
}
.theme-dropdown__button:hover{
  border-color: var(--accent, #E2B76F); /* fallback */
  border-color: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p40), #ffffff);
  box-shadow: 0 10px 20px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}
.theme-dropdown__chevron{
  font-size: 12px;
  color: var(--accent, #E2B76F); /* fallback */
  color: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p80), #ffffff);
}
.theme-dropdown__list{
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  border-radius: 12px;
  border: var(--accent, #E2B76F); /* fallback */
  border:1px solid color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p30), #ffffff);
  background: #ffffff;
  box-shadow: 0 18px 38px rgba(0,0,0,0.12);
  padding: 6px;
  display: none;
  z-index: 20;
  scrollbar-width: thin;
  scrollbar-color: var(--accent, #E2B76F); /* fallback */
  scrollbar-color: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p50), #ffffff) #f7f9ff;
}
.theme-dropdown__list.is-open{
  display: block;
}
.theme-dropdown__list::-webkit-scrollbar{
  width: 10px;
}
.theme-dropdown__list::-webkit-scrollbar-track{
  background: #f7f9ff;
  border-radius: 10px;
}
.theme-dropdown__list::-webkit-scrollbar-thumb{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p50), #ffffff);
  border-radius: 10px;
  border: 2px solid #f7f9ff;
}
.theme-dropdown__list::-webkit-scrollbar-thumb:hover{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p70), #ffffff);
}

/* Dark mode overrides */
html[data-mode="dark"] .theme-dropdown__button{
  border: var(--accent, #E2B76F); /* fallback */
  border:1px solid color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p20), #696969);
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p10), #a2a2a2);
  color:#ffffff;
  box-shadow: none;
}
html[data-mode="dark"] .theme-dropdown__button:hover{
  border-color: var(--accent, #E2B76F); /* fallback */
  border-color: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p40), #0B161C);
  box-shadow: none;
}
html[data-mode="dark"] .settings-title{
  color:#111111;
}
html[data-mode="dark"] .theme-dropdown__chevron{
  filter: invert(1) hue-rotate(180deg);
}
html[data-mode="dark"] .theme-dropdown__list{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p20), #0B161C);
  color:#ffffff;
}
html[data-mode="dark"] .theme-dropdown__list::-webkit-scrollbar-thumb,
html[data-mode="dark"] .theme-dropdown__list::-webkit-scrollbar-thumb:hover{
  background: #ffffff;
  border-color: #ffffff;
}
html[data-mode="dark"] .theme-dropdown__item{
  color: #ffffff;
}
html[data-mode="dark"] .theme-dropdown__item .swatch{
  border: 1px solid rgba(255,255,255,0.35);
}
html[data-mode="dark"] .theme-dropdown__item.is-active{
  background: rgba(255,255,255,0.12);
}
.theme-dropdown__item{
  width: 100%;
  border: 0;
  background: transparent;
  color:#2c2320;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  display:flex;
  align-items:center;
  gap: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}
.theme-dropdown__item .swatch{
  width: 14px;
  height: 14px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}
.theme-dropdown__item.is-active{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p20), #ffffff);
  color:#1f1f1f;
}
.theme-dropdown__item:hover{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p15), #ffffff);
}

.settings-select-wrap select:focus{
  outline: none;
  border-color: var(--accent, #E2B76F); /* fallback */
  border-color: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p60), #ffffff);
  box-shadow: 0 10px 20px rgba(0,0,0,0.10);
}

.settings-select-wrap select option{
  padding: 6px 10px;
  border-radius: 6px;
}

.settings-select-wrap select option:hover,
.settings-select-wrap select option:focus,
.settings-select-wrap select option:checked{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p20), #ffffff);
  color: #1f1f1f;
}

.settings-select-wrap select::-webkit-scrollbar{
  width: 10px;
}
.settings-select-wrap select::-webkit-scrollbar-track{
  background: #f4f7ff;
  border-radius: 10px;
}
.settings-select-wrap select::-webkit-scrollbar-thumb{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p40), #ffffff);
  border-radius: 10px;
  border: 2px solid #f4f7ff;
}
.settings-select-wrap select::-webkit-scrollbar-thumb:hover{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p60), #ffffff);
}

.settings-actions{
  display:flex;
  justify-content:flex-end;
  margin-top:4px;
  padding-bottom:8px;
}


/* ---------- Home Dashboard ---------- */
.home-shell{
  min-height: auto;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:0 16px 32px;
  background: transparent;
}

.home-card{
  position: relative;
  width: min(980px, 96vw);
  padding: 26px 24px 30px;
  border-radius: 24px;
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p10), #ffffff);
  border: var(--accent, #E2B76F); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p10), #ffffff);
  box-shadow: 0 10px 24px rgba(0,0,0,0.05);
  overflow: hidden;
}

.home-card::before,
.home-card::after{
  content: none;
}

.home-dashboard {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 0;
}

.mode-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}
.mode-row .mode-btn.active{
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p30), #ffffff);
  color: #2c2320;
  border-color: var(--accent, #E2B76F); /* fallback */
  border-color: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p40), #ffffff);
}

.mode-pill {
  padding: 4px 12px;
  background: #f0f0f0;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  border: 1px solid #ddd;
}

.divider {
  border: 0;
  border-top: 1px solid #eee;
  margin: 20px 0;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  --grid-gap: 16px;
  gap: var(--grid-gap);
  margin-top: 24px;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  justify-items: center;
}

.chess-entry .game-grid{
  margin-top: 36px;
}

.chess-entry-header{
  margin-bottom: 18px;
}

.chess-entry-sub{
  margin-top: 6px;
  font-size: 13px;
  color: var(--gp-entry-text, #64748b);
  overflow-wrap: anywhere;
}
.chess-entry-title,
.chess-entry-sub{
  text-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
.chess-entry .entry-card{
  background: var(--gp-card-bg, color-mix(in srgb, var(--accent, #E2B76F) 10%, #ffffff));
  border: 1px solid var(--gp-card-border, var(--accent, #E2B76F));
  box-shadow: var(--gp-card-shadow, 0 14px 30px rgba(15,23,42,0.10));
}
.chess-entry .game-card{
  background: var(--gp-entry-control-bg, #ffffff);
  border-color: var(--gp-entry-control-border, #e5e7eb);
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}
.chess-entry .game-card:hover{
  box-shadow: 0 12px 26px rgba(0,0,0,0.12);
  border-color: var(--gp-entry-control-active-border, var(--accent, #E2B76F));
}
/* Dark mode readability */
html[data-mode="dark"] .chess-entry-title{
  color: var(--gp-entry-title, #ffffff);
}
html[data-mode="dark"] .chess-entry-sub{
  color: var(--gp-entry-text, #f3f4f6);
}
html[data-mode="dark"] .chess-entry .game-card{
  background: var(--gp-entry-control-bg, #ffffff);
  border-color: var(--gp-entry-control-border, #e5e7eb);
  color: var(--gp-entry-control-text, #0f172a);
}
html[data-mode="dark"] .chess-entry .game-card .game-title{
  color: var(--gp-entry-control-text, #0f172a);
}
html[data-mode="dark"] .chess-entry .game-card .game-icon{
  background: #ffffff;
}
.chess-entry .entry-card{
  width: min(820px, 95vw);
  height: auto;
}

.game-grid-3 {
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  max-width: 720px;
  margin: 24px auto 0;
}

.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 14px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  text-decoration: none;
  color: inherit;
  width: 200px;
  height: 160px;
  flex: 0 0 auto;
  box-sizing: border-box;
  text-align: center;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.06);
  border-color: var(--accent);
}
.chess-play-card .game-card{
  width: 160px;
  height: 140px;
  padding: 14px 12px 14px 10px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}
.chess-play-card .game-card .game-icon{
  background: #f9f9f9;
  border: 1px solid #e8e8e8;
}
.chess-play-card .game-card:hover{
  border-color: color-mix(in srgb, var(--accent, #E2B76F) 50%, #ffffff);
  box-shadow: 0 14px 26px rgba(31,20,10,0.10);
}

.game-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9f9f9;
  border-radius: 12px;
  padding: 8px;
}

.game-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.game-title {
  font-weight: 700;
  font-size: 14px;
  color: #222;
}
html[data-mode="dark"] .game-card .game-title{
  color: #ffffff;
}

/* Responsive */
@media (max-width: 640px) {
  .game-grid,
  .game-grid-3{
    grid-template-columns: 1fr;
    width: 100%;
  }
  .game-card{
    max-width: 240px;
    margin: 0 auto;
  }
  .chess-entry .entry-card{
  width: min(820px, 95vw);
  height: auto;
}
}

@media (max-width: 820px) {
  .chess-entry .game-grid,
  .game-grid-3{
    grid-template-columns: 1fr;
    justify-items:center;
  }
}
@media (max-width: 900px) {
  .chess-play-card{
    width: min(560px, calc(100vw - 24px));
    padding: 12px 10px 12px;
    min-height: auto;
  }
  .chess-layout{
    grid-template-columns: 1fr;
    row-gap: 16px;
  }
  .chess-spacer{
    display:none;
  }
  .chess-side{
    width: min(360px, 90vw);
    justify-self: center;
  }
}

.promo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 9999;
}
.promo-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.promo-card {
  min-width: 150px;
  padding: 16px 18px;
  border-radius: 14px;
  background: #ffffff;
  border: var(--accent, #caa48a); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #caa48a) var(--accent-p20), #ffffff);
  box-shadow: 0 16px 32px rgba(20, 16, 12, 0.15);
  text-align: center;
}
.promo-title {
  font-weight: 700;
  color: #2c2320;
  margin-bottom: 12px;
}
.promo-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.promo-btn {
  border: var(--accent, #E2B76F); /* fallback */
  border: 1px solid color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p60), #ffffff);
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p10), #ffffff);
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  color: #2c2320;
  padding: 10px 0;
  cursor: pointer;
}
.promo-btn:hover {
  background: var(--accent, #E2B76F); /* fallback */
  background: color-mix(in srgb, var(--accent, #E2B76F) var(--accent-p20), #ffffff);
}
.promo-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}



