/* ═══════════════════════════════════════════════
   МАФИЯ: ОЛИМП — Главная таблица стилей
   Тема: Древняя Греция / Олимп
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Crimson+Pro:ital,wght@0,400;0,500;0,600;1,400;1,500&display=swap');

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

/* ── CSS Variables ─────────────────────────── */
:root {
  --sky:      #e8f4f8;
  --sky2:     #c8e8f4;
  --marble:   #f5f0e8;
  --marble2:  #ede5d4;
  --marble3:  #d8ccb4;
  --sand:     #c4a96c;
  --sand2:    #a88848;
  --gold:     #d4952a;
  --gold2:    #f0b93a;
  --gold3:    #ffd060;
  --terracotta: #c05030;
  --terracotta2: #a03820;
  --olive:    #6a8a3a;
  --olive2:   #4e6e28;
  --sea:      #2878a8;
  --sea2:     #1a5888;
  --night:    #1a2840;
  --night2:   #0e1828;
  --blood:    #8a1c1c;
  --blood2:   #6a0e0e;

  --bg:       var(--sky);
  --surface:  var(--marble);
  --card:     var(--marble2);
  --card2:    #e8dfc8;
  --text:     #2a1e0a;
  --text2:    #4a3820;
  --muted:    #7a6848;
  --border:   #c0a878;
  --border2:  #a89060;

  --shadow-sm: 0 2px 8px rgba(100,70,20,.15);
  --shadow-md: 0 4px 20px rgba(100,70,20,.2);
  --shadow-lg: 0 8px 40px rgba(100,70,20,.25);
}

html { height: 100%; font-size: 16px; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Crimson Pro', serif;
  overflow-x: hidden;
  transition: background .6s ease, color .4s ease;
}

/* ── Night mode atmosphere ─────────────────────── */
body.night-mode {
  --bg:       #1a2440;
  --surface:  #1e2a48;
  --card:     #222e50;
  --card2:    #283660;
  --text:     #c8d8f0;
  --text2:    #9aa8c0;
  --muted:    #6878a0;
  --border:   #3a4a70;
  --border2:  #4a5a80;
  --marble:   #1e2a48;
  --marble2:  #222e50;
  --marble3:  #3a4a70;
}

body.night-mode::before {
  background:
    radial-gradient(ellipse 100% 60% at 50% -5%, rgba(26,36,64,.9) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(60,40,120,.15) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 0% 80%, rgba(20,60,100,.15) 0%, transparent 60%);
}

body.night-mode .hdr {
  background: rgba(30,42,72,.95);
  border-bottom-color: var(--border);
}

body.night-mode .phase-banner { background: var(--card); border-color: var(--border); }
body.night-mode .my-role-bar  { background: var(--card2); border-color: var(--border); }
body.night-mode .pcard        { background: var(--card); border-color: var(--border); }
body.night-mode .action-panel { background: var(--card); border-color: var(--border); }
body.night-mode .players-section { }
body.night-mode .pcard.me::after { background: linear-gradient(90deg, transparent, var(--sea2), transparent); }
body.night-mode .btn-action.muted { color: var(--muted); border-color: var(--border); }

/* ── Background texture ────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 100% 60% at 50% -5%, rgba(200,232,244,.8) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(212,149,42,.12) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 0% 80%, rgba(106,138,58,.1) 0%, transparent 60%);
  transition: background .6s ease;
}

body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg,
    var(--gold) 0%, var(--terracotta) 25%,
    var(--sea) 50%, var(--olive) 75%, var(--gold) 100%);
  z-index: 200;
}

/* ── Utility ───────────────────────────────────── */
.z1 { position: relative; z-index: 1; }

