/* ============================================================
   BOTC — Blood on the Clocktower
   Medieval Dark Theme v3.0 — Main Layout
   "The demon slumbers in the shadow of the Clocktower"
   ============================================================ */

/* ── Custom Properties ───────────────────────────────────────── */
:root {
  --botc-bg:          #07080f;
  --botc-bg2:         #0c0e1c;
  --botc-stone:       #101320;
  --botc-stone2:      #161a2e;
  --botc-stone3:      #1d2236;
  --botc-border:      rgba(185,148,65,.22);
  --botc-border2:     rgba(185,148,65,.42);
  --botc-gold:        #c8a84b;
  --botc-gold2:       #e8c96e;
  --botc-gold3:       #f5e090;
  --botc-crimson:     #8b1a1a;
  --botc-crimson2:    #b52020;
  --botc-blood:       #5e0c0c;
  --botc-evil-purple: #2e1248;
  --botc-evil-glow:   #7030a0;
  --botc-good-blue:   #1a3a5e;
  --botc-good-glow:   #4a90c4;
  --botc-text:        #d4c9a8;
  --botc-text-dim:    #7a7060;
  --botc-text-faint:  #4a4538;
  --botc-parchment:   rgba(200,168,75,.06);
  --botc-font-title:  'Cinzel', 'Times New Roman', serif;
  --botc-font-body:   'Crimson Text', Georgia, serif;
  --botc-font-gothic: 'IM Fell English', Georgia, serif;
  --botc-radius:      12px;
  --botc-radius-sm:   8px;
  --safe-bottom:      env(safe-area-inset-bottom, 0px);
}

/* ── Reset / Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0; padding: 0;
  background-color: var(--botc-bg) !important;
  color: var(--botc-text) !important;
  font-family: var(--botc-font-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.botc-body {
  background-color: var(--botc-bg);
  background-image:
    radial-gradient(ellipse at 12% 0%,   rgba(72,42,140,.24)  0%, transparent 55%),
    radial-gradient(ellipse at 88% 100%, rgba(28,74,132,.18)  0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%,  rgba(200,168,75,.02) 0%, transparent 70%);
  min-height: 100vh;
  position: relative;
}

/* Stone noise texture */
.botc-body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.015'%3E%3Crect x='0'  y='0'  width='1' height='1'/%3E%3Crect x='20' y='15' width='1' height='1'/%3E%3Crect x='40' y='5'  width='1' height='1'/%3E%3Crect x='60' y='25' width='1' height='1'/%3E%3Crect x='10' y='35' width='1' height='1'/%3E%3Crect x='50' y='45' width='1' height='1'/%3E%3Crect x='30' y='60' width='1' height='1'/%3E%3Crect x='70' y='55' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none; z-index: 0; opacity: .5;
}

/* ── Typography ─────────────────────────────────────────────── */
.botc-title {
  font-family: var(--botc-font-title);
  font-weight: 700; letter-spacing: .08em;
  color: var(--botc-gold2);
  text-shadow: none;
  line-height: 1.1;
}

.botc-subtitle {
  font-family: var(--botc-font-gothic);
  font-style: italic;
  color: var(--botc-text-dim);
  letter-spacing: .02em;
}

/* ── Clock Tower Logo ────────────────────────────────────────── */
.botc-tower {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 16px 0 8px;
  position: relative; z-index: 1;
}

.botc-tower-icon {
  font-size: 2.4rem; color: var(--botc-gold);
  text-shadow: none;
  animation: none;
}
@keyframes tower-pulse {
  0%, 100% { text-shadow: none; }
  50%      { text-shadow: none; }
}

/* ── Cards / Panels ─────────────────────────────────────────── */
.botc-card {
  background: linear-gradient(145deg, var(--botc-stone3) 0%, var(--botc-stone) 100%);
  border: 1px solid var(--botc-border);
  border-radius: var(--botc-radius);
  padding: 16px;
  position: relative; overflow: hidden;
}
.botc-card::before {
  content: ''; position: absolute; inset: 0;
  background: var(--botc-parchment);
  pointer-events: none; border-radius: inherit;
}
.botc-card-gold {
  border-color: rgba(200,168,75,.42);
  box-shadow: 0 0 24px rgba(200,168,75,.08), inset 0 1px 0 rgba(200,168,75,.14);
}
/* Corner ornament */
.botc-card::after {
  content: '✦';
  position: absolute; top: 7px; right: 11px;
  font-size: .52rem; color: var(--botc-gold); opacity: .3;
  pointer-events: none;
}

/* ── Ornamental Divider ──────────────────────────────────────── */
.botc-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--botc-gold); opacity: .4;
  font-size: .6rem; letter-spacing: .2em;
  margin: 8px 0;
}
.botc-divider::before,
.botc-divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--botc-gold), transparent);
}

