/* ==========================================================================
   Royal Chess — base.css
   Design tokens, reset, app shell, screen transitions and the shared
   medallion / plaque buttons.
   ========================================================================== */

:root {
  --gold: #d9b25f;
  --gold-light: #f6e3a3;
  --gold-pale: #fff4d2;
  --gold-dark: #8a6420;
  --emerald: #0d3b2c;
  --emerald-2: #135841;
  --emerald-deep: #06201a;
  --ivory: #f7eed7;
  --wine: #6d1622;
  --ink: #1d120a;
  --shadow: rgba(0, 0, 0, 0.55);

  --font-display: 'Cinzel Decorative', 'Cinzel', 'Trajan Pro', 'Palatino Linotype', Georgia, serif;
  --font-head: 'Cinzel', 'Trajan Pro', 'Palatino Linotype', Georgia, serif;
  --font-body: 'Cormorant Garamond', 'Palatino Linotype', Georgia, serif;

  --medal: clamp(46px, 6.2vmin, 66px);
  --medal-small: clamp(40px, 5.2vmin, 56px);
  --medal-big: clamp(64px, 9vmin, 92px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #120905;
  color: var(--ivory);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

img { -webkit-user-drag: none; user-select: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:focus { outline: none; }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overflow: clip;          /* never scrolls, even when a focused element is off-screen */
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  transition: filter 0.6s ease;
}

#game.blurred { filter: blur(7px) brightness(0.55) saturate(0.9); }

/* ------------------------------------------------------------ screens */
.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.45s ease, visibility 0s;
}

.corner {
  position: absolute;
  top: calc(12px + var(--safe-top));
  display: flex;
  gap: 10px;
  z-index: 5;
}
.corner-left { left: calc(12px + var(--safe-left)); }
.corner-right { right: calc(12px + var(--safe-right)); }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.05em 0.4em;
  margin: 0 0.1em;
  border-radius: 5px;
  border: 1px solid rgba(246, 227, 163, 0.55);
  background: linear-gradient(#1b4d3b, #0b2c21);
  box-shadow: 0 2px 0 #041a13, inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: var(--gold-light);
  font-family: var(--font-head);
  font-size: 0.78em;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

/* ------------------------------------------------------------ logo text */
.logo {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.86;
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.logo span {
  background: linear-gradient(180deg, #fffbe6 0%, #f8e3a0 32%, #e0b458 55%, #9c6a1e 78%, #e9c46e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 #4a2f0b) drop-shadow(0 5px 10px rgba(0, 0, 0, 0.75));
}

.logo-royal { font-size: clamp(30px, 7vmin, 78px); }
.logo-gambit { font-size: clamp(40px, 10.5vmin, 120px); }

/* ------------------------------------------------------------ medallion buttons */
.medal {
  position: relative;
  width: var(--medal);
  height: var(--medal);
  border-radius: 50%;
  background: url('../assets/images/ui/medallion.png') center / contain no-repeat;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
  transition: transform 0.15s ease, filter 0.15s ease;
  display: inline-grid;
  place-items: center;
  flex: none;
}
.medal.small { width: var(--medal-small); height: var(--medal-small); }
.medal.big { width: var(--medal-big); height: var(--medal-big); }
.medal.wine { background-image: url('../assets/images/ui/medallion_wine.png'); }
.medal img { width: 46%; height: 46%; pointer-events: none; }
.medal:hover { transform: scale(1.08); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.7)) brightness(1.12); }
.medal:active { transform: scale(0.94); }
.medal:focus-visible, .play-medal:focus-visible, .plaque:focus-visible, .mode-card:focus-visible,
.diff:focus-visible, .promo-btn:focus-visible, .setting:focus-within {
  outline: 3px solid rgba(120, 255, 190, 0.9);
  outline-offset: 4px;
}
.medal.off img { opacity: 0.8; }

.play-medal {
  position: relative;
  width: clamp(104px, 17vmin, 176px);
  height: clamp(104px, 17vmin, 176px);
  border-radius: 50%;
  background: url('../assets/images/ui/medallion_play.png') center / contain no-repeat;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7));
  display: grid;
  place-items: center;
  animation: playPulse 1.6s ease-in-out infinite;
  transition: filter 0.2s ease;
}
.play-medal img { width: 44%; height: 44%; margin-left: 7%; pointer-events: none; }
.play-medal::after {
  content: '';
  position: absolute;
  inset: -8%;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(246, 227, 163, 0.55);
  animation: playRing 1.6s ease-out infinite;
  pointer-events: none;
}
.play-medal:hover { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.75)) brightness(1.15); }
.play-medal:active { transform: scale(0.95); }

@keyframes playPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes playRing {
  0% { box-shadow: 0 0 0 0 rgba(246, 227, 163, 0.45); }
  100% { box-shadow: 0 0 0 26px rgba(246, 227, 163, 0); }
}

/* ------------------------------------------------------------ plaque buttons */
.plaque {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  min-height: clamp(44px, 6.6vmin, 60px);
  padding: 0 1.5em;
  border-style: solid;
  border-width: 18px 24px;
  border-color: transparent;
  border-image: url('../assets/images/ui/plaque.png') 44 fill / 18px 24px stretch;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(14px, 2.2vmin, 19px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-light);
  text-shadow: 0 2px 0 #031810, 0 0 10px rgba(0, 0, 0, 0.6);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55));
  transition: transform 0.15s ease, filter 0.15s ease;
  white-space: nowrap;
}
.plaque > * { margin: -14px 0; }
.plaque img { width: 1.35em; height: 1.35em; pointer-events: none; }
.plaque:hover, .plaque.active {
  border-image-source: url('../assets/images/ui/plaque_active.png');
  transform: translateY(-2px);
  filter: drop-shadow(0 7px 10px rgba(0, 0, 0, 0.6)) brightness(1.08);
  color: var(--gold-pale);
}
.plaque:active { transform: translateY(1px) scale(0.98); }
.plaque.small { font-size: clamp(12px, 1.8vmin, 15px); min-height: 40px; padding: 0 0.9em; border-width: 14px 18px; border-image-width: 14px 18px; }
.plaque.wide { width: 100%; }

.orn { color: var(--gold); font-family: var(--font-body); }
.orn.flip { display: inline-block; transform: scaleX(-1); }

.hidden { display: none !important; }
