/* Daily Chess Coach. Colours and fonts from the video brand (brand/BRAND.md). */
@font-face { font-family: 'Anton'; src: url('/static/fonts/Anton-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/static/fonts/Montserrat-Variable.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }

:root {
  --bg0: #0A0D12; --bg1: #12161D; --bg2: #171C24; --card: #1B2230; --card2: #222B3B; --line: #2B3547;
  --yellow: #FFD84D; --yellow2: #F2C94C; --cream: #F5F1E6; --text: #E8ECF2; --muted: #8C97A6;
  --red: #E5484D; --green: #3DDC84; --blue: #4AA3FF; --orange: #FF9F43; --teal: #1BAAA6;
  --sq-light: #E9E4D4; --sq-dark: #5E7F98;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Anton', 'Impact', sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
/* The page background lives on <html> with a solid dark colour under it, so the area a phone shows when you pull the
   page past its edge is dark too, not white (owner 16 Nov). */
html {
  background: var(--bg0) radial-gradient(1200px 700px at 50% -10%, #1B2230 0%, var(--bg2) 35%, var(--bg0) 100%) fixed;
  color-scheme: dark; overscroll-behavior-y: none;
  /* owner 17 Nov: a double tap (two quick taps on the board, or on a button) zoomed the page on phones. manipulation =
     no double-tap zoom anywhere (pinch zoom still works); the board itself is touch-action: none (.cb) */
  touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
body {
  margin: 0; font-family: var(--font); color: var(--text); font-size: 16px; line-height: 1.45;
  background: transparent; overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--yellow); }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.01em; }
.display { font-family: var(--display); font-weight: 400; letter-spacing: .01em; text-transform: uppercase; line-height: 1.02; }
.y { color: var(--yellow); } .r { color: var(--red); } .g { color: var(--green); } .m { color: var(--muted); }
.hidden { display: none !important; }

#app { min-height: 100%; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }

/* top bar */
.top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.top .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--cream); }
.top .logo img { width: 34px; height: 34px; border-radius: 9px; }
.top .logo b { font-family: var(--display); font-weight: 400; font-size: 21px; letter-spacing: .02em; }
.top .logo b i { font-style: normal; color: var(--yellow); }
.top .grow { flex: 1; }
.top nav { display: flex; gap: 4px; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; padding: 8px 12px; border-radius: 999px; }
.top nav a.on, .top nav a:hover { color: var(--cream); background: rgba(255, 255, 255, .06); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 14px 20px; font-weight: 800; font-size: 16px; background: var(--yellow); color: #14181F;
  box-shadow: 0 4px 0 #B8962A; transition: transform .06s, box-shadow .06s, filter .15s; user-select: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #B8962A; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--card2); color: var(--text); box-shadow: 0 4px 0 #141A25; }
.btn.ghost:active { box-shadow: 0 1px 0 #141A25; }
.btn.small { padding: 9px 14px; font-size: 14px; border-radius: 10px; box-shadow: 0 3px 0 #B8962A; }
.btn.ghost.small { box-shadow: 0 3px 0 #141A25; }
.btn.link { background: none; box-shadow: none; color: var(--muted); padding: 8px; font-weight: 700; }
.btn.link:hover { color: var(--cream); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .07); font-size: 13px; font-weight: 700; color: var(--muted); }
.input {
  width: 100%; background: #0F131A; border: 2px solid var(--line); border-radius: 12px; padding: 14px 16px;
  font-size: 17px; font-weight: 600; outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--yellow); }
.seg { display: flex; gap: 6px; background: #0F131A; padding: 5px; border-radius: 12px; border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 10px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card2); color: var(--cream); }

/* ------------------------------------------------------------ board */
.cb { position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; user-select: none; touch-action: none; box-shadow: var(--shadow);
  -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }   /* no text selection, long-press menu or tap flash on the board */
.cb img, .cb svg { -webkit-user-drag: none; -webkit-touch-callout: none; }
.cb > div, .cb > svg { position: absolute; inset: 0; }
.cb-squares { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.cb-s { position: relative; }
.cb-s.l { background: var(--sq-light); } .cb-s.d { background: var(--sq-dark); }
.cb-rank, .cb-file { position: absolute; font-size: clamp(8px, 1.6vmin, 12px); font-weight: 800; opacity: .75; pointer-events: none; }
.cb-rank { left: 3px; top: 2px; } .cb-file { right: 3px; bottom: 1px; }
.cb-s.l .cb-rank, .cb-s.l .cb-file { color: var(--sq-dark); } .cb-s.d .cb-rank, .cb-s.d .cb-file { color: var(--sq-light); }
.cb-marks, .cb-pieces, .cb-svg, .cb-badges { pointer-events: none; }
.cb-m { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; }
.cb-m.last { background: rgba(255, 216, 77, .42); }
.cb-m.sel { background: rgba(255, 216, 77, .6); }
.cb-m.dot::after { content: ''; position: absolute; left: 35%; top: 35%; width: 30%; height: 30%; border-radius: 50%; background: rgba(10, 13, 18, .28); }
.cb-m.cap::after { content: ''; position: absolute; inset: 4%; border-radius: 50%; border: 5px solid rgba(10, 13, 18, .28); }
.cb-p { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; background-size: 100% 100%; background-repeat: no-repeat; transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .16s; will-change: transform; }
.cb-p.noanim { transition: none; } .cb-p.moving { z-index: 3; } .cb-p.gone { opacity: 0; }
.cb-p.drag { transition: none; z-index: 10; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35)); }
.cb-live .cb-p { cursor: grab; }
.cb-b { position: absolute; transform: translate(-62%, -38%); min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 900; font-size: 13px; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); border: 2px solid rgba(255, 255, 255, .85); animation: pop .25s cubic-bezier(.2, 1.4, .4, 1); }
.cb > .cb-promo { position: absolute; inset: auto; width: 12.5%; z-index: 20; display: flex; flex-direction: column; background: #fff; border-radius: 6px; box-shadow: var(--shadow); pointer-events: auto; }
.cb > .cb-promo[hidden] { display: none; }
.cb-promo button { width: 100%; aspect-ratio: 1/1; border: 0; background-color: transparent; background-size: 100% 100%; }
.cb-promo button:hover { background-color: rgba(255, 216, 77, .5); }
.cb-shake { animation: shake .3s; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes pop { from { transform: translate(-62%, -38%) scale(.3); opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }
@keyframes pulse { 50% { opacity: .45; } }
.fade-up { animation: fadeUp .35s ease backwards; }   /* not 'both': a kept transform would trap fixed overlays inside the block */