/* ════════════════════════════════════════════════════════════
   BUTTONS — Custom BOTC medieval style
   Completely overrides Bootstrap .btn for main layout pages.
   Bootstrap is still loaded for everything else (grid, modals,
   badges, utilities) but button aesthetics are fully custom.
   ════════════════════════════════════════════════════════════ */

/* ── Base .btn reset ─────────────────────────────────────────── */
.btn {
  --bs-btn-padding-x: 0;
  --bs-btn-padding-y: 0;
  --bs-btn-color: var(--botc-text);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--botc-text);
  --bs-btn-hover-bg: transparent;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--botc-text);
  --bs-btn-active-bg: transparent;
  --bs-btn-active-border-color: transparent;
  --bs-btn-focus-shadow-rgb: 0,0,0;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  padding: 0.38rem 0.9rem !important;
  font-family: var(--botc-font-title) !important;
  font-size: 0.74rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.07em !important;
  line-height: 1.35 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.1s !important;
  background: rgba(20,16,10,.55) !important;
  color: var(--botc-text) !important;
  box-shadow: none !important;
  text-decoration: none !important;
}
.btn:focus, .btn:focus-visible {
  outline: 2px solid rgba(200,168,75,.4) !important;
  outline-offset: 2px !important;
  box-shadow: none !important;
}
.btn:active { transform: scale(.96) !important; }
.btn:disabled, .btn[disabled] { opacity: 0.45 !important; cursor: not-allowed !important; pointer-events: none !important; }

.btn-sm { padding: 0.22rem 0.6rem !important; font-size: 0.66rem !important; border-radius: 6px !important; }
.btn-lg { padding: 0.6rem 1.5rem !important; font-size: 0.84rem !important; border-radius: 10px !important; }