/* ── Header ────────────────────────────────────── */
.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
  background: rgba(245,240,232,.95);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  transition: background .4s, border-color .4s;
}
.hdr-left { display: flex; flex-direction: column; gap: .05rem; }
.hdr-title {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: .06em;
  color: var(--terracotta);
  line-height: 1;
}
.hdr-room {
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hdr-badge {
  font-family: 'Cinzel', serif;
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .28rem .75rem;
  border: 1.5px solid;
  font-weight: 600;
  transition: all .4s;
  white-space: nowrap;
}

/* ── Phase banner ──────────────────────────────── */
.phase-banner {
  text-align: center;
  padding: .85rem 1.2rem;
  margin: .75rem 1rem .3rem;
  border: 1.5px solid var(--border);
  background: var(--card);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: background .4s, border-color .4s;
}
.phase-banner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.pb-label {
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .25rem;
  font-family: 'Cinzel', serif;
}
.pb-title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.pb-sub {
  font-size: .9rem;
  color: var(--text2);
  margin-top: .3rem;
  font-style: italic;
}

/* Phase colour tints */
.ph-night_mafia  .phase-banner,
.ph-night_start  .phase-banner { background: #e8d8c8; border-color: var(--sand); }
.ph-night_mafia  .pb-title     { color: var(--blood); }
.ph-night_start  .pb-title     { color: var(--night); }
.ph-night_doctor .phase-banner { background: #d8e8f0; border-color: var(--sea2); }
.ph-night_doctor .pb-title     { color: var(--sea); }
.ph-night_sheriff .phase-banner{ background: #e8f0d8; border-color: var(--olive); }
.ph-night_sheriff .pb-title    { color: var(--olive2); }
.ph-day_discuss  .pb-title,
.ph-day_vote     .pb-title     { color: var(--terracotta); }

/* Night mode phase banner overrides */
body.night-mode .ph-night_mafia .phase-banner,
body.night-mode .ph-night_start .phase-banner { background: rgba(138,28,28,.2); border-color: rgba(180,60,60,.4); }
body.night-mode .ph-night_mafia .pb-title     { color: #ff8080; }
body.night-mode .ph-night_start .pb-title     { color: #a0c0e0; }
body.night-mode .ph-night_doctor .phase-banner { background: rgba(24,88,136,.2); border-color: rgba(40,120,180,.4); }
body.night-mode .ph-night_doctor .pb-title     { color: #80c0f0; }
body.night-mode .ph-night_sheriff .phase-banner{ background: rgba(78,110,40,.2); border-color: rgba(80,140,50,.4); }
body.night-mode .ph-night_sheriff .pb-title    { color: #b0e090; }

/* ── Day badge ─────────────────────────────────── */
.day-badge {
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: .7rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: .2rem 0 .5rem;
}

/* ── Announce strip ────────────────────────────── */
.announce {
  margin: .4rem 1rem;
  padding: .85rem 1rem;
  background: rgba(212,149,42,.1);
  border: 1.5px solid rgba(212,149,42,.4);
  font-size: 1rem;
  line-height: 1.65;
  text-align: center;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ── My role bar ───────────────────────────────── */
.my-role-bar {
  margin: .35rem 1rem;
  padding: .5rem .9rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  border: 1.5px solid var(--border);
  background: var(--card2);
  color: var(--text2);
  box-shadow: var(--shadow-sm);
  transition: background .4s, border-color .4s;
}
.mr-emoji { font-size: 1.15rem; }
.mr-name  { font-weight: 600; color: var(--text); font-family: 'Cinzel', serif; font-size: .72rem; }
.mr-sep   { flex: 1; }

/* ── Timer ─────────────────────────────────────── */
.timer-wrap {
  margin: .1rem 1rem .15rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.timer-bar-bg {
  flex: 1;
  height: 4px;
  background: var(--marble3);
  border-radius: 2px;
  overflow: hidden;
}
.timer-bar {
  height: 100%;
  background: var(--gold);
  transition: width .5s linear;
  width: 100%;
  border-radius: 2px;
}
.timer-label {
  font-family: 'Cinzel', serif;
  font-size: .68rem;
  color: var(--muted);
  min-width: 2.4rem;
  text-align: right;
}

/* ── Players grid ──────────────────────────────── */
.players-section { padding: .5rem 1rem; }
.section-label {
  font-family: 'Cinzel', serif;
  font-size: .7rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .5rem;
}
.players-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
}

.pcard {
  background: var(--card);
  border: 1.5px solid var(--border);
  padding: .6rem .75rem;
  cursor: default;
  transition: all .2s;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  gap: .12rem;
  min-height: 54px;
  box-shadow: var(--shadow-sm);
}
.pcard::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity .18s;
}
.pcard.selectable       { cursor: pointer; border-color: var(--sand); }
.pcard.selectable:active { transform: scale(.97); }
.pcard.selectable:hover::after,
.pcard.selected::after  { opacity: .8; }
.pcard.selected         { border-color: var(--gold); background: rgba(212,149,42,.12); }
.pcard.dead             { opacity: .35; filter: grayscale(.85); }
.pcard.dead .pcard-name { text-decoration: line-through; text-decoration-color: var(--muted); }
.pcard.dead .pcard-name::after { content: ' ✝'; color: var(--muted); text-decoration: none; }
.pcard.voted-target     { border-color: var(--terracotta); background: rgba(192,80,48,.08); }
.pcard.me               { border-color: var(--sea); }
.pcard.me::after        { opacity: .4; background: linear-gradient(90deg, transparent, var(--sea), transparent); }
.pcard.dc               { border-style: dashed; opacity: .55; }

.pcard-name {
  font-size: .95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.pcard-meta {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  min-height: 1.1rem;
}
.pcard-role  { font-size: .85rem; }
.pcard-badge {
  font-family: 'Cinzel', serif;
  font-size: .6rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.vote-count  { font-size: .72rem; color: var(--terracotta); font-weight: 700; }
.admin-crown { font-size: .75rem; }
.check-badge {
  font-size: .65rem;
  padding: .08rem .35rem;
  border: 1px solid;
  border-radius: 2px;
}
.check-badge.mafia   { color: var(--blood); border-color: var(--blood); }
.check-badge.citizen { color: var(--olive2); border-color: var(--olive); }

/* ── Vote tally with progress bar ──────────────── */
.vote-tally {
  margin: .3rem 1rem;
  padding: .45rem .75rem;
  border: 1.5px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.vote-tally-label {
  font-size: .78rem;
  color: var(--muted);
  text-align: center;
  font-family: 'Cinzel', serif;
  margin-bottom: .3rem;
}
.vote-tally-bar-bg {
  height: 4px;
  background: var(--marble3);
  border-radius: 2px;
  overflow: hidden;
}
.vote-tally-bar {
  height: 100%;
  background: var(--terracotta);
  border-radius: 2px;
  transition: width .4s ease;
}

/* ── Event log ─────────────────────────────────── */
.event-log {
  margin: .55rem 1rem;
  border: 1.5px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: background .4s, border-color .4s;
}
.log-toggle {
  display: flex;
  align-items: center;
  gap: .4rem;
  width: 100%;
  padding: .55rem .75rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: .75rem;
  letter-spacing: .1em;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.log-toggle:hover { background: rgba(0,0,0,.03); }
.log-count {
  color: var(--muted);
  font-size: .68rem;
}
.log-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.event-log.open .log-body {
  max-height: 280px;
  overflow-y: auto;
}
.log-item {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  padding: .35rem .75rem;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  line-height: 1.4;
  color: var(--text2);
}
.log-icon { font-size: .8rem; flex-shrink: 0; }
.log-day {
  font-family: 'Cinzel', serif;
  font-size: .62rem;
  color: var(--muted);
  min-width: 3.5rem;
  flex-shrink: 0;
  letter-spacing: .05em;
}
.log-text { flex: 1; }
.log-item.log-death { border-left: 3px solid var(--blood); }
.log-item.log-save  { border-left: 3px solid var(--sea); }
.log-item.log-vote  { border-left: 3px solid var(--terracotta); }
.log-item.log-check { border-left: 3px solid var(--olive); }
.log-item.log-phase { border-left: 3px solid var(--gold); }
.log-item.log-info  { border-left: 3px solid var(--sand); }

/* ── Action panel ──────────────────────────────── */
.action-panel {
  margin: .55rem 1rem;
  padding: 1rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: background .4s, border-color .4s;
}
.action-panel h3 {
  font-family: 'Cinzel', serif;
  font-size: .95rem;
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
}
.action-inst {
  font-size: .9rem;
  color: var(--text2);
  margin-bottom: .75rem;
  font-style: italic;
  line-height: 1.55;
}
.action-done {
  text-align: center;
  color: var(--olive2);
  font-style: italic;
  font-size: 1rem;
  padding: .4rem 0;
}
body.night-mode .action-done { color: #90d870; }

/* ── Buttons ───────────────────────────────────── */
.btn-action {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: .55rem;
  padding: .72rem .8rem;
  border: 1.5px solid var(--border);
  background: var(--marble2);
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: .85rem;
  letter-spacing: .06em;
  cursor: pointer;
  transition: all .18s;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}
.btn-action:active { transform: scale(.98); }

.btn-action.primary {
  background: linear-gradient(135deg, var(--terracotta2), var(--terracotta));
  color: var(--gold3);
  border-color: var(--sand);
  box-shadow: var(--shadow-sm);
}
.btn-action.primary:active { box-shadow: none; }

.btn-action.danger {
  background: linear-gradient(135deg, var(--blood2), var(--blood));
  color: #ffd0a8;
  border-color: #b04040;
}

.btn-action.sea {
  background: linear-gradient(135deg, var(--sea2), var(--sea));
  color: #c8e8ff;
  border-color: #4090b8;
}

.btn-action.olive {
  background: linear-gradient(135deg, var(--olive2), var(--olive));
  color: #d8f0b8;
  border-color: #6a9040;
}

.btn-action.muted {
  color: var(--muted);
  border-color: var(--border);
  background: transparent;
}

.btn-action:disabled { opacity: .35; cursor: not-allowed; transform: none !important; }

/* ── Spectator notice ──────────────────────────── */
.spectator-notice {
  text-align: center;
  padding: 1.5rem 1rem;
  margin: .55rem 1rem;
  background: rgba(0,0,0,.04);
  border: 1.5px solid var(--border);
}
body.night-mode .spectator-notice { background: rgba(255,255,255,.04); }
.spec-emoji { font-size: 2.2rem; margin-bottom: .4rem; }
.spec-text  { color: var(--muted); font-style: italic; font-size: .95rem; }

/* ── Lobby ─────────────────────────────────────── */
.lobby { padding: 1rem; display: flex; flex-direction: column; gap: .75rem; }

.lobby-hd {
  text-align: center;
  padding: 1.1rem 1rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.lobby-hd h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  margin-bottom: .3rem;
  color: var(--terracotta);
}
.lobby-hd p { font-size: .9rem; color: var(--text2); }

.player-list { background: var(--card); border: 1.5px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm); }
.pl-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--border);
  font-size: .95rem;
  color: var(--text);
}
.pl-item:last-child { border-bottom: none; }
.pl-crown { font-size: .9rem; width: 1.2rem; text-align: center; }
.pl-name  { flex: 1; }
.pl-you   {
  font-family: 'Cinzel', serif;
  font-size: .65rem;
  color: var(--terracotta);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.pl-kick {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.pl-kick:hover { color: var(--blood); border-color: var(--blood); }

.lobby-info {
  text-align: center;
  font-size: .82rem;
  color: var(--muted);
  font-style: italic;
  padding: .2rem 0;
}
.lobby-city {
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: .78rem;
  color: var(--text2);
  padding: .3rem 0;
  letter-spacing: .05em;
}

/* ── Settings panels ───────────────────────────── */
.settings-block {
  background: var(--card);
  border: 1.5px solid var(--border);
  padding: .9rem 1rem;
  box-shadow: var(--shadow-sm);
}
.settings-title {
  font-family: 'Cinzel', serif;
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .7rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.sf label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: .65rem;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .3rem;
}
.sf input {
  width: 100%;
  background: var(--marble);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: .9rem;
  padding: .4rem .55rem;
  outline: none;
  transition: border-color .2s;
  -webkit-appearance: none;
  border-radius: 0;
}
.sf input:focus { border-color: var(--gold); }
.settings-hint { font-size: .72rem; color: var(--muted); font-style: italic; margin-top: .5rem; }

/* ── Role card overlay ─────────────────────────── */
#role-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245,240,232,.97);
  animation: fadeIn .3s ease;
}
.role-card {
  text-align: center;
  padding: 2.4rem 2rem;
  max-width: 340px;
  width: 90%;
  border: 2px solid var(--border);
  background: var(--marble);
  box-shadow: var(--shadow-lg);
}
.rc-emoji   { font-size: 5rem; margin-bottom: .8rem; display: block; }
.rc-name    { font-family: 'Cinzel', serif; font-size: 2rem; font-weight: 900; margin-bottom: .7rem; color: var(--terracotta); }
.rc-desc    { color: var(--text2); font-size: 1rem; line-height: 1.65; font-style: italic; margin-bottom: 1.3rem; }
.rc-team    { font-family: 'Cinzel', serif; font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; padding: .3rem .9rem; border: 1.5px solid; display: inline-block; }

/* ── Game over ─────────────────────────────────── */
.game-over {
  text-align: center;
  padding: 2rem 1rem;
  margin: .75rem 1rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-md);
}
.go-title { font-family: 'Cinzel', serif; font-size: 1.9rem; font-weight: 900; margin-bottom: .4rem; color: var(--terracotta); }
.go-sub   { font-size: 1rem; color: var(--text2); font-style: italic; margin-bottom: 1.4rem; }
.go-roles { display: grid; grid-template-columns: repeat(2,1fr); gap: .4rem; margin-bottom: 1.1rem; text-align: left; }
.go-item  { padding: .45rem .6rem; font-size: .83rem; background: var(--card2); border: 1px solid var(--border); display: flex; align-items: center; gap: .4rem; color: var(--text); }
.gr-name  { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-role  { font-size: .7rem; color: var(--muted); font-family: 'Cinzel', serif; }

/* ── Disconnect dialog ─────────────────────────── */
.dc-dialog {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(245,240,232,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .25s ease;
}
.dc-box {
  background: var(--marble);
  border: 2px solid var(--border);
  padding: 1.8rem 1.6rem;
  max-width: 320px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.dc-box h3 { font-family: 'Cinzel', serif; font-size: 1.1rem; margin-bottom: .7rem; color: var(--terracotta); }
.dc-box p  { font-size: .9rem; color: var(--text2); margin-bottom: 1.2rem; font-style: italic; }
.dc-btns   { display: flex; gap: .6rem; }
.dc-btns .btn-action { margin-top: 0; flex: 1; }

/* ── Connection overlay ────────────────────────── */
.conn-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(245,240,232,.97);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}
.conn-overlay p { color: var(--muted); font-style: italic; font-size: .95rem; }
.spin {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ── Index page ────────────────────────────────── */
.index-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.index-wrap { width: 100%; max-width: 420px; text-align: center; }
.logo { margin-bottom: 2rem; animation: fadeDown .7s ease both; }
.logo-title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: clamp(3rem, 11vw, 4.5rem);
  letter-spacing: .08em;
  color: var(--terracotta);
  line-height: 1;
  text-shadow: 2px 3px 0 rgba(160,56,32,.2), 0 8px 30px rgba(212,149,42,.2);
}
.logo-subtitle {
  font-family: 'Cinzel', serif;
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: .5rem;
}
.logo-title::after {
  content: '';
  display: block;
  height: 2px;
  margin: .5rem auto 0;
  width: 55%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.index-card {
  background: var(--marble);
  border: 1.5px solid var(--border);
  padding: 1.8rem 1.6rem;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .6s .15s ease both;
}
.field { margin-bottom: 1.1rem; text-align: left; }
.field label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: .68rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .4rem;
}
.field input {
  width: 100%;
  background: var(--sky);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-family: 'Crimson Pro', serif;
  font-size: 1.15rem;
  padding: .6rem .85rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  border-radius: 0;
}
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,149,42,.15); }
.field input::placeholder { color: var(--marble3); }
.btn-enter {
  width: 100%;
  padding: .85rem 1rem;
  margin-top: .4rem;
  background: linear-gradient(135deg, var(--terracotta2), var(--terracotta));
  border: 1.5px solid var(--sand);
  color: var(--gold3);
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .12em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all .2s;
  box-shadow: var(--shadow-md);
  -webkit-tap-highlight-color: transparent;
}
.btn-enter:active { transform: translateY(1px); box-shadow: var(--shadow-sm); }
.btn-enter:hover  { background: linear-gradient(135deg, #b04028, #d06038); }
.err-msg { color: var(--blood); font-size: .9rem; margin-top: .7rem; min-height: 1.2rem; font-style: italic; }

.roles-preview { display: flex; justify-content: center; gap: 1.2rem; margin-top: 1.6rem; flex-wrap: wrap; }
.role-pill { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.role-pill .rp-ic { font-size: 1.6rem; }
.role-pill .rp-name { font-family: 'Cinzel', serif; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.index-hint { font-size: .83rem; color: var(--muted); margin-top: 1.2rem; font-style: italic; line-height: 1.5; }

/* ── Confirm modal (replaces native confirm()) ─── */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(245,240,232,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s ease;
}
body.night-mode .confirm-modal { background: rgba(26,36,64,.92); }
.cm-box {
  background: var(--marble);
  border: 2px solid var(--border);
  padding: 1.8rem 1.6rem;
  max-width: 320px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.cm-box h3 { font-family: 'Cinzel', serif; font-size: 1.1rem; margin-bottom: .7rem; color: var(--terracotta); }
.cm-box p  { font-size: .9rem; color: var(--text2); margin-bottom: 1.2rem; font-style: italic; }
.cm-btns   { display: flex; gap: .6rem; }
.cm-btns .btn-action { margin-top: 0; flex: 1; }

/* ── Info button ──────────────────────────────── */
.info-btn {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--marble);
  color: var(--terracotta);
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  z-index: 50;
  -webkit-tap-highlight-color: transparent;
}
.info-btn:hover { background: var(--card2); border-color: var(--gold); }

/* ── Info modal ───────────────────────────────── */
.info-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(245,240,232,.97);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .25s ease;
  padding: 1rem;
}
.info-box {
  background: var(--marble);
  border: 2px solid var(--border);
  padding: 2rem 1.6rem;
  max-width: 460px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.info-close {
  position: absolute;
  top: .7rem;
  right: .9rem;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.info-close:hover { color: var(--blood); border-color: var(--blood); }
.info-box h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  color: var(--terracotta);
  margin-bottom: 1.2rem;
  text-align: center;
}
.info-content h3 {
  font-family: 'Cinzel', serif;
  font-size: .85rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 1.2rem;
  margin-bottom: .5rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}
.info-content p {
  font-size: .92rem;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: .5rem;
}
.info-content p b { color: var(--text); }

/* ── Room actions (create/join) ───────────────── */
.room-actions { margin-top: .3rem; }
.room-divider {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: .8rem 0;
}
.room-divider::before,
.room-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.room-divider span {
  font-family: 'Cinzel', serif;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.btn-join {
  background: linear-gradient(135deg, var(--sea2), var(--sea));
  border-color: #4090b8;
  color: #c8e8ff;
}
.btn-join:hover { background: linear-gradient(135deg, #1a6898, #2888b8); }

/* ── Animations ────────────────────────────────── */
@keyframes fadeIn   { from { opacity: 0; }                        to { opacity: 1; } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(16px); }  to { opacity: 1; transform: none; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(14px); }  to { opacity: 1; transform: none; } }
@keyframes spin     { to { transform: rotate(360deg); } }

.slide-up { animation: slideUp .3s ease both; }

/* ── Mobile tweaks ─────────────────────────────── */
@media (max-width: 480px) {
  .players-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .go-roles { grid-template-columns: 1fr; }
  .hdr-title { font-size: 1.1rem; }
  .pb-title { font-size: 1.2rem; }
  .btn-action { font-size: .8rem; padding: .68rem .6rem; }
  .pcard { min-height: 48px; padding: .5rem .6rem; }
}

@media (max-width: 360px) {
  .players-grid { grid-template-columns: 1fr; }
  .go-roles { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* ── Hub navigation ──────────────────────────────── */
.hub-back-link {
  display: inline-block;
  margin-bottom: .8rem;
  color: var(--muted);
  font-size: .8rem;
  text-decoration: none;
  letter-spacing: .05em;
  opacity: .7;
  transition: opacity .2s;
}
.hub-back-link:hover { opacity: 1; color: var(--terracotta); }

.hdr-hub-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-right: .5rem;
  font-size: 1.1rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  transition: background .2s, color .2s;
  flex-shrink: 0;
}
.hdr-hub-link:hover { background: rgba(0,0,0,.06); color: var(--terracotta); }
.hdr-left { flex-direction: row; align-items: center; }
.hdr-left .hdr-title { margin-right: .4rem; }