.btn-primary  { background: rgba(23,44,64,.92) !important; border-color: rgba(74,144,196,.32) !important; color:#d7e7f4 !important; }
.btn-primary:hover  { background: rgba(28,52,74,.96) !important; border-color:rgba(74,144,196,.42) !important; color:#e4eef7 !important; }

.btn-danger   { background: linear-gradient(135deg,var(--botc-crimson),var(--botc-blood)) !important; border-color:rgba(200,168,75,.35) !important; color:#f0ddb0 !important; box-shadow:none !important; }
.btn-danger:hover   { background: linear-gradient(135deg,var(--botc-crimson2),var(--botc-crimson)) !important; border-color:rgba(200,168,75,.45) !important; color:#f6e7bf !important; box-shadow:none !important; }

.btn-secondary { background: rgba(122,112,96,.18) !important; border-color:rgba(122,112,96,.35) !important; color:var(--botc-text-dim) !important; }
.btn-secondary:hover { background: rgba(122,112,96,.3) !important; border-color:rgba(122,112,96,.55) !important; color:var(--botc-text) !important; }

.btn-success  { background: rgba(24,58,38,.92) !important; border-color:rgba(46,160,80,.28) !important; color:#d9eadf !important; box-shadow:none !important; }
.btn-success:hover  { background: rgba(30,67,44,.96) !important; border-color:rgba(46,160,80,.38) !important; color:#e5f0e8 !important; }

.btn-warning  { background: rgba(72,58,28,.92) !important; border-color:rgba(200,168,75,.32) !important; color:#f0e4bc !important; box-shadow:none !important; }
.btn-warning:hover  { background: rgba(84,67,33,.96) !important; border-color:rgba(200,168,75,.42) !important; color:#f4ebca !important; }

.btn-outline-primary   { background:transparent !important; border-color:rgba(74,144,196,.4) !important; color:#7aabdc !important; }
.btn-outline-primary:hover   { background:rgba(74,144,196,.06) !important; border-color:rgba(74,144,196,.42) !important; color:#d7e7f4 !important; }

.btn-outline-secondary { background:transparent !important; border-color:rgba(122,112,96,.38) !important; color:var(--botc-text-dim) !important; }
.btn-outline-secondary:hover { background:rgba(122,112,96,.10) !important; border-color:rgba(122,112,96,.42) !important; color:var(--botc-text) !important; }

.btn-outline-success   { background:transparent !important; border-color:rgba(46,160,80,.38) !important; color:#66cc88 !important; }
.btn-outline-success:hover   { background:rgba(46,160,80,.06) !important; border-color:rgba(46,160,80,.38) !important; color:#d9eadf !important; }

.btn-outline-warning   { background:transparent !important; border-color:rgba(200,168,75,.38) !important; color:var(--botc-gold) !important; }
.btn-outline-warning:hover   { background:rgba(200,168,75,.06) !important; border-color:rgba(200,168,75,.4) !important; color:#f0e4bc !important; }

.btn-outline-danger    { background:transparent !important; border-color:rgba(140,108,108,.34) !important; color:#d8c7c7 !important; }
.btn-outline-danger:hover    { background:rgba(90,70,70,.08) !important; border-color:rgba(140,108,108,.42) !important; color:#f1ece7 !important; }

.btn-outline-dark      { background:transparent !important; border-color:rgba(80,70,55,.38) !important; color:var(--botc-text-dim) !important; }
.btn-outline-dark:hover      { background:rgba(80,70,55,.18) !important; border-color:rgba(122,112,96,.5) !important; color:var(--botc-text) !important; }

.btn-close {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important; height: 28px !important;
  padding: 0 !important;
  background: transparent !important;
  background-image: none !important;
  border: 1px solid rgba(122,112,96,.3) !important;
  border-radius: 50% !important;
  color: var(--botc-text-dim) !important;
  font-size: 1.05rem !important;
  cursor: pointer !important;
  opacity: 1 !important;
  transition: all 0.15s !important;
  filter: none !important;
}
.btn-close::before { content: '×'; line-height: 1; color: var(--botc-text-dim); }
.btn-close:hover { background: rgba(200,168,75,.1) !important; border-color: rgba(200,168,75,.42) !important; opacity: 1 !important; }
.btn-close:hover::before { color: var(--botc-gold); }

/* ────────────────────────────────────────────────────────────── */

/* ── BOTC-prefixed custom buttons (kept for legacy compat) ──── */
.btn-botc-primary {
  font-family: var(--botc-font-title);
  font-size: .8rem; letter-spacing: .12em; font-weight: 600;
  background: linear-gradient(135deg, var(--botc-crimson) 0%, var(--botc-blood) 100%);
  color: #f0ddb0 !important;
  border: 1px solid rgba(200,168,75,.38);
  border-radius: 999px;
  padding: .56rem 1.7rem;
  text-transform: uppercase;
  box-shadow: none;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.btn-botc-primary:hover, .btn-botc-primary:focus {
  background: linear-gradient(135deg, var(--botc-crimson2), var(--botc-crimson));
  box-shadow: none;
  transform: none;
  color: #f6e7bf !important;
}
.btn-botc-primary:active { transform: none; }

.btn-botc-secondary {
  font-family: var(--botc-font-title);
  font-size: .72rem; letter-spacing: .08em;
  background: rgba(255,255,255,.04);
  color: var(--botc-text) !important;
  border: 1px solid var(--botc-border);
  border-radius: 999px; padding: .44rem 1.2rem;
  text-transform: uppercase; transition: all .15s;
}
.btn-botc-secondary:hover {
  background: rgba(200,168,75,.1);
  border-color: rgba(200,168,75,.38);
  color: var(--botc-gold2) !important;
}

.btn-botc-ghost {
  background: transparent; border: 0;
  color: var(--botc-text-dim); padding: .3rem .6rem;
  transition: color .15s;
}
.btn-botc-ghost:hover { color: var(--botc-gold2); }

/* ── Nav / Top Bar ───────────────────────────────────────────── */
.botc-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(7,8,18,.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--botc-border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,.5);
}
/* Gold accent line */
.botc-topbar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,168,75,.35), transparent);
  pointer-events: none;
}
.botc-topbar::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,168,75,.15), transparent);
  pointer-events: none;
}
.botc-topbar-actions { display: flex; align-items: center; gap: 6px; }

/* ── User badge ─────────────────────────────────────────────── */
.botc-user-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--botc-font-title);
  font-size: .68rem; letter-spacing: .06em;
  color: var(--botc-text-dim);
}

/* ── Team Colors ─────────────────────────────────────────────── */
.botc-team-good   { color: #6ab8e8; }
.botc-team-evil   { color: #d05050; }
.botc-team-minion { color: #a858d0; }
.botc-team-demon  { color: #e85050; }

/* ── Token Cards (play screen) ───────────────────────────────── */
.botc-token {
  position: relative; cursor: pointer; user-select: none;
  border-radius: 50%; aspect-ratio: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
  border: 2px solid rgba(200,168,75,.28);
  background: radial-gradient(circle at 35% 35%, var(--botc-stone3), var(--botc-stone));
  overflow: hidden;
}
.botc-token:hover { transform: scale(1.08); }
.botc-token.flipped {
  box-shadow: 0 0 18px rgba(200,168,75,.38), 0 5px 14px rgba(0,0,0,.6);
  border-color: var(--botc-gold);
}
.botc-token.evil-token { border-color: rgba(192,57,43,.55); }
.botc-token.evil-token.flipped {
  box-shadow: 0 0 22px rgba(192,57,43,.55), 0 5px 14px rgba(0,0,0,.6);
}
.botc-token .token-back {
  font-size: 1.4rem; color: var(--botc-gold); opacity: .55;
  text-shadow: 0 0 12px rgba(200,168,75,.5);
}
.botc-token .token-front { display: none; text-align: center; padding: 4px; }
.botc-token.flipped .token-back  { display: none; }
.botc-token.flipped .token-front {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 100%; height: 100%;
}
.botc-token .token-icon { font-size: 1.3rem; margin-bottom: 2px; }
.botc-token .token-name {
  font-size: .52rem; font-family: var(--botc-font-title);
  letter-spacing: .03em; line-height: 1.1;
  text-align: center; color: var(--botc-text);
}

/* Status badges on token */
.token-badge {
  position: absolute; top: -2px; right: -2px;
  width: 16px; height: 16px; border-radius: 50%;
  font-size: .48rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(0,0,0,.5);
}
.token-badge-poison { background: #4a1575; color: #d4a0ff; }
.token-badge-drunk  { background: #a04000; color: #ffd070; }
.token-badge-dead   { background: #1a1a1a; color: #555; }
.token-badge-note   { font-size: .42rem; }

/* Note overlays */
.token-note-good  { box-shadow: 0 0 8px rgba(74,144,196,.8) inset; border-color: #4a90c4; }
.token-note-evil  { box-shadow: 0 0 8px rgba(192,57,43,.8) inset; border-color: #c0392b; }
.token-note-true  { outline: 2px solid #2ecc71; }
.token-note-false { outline: 2px solid #e74c3c; }

/* ── Token interactive states ────────────────────────────────── */
.botc-token.selected {
  outline: 2px solid var(--botc-gold2);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(200,168,75,.22), 0 0 20px rgba(200,168,75,.4);
  transform: scale(1.09); z-index: 2;
}
.botc-token.dead {
  opacity: .5; filter: grayscale(.65);
  cursor: default; pointer-events: none;
}
.botc-token.dead:hover { transform: none; }

/* Kill-target mode */
@keyframes kill-target-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(192,57,43,.4); border-color: rgba(192,57,43,.6); }
  50%       { box-shadow: 0 0 26px rgba(192,57,43,.85); border-color: rgba(220,60,40,.95); }
}
.botc-token.kill-target { animation: kill-target-pulse 1s ease-in-out infinite; cursor: crosshair; }

/* Night-kill target */
@keyframes night-target-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(120,80,200,.4); border-color: rgba(130,80,200,.6); }
  50%       { box-shadow: 0 0 28px rgba(140,90,220,.95); border-color: rgba(160,100,230,.95); }
}
.botc-token.night-target { animation: night-target-pulse 1s ease-in-out infinite; }

/* ── Log entry colors ────────────────────────────────────────── */
.log-win    { color: #40d870; }
.log-kill   { color: #e9a23b; }
.log-strike { color: #e74c3c; }
.log-truth  { color: #59c7ff; }
.log-phase  { color: var(--botc-gold); font-family: var(--botc-font-title); font-size: .9em; letter-spacing: .04em; }
.log-night  { color: #9080c8; }
.log-ability{ color: var(--botc-gold2); }
.log-result { color: #a0e090; }
.log-score  { color: #59c7ff; }
.log-info   { color: var(--botc-text-dim); }

/* ── Board / Game Screen ─────────────────────────────────────── */
#botc-game-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--botc-bg); overflow: hidden;
}

#botc-topbar {
  flex: 0 0 auto; display: flex;
  align-items: center; justify-content: space-between;
  padding: 8px 14px;
  background: rgba(7,8,18,.88);
  border-bottom: 1px solid var(--botc-border);
  backdrop-filter: blur(10px); gap: 8px; min-height: 46px;
  position: relative;
}
#botc-topbar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,168,75,.3), transparent);
  pointer-events: none;
}

#botc-topbar-expand {
  flex: 0 0 auto; display: flex;
  align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 4px; padding: 6px 14px;
  background: rgba(10,12,24,.9);
  border-bottom: 1px solid var(--botc-border);
  overflow: hidden; max-height: 0;
  transition: max-height .3s ease, padding .3s ease;
}
#botc-topbar-expand.open { max-height: 120px; padding: 6px 14px; }

#botc-content {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; overflow: hidden;
}

#botc-board {
  flex: 1 1 auto; min-height: 0;
  position: relative; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
}

.botc-token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px; width: 100%; max-width: 480px;
}

/* ── Action Hub ──────────────────────────────────────────────── */
#botc-action-hub {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: flex; gap: 8px;
  pointer-events: none; opacity: 0; z-index: 10;
  transition: opacity .2s;
}
#botc-action-hub.visible { opacity: 1; pointer-events: all; }

/* ── Stats Bar ───────────────────────────────────────────────── */
.botc-stat-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.botc-stat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--botc-font-title);
  font-size: .68rem; letter-spacing: .06em;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.1);
}
.botc-stat-fail { background: rgba(139,26,26,.28); color: #e06060; border-color: rgba(192,57,43,.3); }
.botc-stat-kill { background: rgba(26,80,40,.28); color: #60c080; border-color: rgba(46,204,113,.3); }

/* ── Bottom Toolbar ──────────────────────────────────────────── */
#botc-toolbar {
  flex: 0 0 auto; display: flex; align-items: center;
  justify-content: space-around;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: rgba(7,8,18,.92);
  border-top: 1px solid var(--botc-border);
  gap: 6px; backdrop-filter: blur(8px);
  position: relative;
}
#botc-toolbar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,168,75,.18), transparent);
  pointer-events: none;
}

.botc-toolbar-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  font-size: .58rem; font-family: var(--botc-font-title);
  letter-spacing: .04em; color: var(--botc-text-dim);
  background: transparent; border: 0;
  padding: 5px 6px; border-radius: var(--botc-radius-sm);
  transition: color .15s, background .15s; cursor: pointer;
}
.botc-toolbar-btn i { font-size: 1.1rem; margin-bottom: 1px; }
.botc-toolbar-btn:hover, .botc-toolbar-btn.active {
  color: var(--botc-gold2);
  background: rgba(200,168,75,.08);
}

.botc-toolbar-btn-kill {
  flex: 1.5;
  background: linear-gradient(135deg, var(--botc-crimson), var(--botc-blood));
  color: #f0d0a0 !important;
  border: 1px solid rgba(200,168,75,.3);
  border-radius: var(--botc-radius-sm);
  box-shadow: none;
}
.botc-toolbar-btn-kill:hover {
  background: linear-gradient(135deg, #a82020, var(--botc-crimson));
  box-shadow: none;
}

/* ── Log Area ────────────────────────────────────────────────── */
#botc-log-area {
  flex: 0 0 auto; max-height: 32vh; overflow-y: auto;
  padding: 6px 14px; background: rgba(7,8,18,.65);
  border-top: 1px solid var(--botc-border);
  font-size: .78rem; font-family: var(--botc-font-body);
  -webkit-overflow-scrolling: touch;
}
.botc-log-entry {
  padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.03);
  color: var(--botc-text-dim); line-height: 1.45;
}
.botc-log-entry:last-child { border-bottom: 0; }
.botc-log-entry strong { color: var(--botc-text); font-family: var(--botc-font-title); font-size: .9em; letter-spacing: .03em; }
.botc-log-warn { color: rgba(232,201,110,.55); font-size: .68rem; font-style: italic; }

/* ── Slide Panels ────────────────────────────────────────────── */
.botc-panel-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
  z-index: 500; opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.botc-panel-backdrop.open { opacity: 1; pointer-events: all; }

.botc-panel {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: linear-gradient(180deg, var(--botc-stone3) 0%, var(--botc-stone) 100%);
  border-top: 1px solid var(--botc-border);
  border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(22px + var(--safe-bottom));
  z-index: 501;
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.32,.72,0,1);
  max-height: 82vh; overflow-y: auto;
}
/* Parchment inner */
.botc-panel::before {
  content: ''; position: absolute; inset: 0;
  background: var(--botc-parchment); pointer-events: none;
  border-radius: inherit;
}
.botc-panel.open { transform: translateY(0); }
.botc-panel-handle {
  width: 38px; height: 4px;
  background: rgba(200,168,75,.2); border-radius: 2px;
  margin: 0 auto 18px;
}

/* ── Settings Panel ──────────────────────────────────────────── */
.botc-setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid rgba(200,168,75,.07);
  position: relative;
}
.botc-setting-row:last-child { border-bottom: 0; }
.botc-setting-label {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--botc-font-title);
  font-size: .7rem; letter-spacing: .06em; color: var(--botc-text);
}
.botc-setting-label i { color: var(--botc-gold); width: 16px; text-align: center; }

/* Toggle switch */
.botc-toggle {
  width: 42px; height: 22px;
  background: rgba(255,255,255,.1); border-radius: 11px;
  position: relative; cursor: pointer;
  transition: background .2s; border: 1px solid rgba(255,255,255,.08);
}
.botc-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #777; border-radius: 50%;
  transition: left .2s, background .2s;
}
.botc-toggle.on { background: rgba(139,26,26,.65); border-color: rgba(192,57,43,.4); }
.botc-toggle.on::after { left: 22px; background: #e06060; }

/* Lang toggle */
.botc-lang-toggle {
  display: flex; border: 1px solid var(--botc-border); border-radius: 999px; overflow: hidden;
}
.botc-lang-opt {
  padding: 3px 12px;
  font-family: var(--botc-font-title); font-size: .65rem; letter-spacing: .06em;
  cursor: pointer; color: var(--botc-text-dim); transition: background .15s, color .15s;
}
.botc-lang-opt.active { background: var(--botc-crimson); color: #f0ddb0; }

/* ── Kill Banner ─────────────────────────────────────────────── */
#botc-kill-banner {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 900; pointer-events: none; opacity: 0;
  transition: opacity .3s;
}
#botc-kill-banner.show { opacity: 1; }
.botc-kill-banner-text {
  font-family: var(--botc-font-title);
  font-size: 1.8rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase;
  text-align: center; padding: 18px 28px;
  border-radius: var(--botc-radius);
  border: 2px solid var(--botc-gold);
  background: rgba(7,8,18,.96);
  box-shadow: 0 0 50px rgba(200,168,75,.35), 0 10px 40px rgba(0,0,0,.9);
  color: var(--botc-gold2);
  text-shadow: 0 0 24px rgba(200,168,75,.6);
  max-width: 80vw;
}

/* ── Result Screen ───────────────────────────────────────────── */
#botc-result-screen {
  position: fixed; inset: 0;
  display: none; flex-direction: column;
  align-items: center; justify-content: flex-start;
  overflow-y: auto;
  padding: 24px 18px calc(24px + var(--safe-bottom));
  background: var(--botc-bg);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(200,168,75,.1) 0%, transparent 55%);
  z-index: 800;
}
#botc-result-screen.show { display: flex; }
.botc-result-header { text-align: center; margin-bottom: 26px; }
.botc-result-title-win {
  font-family: var(--botc-font-title); font-size: 2.5rem; font-weight: 900;
  letter-spacing: .16em; color: var(--botc-gold2);
  text-shadow: 0 0 32px rgba(200,168,75,.6);
  animation: victory-glow 2.5s ease-in-out infinite alternate;
}
.botc-result-title-lose {
  font-family: var(--botc-font-title); font-size: 2rem; font-weight: 700;
  letter-spacing: .12em; color: #c04040;
  text-shadow: 0 0 22px rgba(192,57,43,.5);
}
@keyframes victory-glow {
  from { text-shadow: 0 0 22px rgba(200,168,75,.4); }
  to   { text-shadow: 0 0 44px rgba(200,168,75,.85), 0 0 90px rgba(200,168,75,.3); }
}

/* ── Confetti canvas ─────────────────────────────────────────── */
#botc-confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 850; }

/* ── Auth Pages ──────────────────────────────────────────────── */
.botc-auth-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 18px calc(24px + var(--safe-bottom));
  position: relative; z-index: 1;
}

.botc-auth-card {
  width: 100%; max-width: 368px;
  background: linear-gradient(145deg, var(--botc-stone3), var(--botc-stone));
  border: 1px solid var(--botc-border);
  border-radius: var(--botc-radius);
  padding: 30px 26px;
  box-shadow: 0 12px 50px rgba(0,0,0,.65), 0 0 50px rgba(200,168,75,.05);
  position: relative; overflow: hidden;
}
.botc-auth-card::before {
  content: ''; position: absolute; inset: 0;
  background: var(--botc-parchment); pointer-events: none;
}
.botc-auth-card::after {
  content: '❧';
  position: absolute; top: -13px; left: 50%;
  transform: translateX(-50%);
  font-size: 1.4rem; color: var(--botc-gold);
  background: var(--botc-stone3); padding: 0 10px;
}
.botc-form-label {
  font-family: var(--botc-font-title);
  font-size: .68rem; letter-spacing: .1em;
  color: var(--botc-gold); text-transform: uppercase;
  margin-bottom: 4px; font-weight: 400;
}
.botc-form-control {
  background: rgba(0,0,0,.45) !important;
  border: 1px solid var(--botc-border) !important;
  color: var(--botc-text) !important;
  border-radius: var(--botc-radius-sm) !important;
  font-family: var(--botc-font-body) !important;
  font-size: .92rem !important;
  padding: .55rem .85rem !important;
  transition: border-color .15s, box-shadow .15s !important;
}
.botc-form-control:focus {
  border-color: rgba(200,168,75,.52) !important;
  box-shadow: 0 0 0 3px rgba(200,168,75,.12) !important;
  outline: none !important; background: rgba(0,0,0,.55) !important;
}
.botc-form-control::placeholder { color: var(--botc-text-faint) !important; }
.botc-check-msg { font-size: .7rem; min-height: 18px; margin-top: 3px; }
.botc-terms-box {
  max-height: 132px; overflow-y: auto;
  font-family: var(--botc-font-body);
  font-size: .74rem; color: var(--botc-text-dim);
  border: 1px solid var(--botc-border);
  border-radius: var(--botc-radius-sm);
  padding: 10px 14px; margin-bottom: 12px;
  background: rgba(0,0,0,.25); line-height: 1.65;
}
.botc-terms-box h6 {
  font-family: var(--botc-font-title); color: var(--botc-gold);
  font-size: .72rem; margin: 10px 0 4px; font-weight: 400; letter-spacing: .06em;
}

/* ── Start / Lobby Page ──────────────────────────────────────── */
.botc-start-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 0 calc(24px + var(--safe-bottom));
  position: relative; z-index: 1;
}

.botc-start-header {
  width: 100%; display: flex; align-items: center;
  justify-content: space-between; padding: 10px 16px;
  position: sticky; top: 0; z-index: 50;
  background: rgba(7,8,18,.82);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--botc-border);
}
.botc-start-header::before {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,168,75,.15), transparent);
  pointer-events: none;
}

.botc-start-body {
  width: 100%; max-width: 468px;
  padding: 10px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}

/* Mode switch pills */
.botc-mode-switch { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.botc-mode-item {
  font-family: var(--botc-font-title);
  font-size: .7rem; letter-spacing: .06em; font-weight: 400;
  padding: .35rem .95rem;
  border: 1px solid var(--botc-border); border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--botc-text-dim); cursor: pointer; transition: all .15s;
}
.botc-mode-item.active {
  background: linear-gradient(135deg, var(--botc-crimson), var(--botc-blood));
  border-color: rgba(200,168,75,.42); color: #f0ddb0;
  box-shadow: none;
}

/* Difficulty button */
.botc-diff-btn {
  font-family: var(--botc-font-title);
  font-size: .74rem; letter-spacing: .06em; font-weight: 400;
  padding: .38rem 1rem;
  background: rgba(200,168,75,.08);
  border: 1px solid rgba(200,168,75,.28); border-radius: 999px;
  color: var(--botc-gold2); cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; gap: 7px;
}
.botc-diff-btn:hover { background: rgba(200,168,75,.16); border-color: rgba(200,168,75,.45); }

/* Hint rows */
.botc-hint {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: .8rem; line-height: 1.55; color: var(--botc-text-dim);
  font-family: var(--botc-font-body);
}
.botc-hint:last-child { border-bottom: 0; }
.botc-hint i { margin-top: 2px; width: 16px; text-align: center; color: var(--botc-gold); }

/* Mode description */
.botc-mode-desc {
  background: rgba(0,0,0,.28); border: 1px solid var(--botc-border);
  border-radius: var(--botc-radius-sm); padding: 10px 14px; width: 100%;
  position: relative; overflow: hidden;
}
.botc-mode-desc::before {
  content: ''; position: absolute; inset: 0;
  background: var(--botc-parchment); pointer-events: none;
}
.botc-mode-desc-title {
  font-family: var(--botc-font-title);
  font-size: .68rem; letter-spacing: .08em; color: var(--botc-gold);
  margin-bottom: 6px; display: flex; align-items: center; gap: 7px; font-weight: 400;
}
.botc-mode-desc ul {
  margin: 0; padding-left: 18px;
  font-size: .8rem; color: var(--botc-text-dim); line-height: 1.65;
  font-family: var(--botc-font-body);
}

/* ── Ranking Page ─────────────────────────────────────────────── */
.botc-rank-wrap {
  min-height: 100vh;
  padding: 0 18px calc(26px + var(--safe-bottom));
  max-width: 490px; margin: 0 auto;
  position: relative; z-index: 1;
}

.botc-rank-tabs {
  display: flex; border: 1px solid var(--botc-border); border-radius: var(--botc-radius-sm); overflow: hidden;
}
.botc-rank-tab {
  flex: 1; text-align: center; padding: 7px 4px;
  font-family: var(--botc-font-title); font-size: .64rem; letter-spacing: .06em;
  color: var(--botc-text-dim); cursor: pointer;
  transition: background .15s, color .15s;
  border-right: 1px solid var(--botc-border);
}
.botc-rank-tab:last-child { border-right: 0; }
.botc-rank-tab.active { background: rgba(139,26,26,.42); color: var(--botc-gold2); }

.botc-rank-table { width: 100%; border-collapse: collapse; font-size: .8rem; font-family: var(--botc-font-body); }
.botc-rank-table th {
  font-family: var(--botc-font-title); font-size: .62rem; letter-spacing: .08em;
  color: var(--botc-gold); padding: 8px 6px; border-bottom: 1px solid var(--botc-border);
  text-align: left; text-transform: uppercase; font-weight: 400;
}
.botc-rank-table td {
  padding: 7px 6px; border-bottom: 1px solid rgba(255,255,255,.03);
  color: var(--botc-text); vertical-align: middle;
}
.botc-rank-table tr:hover td { background: rgba(200,168,75,.04); }

.rank-1 { color: var(--botc-gold3); font-family: var(--botc-font-title); font-size: .82rem; }
.rank-2 { color: #c0c0c0; font-family: var(--botc-font-title); }
.rank-3 { color: #c07828; font-family: var(--botc-font-title); }

.botc-rank-me td { background: rgba(139,26,26,.1) !important; }
.botc-rank-guest { font-size: .62rem; color: var(--botc-text-dim); }

.botc-my-stats { display: flex; justify-content: space-around; padding: 10px 0 4px; }
.botc-my-stat-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.botc-my-stat-item .val {
  font-family: var(--botc-font-title); font-size: 1.2rem; color: var(--botc-gold2); letter-spacing: .04em;
}
.botc-my-stat-item .lbl {
  font-family: var(--botc-font-title); font-size: .6rem; color: var(--botc-text-dim); letter-spacing: .07em;
}

/* ── Gem Badge ────────────────────────────────────────────────── */
.botc-gem-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--botc-font-title); font-size: .75rem;
  color: #a0d8f0;
}
.botc-gem-badge i { color: #59c7ff; }

/* ── Modal overrides ─────────────────────────────────────────── */
.botc-modal .modal-content {
  background: linear-gradient(145deg, var(--botc-stone3), var(--botc-stone));
  border: 1px solid var(--botc-border); color: var(--botc-text);
  box-shadow: 0 20px 60px rgba(0,0,0,.8), 0 0 40px rgba(200,168,75,.05);
}
.botc-modal .modal-header { border-bottom: 1px solid var(--botc-border); font-family: var(--botc-font-title); }
.botc-modal .modal-title { color: var(--botc-gold2); font-size: .92rem; letter-spacing: .06em; font-weight: 400; }
.botc-modal .btn-close { filter: invert(.7) sepia(.3); }

/* ── Ability card in modal ────────────────────────────────────── */
.botc-ability-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04);
}
.botc-ability-item:last-child { border-bottom: 0; }
.botc-ability-icon { font-size: 1rem; margin-top: 2px; }
.botc-ability-body { flex: 1; min-width: 0; }
.botc-ability-name {
  font-family: var(--botc-font-title); font-size: .75rem; letter-spacing: .04em;
  color: var(--botc-gold2); margin-bottom: 2px; font-weight: 400;
}
.botc-ability-text { font-size: .78rem; color: var(--botc-text-dim); line-height: 1.55; }
.botc-ability-type {
  font-family: var(--botc-font-title); font-size: .58rem; letter-spacing: .06em;
  color: var(--botc-text-dim); background: rgba(255,255,255,.06);
  border-radius: 4px; padding: 1px 6px;
}

/* ── Difficulty item ─────────────────────────────────────────── */
.botc-diff-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; border-radius: var(--botc-radius-sm);
  border: 1px solid var(--botc-border);
  margin-bottom: 6px; cursor: pointer;
  transition: background .15s, border-color .15s;
  background: rgba(255,255,255,.03);
}
.botc-diff-item:hover { background: rgba(200,168,75,.07); border-color: rgba(200,168,75,.32); }
.botc-diff-item.active { background: rgba(139,26,26,.28); border-color: rgba(200,168,75,.48); }
.botc-diff-name { font-family: var(--botc-font-title); font-size: .78rem; color: var(--botc-text); font-weight: 400; }
.botc-diff-strikes { font-family: var(--botc-font-body); font-size: .7rem; color: var(--botc-text-dim); font-style: italic; }

/* ── Select guide ────────────────────────────────────────────── */
.botc-select-guide {
  position: fixed; bottom: 72px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--botc-font-title); font-size: .7rem; letter-spacing: .06em;
  color: var(--botc-gold2);
  background: rgba(7,8,18,.92);
  border: 1px solid var(--botc-border); border-radius: 999px;
  padding: 5px 18px; z-index: 20;
  text-align: center; white-space: nowrap;
  animation: pulse-guide .9s ease-in-out infinite alternate;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
@keyframes pulse-guide {
  from { opacity: .65; }
  to   { opacity: 1; }
}

/* ── Phase indicator ─────────────────────────────────────────── */
.botc-phase {
  font-family: var(--botc-font-title); font-size: .68rem;
  letter-spacing: .08em; padding: 3px 12px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.1);
}
.botc-phase-day   { background: rgba(180,130,50,.22); color: #e0b060; border-color: rgba(200,168,75,.32); }
.botc-phase-night { background: rgba(26,16,55,.45); color: #9080c8; border-color: rgba(100,80,160,.32); }

/* ── Member tokens row (topbar) ───────────────────────────────── */
.botc-member-list {
  display: flex; gap: 6px; flex-wrap: nowrap;
  overflow-x: auto; padding: 2px 0;
  -webkit-overflow-scrolling: touch;
}
.botc-member-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--botc-font-title); font-size: .6rem; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--botc-border);
  background: rgba(255,255,255,.04); color: var(--botc-text-dim);
}
.botc-member-chip.dead { opacity: .38; text-decoration: line-through; }

/* ── Spinner / Loading ────────────────────────────────────────── */
.botc-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(200,168,75,.18);
  border-top-color: var(--botc-gold); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbars ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.3); }
::-webkit-scrollbar-thumb { background: rgba(200,168,75,.28); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(200,168,75,.48); }
* { scrollbar-width: thin; scrollbar-color: rgba(200,168,75,.28) rgba(0,0,0,.3); }

/* ── Responsive tweaks ────────────────────────────────────────── */
@media (max-width: 380px) {
  .botc-token-grid { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
  .botc-title { font-size: 1.5rem !important; }
}
@media (min-width: 600px) {
  .botc-token-grid { max-width: 520px; }
  .botc-start-body { max-width: 510px; }
}
