:root{
  --bg:#14100d;
  --bg-deep:#090705;
  --panel:#221a15;
  --panel-soft:#2b211b;
  --line:rgba(219,189,144,.16);
  --line-strong:rgba(230,189,128,.32);
  --text:#f4e8d2;
  --muted:#c4af90;
  --accent:#d9b06f;
  --accent-2:#b44b3d;
  --danger:#c85c4d;
  --warning:#e0b15f;
  --shadow:0 26px 70px rgba(0,0,0,.42);
  --radius:24px;
}

*{box-sizing:border-box}
html,body{min-height:100%}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:"Spectral","Georgia",serif;
  color:var(--text);
  background:
    radial-gradient(circle at 20% 14%, rgba(126,72,38,.18), transparent 22%),
    radial-gradient(circle at 78% 18%, rgba(214,157,74,.08), transparent 18%),
    linear-gradient(180deg, #231a15 0%, var(--bg) 38%, var(--bg-deep) 100%);
  position:relative;
  overflow-x:hidden;
}

body::before,
body::after{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
}

body::before{
  background:
    radial-gradient(circle at 12% 20%, rgba(255,210,140,.10), transparent 12%),
    radial-gradient(circle at 85% 14%, rgba(255,180,90,.08), transparent 10%),
    radial-gradient(circle at 50% 82%, rgba(140,68,44,.12), transparent 20%);
  opacity:.9;
}

body::after{
  background:
    linear-gradient(rgba(255,255,255,.025), rgba(255,255,255,.025)) 0 0 / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, rgba(255,255,255,.02) 0 1px, transparent 1px 46px);
  mix-blend-mode:soft-light;
  opacity:.12;
}

code{color:var(--accent)}

.home-link{
  position:relative;
  z-index:1;
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:22px 24px 0;
  max-width:1280px;
  margin:0 auto;
}

.home-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
}

.topbar{
  position:relative;
  z-index:1;
  max-width:1280px;
  margin:18px auto 0;
  padding:24px 26px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  border:1px solid var(--line);
  border-radius:32px;
  background:
    radial-gradient(circle at top left, rgba(255,231,190,.05), transparent 28%),
    linear-gradient(180deg, rgba(56,42,34,.92), rgba(26,18,14,.96));
  box-shadow:var(--shadow);
}

.topbar::after{
  content:"";
  position:absolute;
  right:18px;
  top:16px;
  width:84px;
  height:84px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(224,177,95,.14), rgba(224,177,95,0));
}

.topbarRight{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.brand{
  min-width:260px;
}

.brand .title{
  font-family:"Cinzel","Georgia",serif;
  font-size:clamp(24px,3vw,36px);
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:#f0d7a4;
}

.brand .subtitle{
  margin-top:8px;
  color:var(--muted);
  font-size:14px;
}

.counters{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.pill{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  padding:8px 14px;
  border-radius:999px;
  border:1px solid rgba(255,232,193,.08);
  background:rgba(255,240,218,.045);
  box-shadow:inset 0 1px 0 rgba(255,240,218,.04);
  font-size:13px;
  font-weight:600;
  color:var(--text);
}

.pill span{
  color:var(--muted);
  margin-right:6px;
}

.timerPill{
  min-width:132px;
  justify-content:center;
  font-variant-numeric:tabular-nums;
}

.timerInline{
  margin-top:14px;
}

.dangerText{
  color:var(--danger);
  font-weight:800;
}

.app{
  position:relative;
  z-index:1;
  max-width:1280px;
  margin:0 auto;
  padding:22px 24px 34px;
}

.view.hidden{display:none}

.panel{
  padding:22px;
  border-radius:30px;
  border:1px solid var(--line);
  background:
    radial-gradient(circle at top left, rgba(255,233,201,.04), transparent 28%),
    linear-gradient(180deg, rgba(45,32,25,.96), rgba(23,16,13,.98));
  box-shadow:var(--shadow);
}

.panelHead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}

h1{
  margin:0;
  font-family:"Cinzel","Georgia",serif;
  font-size:22px;
  font-weight:700;
  letter-spacing:.03em;
}

.hint{
  margin:14px 0 0;
  color:var(--muted);
  font-size:14px;
}

.deckTools{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
}

.inline{
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--muted);
  font-size:13px;
}

input[type="number"],
input[type="text"]{
  min-width:96px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,225,181,.1);
  background:rgba(255,242,219,.04);
  color:var(--text);
  outline:none;
  font-family:inherit;
}

input[type="number"]:focus,
input[type="text"]:focus{
  border-color:var(--line-strong);
  box-shadow:0 0 0 3px rgba(217,176,111,.08);
}

.rolesList{
  margin-top:18px;
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(340px, 1fr));
  gap:12px;
}

.roleRow{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:84px;
  padding:14px 16px;
  border-radius:22px;
  border:1px solid rgba(255,230,192,.08);
  background:
    linear-gradient(180deg, rgba(255,237,214,.025), rgba(255,237,214,.015)),
    rgba(20,14,11,.52);
  transition:transform .16s ease, border-color .18s ease, box-shadow .18s ease;
}

.roleRow::before{
  content:"";
  position:absolute;
  right:16px;
  top:16px;
  width:56px;
  height:56px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(217,176,111,.12), rgba(217,176,111,0));
  opacity:.8;
}

.roleRow:hover{
  transform:translateY(-2px);
  border-color:rgba(217,176,111,.26);
  box-shadow:0 18px 36px rgba(0,0,0,.18), 0 0 0 1px rgba(217,176,111,.06);
}

.roleRow.highlighted{
  border-color:rgba(180,75,61,.42);
  box-shadow:0 0 0 1px rgba(180,75,61,.12), 0 18px 34px rgba(0,0,0,.18);
}

.roleLeft{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}

.roleName{
  font-weight:800;
  font-size:15px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  cursor:pointer;
  transition:color .14s ease;
}

.roleName.selected{
  color:#f0c582;
}

.roleRule{
  font-size:12px;
  color:var(--muted);
}

.roleRight{
  display:flex;
  align-items:center;
  gap:10px;
  position:relative;
  z-index:1;
}

.counter{
  width:52px;
  text-align:center;
  font-weight:800;
  font-size:18px;
  color:#f0c582;
  font-variant-numeric:tabular-nums;
}

.btn{
  cursor:pointer;
  border:1px solid rgba(255,230,192,.1);
  background:rgba(255,238,214,.05);
  color:var(--text);
  padding:11px 15px;
  border-radius:16px;
  font-weight:700;
  letter-spacing:.01em;
  transition:transform .14s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
  user-select:none;
  font-family:inherit;
}

.btn:hover{
  transform:translateY(-1px);
  border-color:rgba(217,176,111,.24);
  background:rgba(255,238,214,.08);
  box-shadow:0 12px 24px rgba(0,0,0,.16);
}

.btn:active{transform:translateY(1px)}

.btn.primary{
  background:linear-gradient(135deg, rgba(217,176,111,.22), rgba(180,75,61,.12));
  border-color:rgba(217,176,111,.28);
}

.btn.ghost{
  background:transparent;
}

.btn.danger{
  background:linear-gradient(135deg, rgba(200,92,77,.22), rgba(96,25,18,.14));
  border-color:rgba(200,92,77,.34);
  color:#fff2ee;
}

.btn.small{
  padding:8px 11px;
  border-radius:12px;
  font-size:13px;
}

.btn.win{
  background:linear-gradient(135deg, rgba(255,238,214,.04), rgba(217,176,111,.05));
}

.footerActions{
  margin-top:18px;
  display:flex;
  justify-content:flex-end;
}

.centerStage{
  min-height:calc(100vh - 190px);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:16px;
  text-align:center;
}

.hidden{display:none !important}

.bigPhase{
  color:var(--muted);
  font-weight:700;
  letter-spacing:.16em;
  text-transform:uppercase;
  font-size:13px;
}

.roleButton{
  width:min(840px, 92vw);
  min-height:170px;
  padding:34px 24px;
  border-radius:34px;
  border:1px solid rgba(255,232,193,.12);
  background:
    radial-gradient(circle at top center, rgba(224,177,95,.14), transparent 28%),
    linear-gradient(180deg, rgba(58,41,30,.96), rgba(20,14,11,.98));
  color:var(--text);
  font-family:"Cinzel","Georgia",serif;
  font-size:clamp(26px,5vw,48px);
  font-weight:700;
  letter-spacing:.05em;
  cursor:pointer;
  box-shadow:var(--shadow);
}

.tinyNarration{
  padding:7px 12px;
  font-size:12px;
  border-radius:999px;
  opacity:.95;
}

.narrationText{
  color:var(--text);
  line-height:1.55;
  white-space:pre-line;
}

.smallHint{
  color:var(--muted);
  min-height:18px;
}

#flowHint{display:none}

.infiltrationMsg{
  margin-top:6px;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid rgba(255,225,181,.1);
  background:rgba(224,177,95,.08);
  color:var(--warning);
  font-weight:700;
  font-size:13px;
}

.row{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
}

.row.wrap{flex-wrap:wrap}
.gap{gap:12px}

.miniatureToolbar{
  justify-content:flex-end;
  margin-bottom:8px;
}

.rolesGrid,
.votesGrid{
  margin-top:18px;
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(240px, 1fr));
  gap:12px;
}

.votesGrid .hint{
  grid-column:1 / -1;
}

.roleCard{
  position:relative;
  overflow:hidden;
  min-height:92px;
  padding:14px 16px;
  border-radius:22px;
  border:1px solid rgba(255,230,192,.08);
  background:
    radial-gradient(circle at top left, rgba(255,233,201,.04), transparent 30%),
    linear-gradient(180deg, rgba(42,30,23,.96), rgba(22,16,13,.98));
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.roleCard::after{
  content:"";
  position:absolute;
  inset:auto 12px 10px auto;
  width:54px;
  height:54px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(217,176,111,.12), rgba(217,176,111,0));
}

.roleCard .name{
  font-weight:800;
  position:relative;
  z-index:1;
}

.roleCard .count{
  color:var(--muted);
  font-variant-numeric:tabular-nums;
  position:relative;
  z-index:1;
}

.roleCard .actions{
  display:flex;
  gap:8px;
  position:relative;
  z-index:1;
}

.voteCard.selected{
  border-color:rgba(200,92,77,.46);
  box-shadow:0 0 0 1px rgba(200,92,77,.14), 0 16px 32px rgba(0,0,0,.14);
}

.voteCountBtn{
  min-width:58px;
  text-align:center;
  font-weight:800;
  font-variant-numeric:tabular-nums;
}

.dayMessages{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.msg{
  padding:12px 14px;
  border-radius:18px;
  border:1px solid rgba(255,230,192,.08);
  background:rgba(255,238,214,.04);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.msg strong{font-weight:900}

.msg .left{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.msg .sub{
  color:var(--muted);
  font-size:13px;
}

.wins{
  margin-top:18px;
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:10px;
}

.overlay{
  position:fixed;
  inset:0;
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:rgba(8,5,4,.62);
  backdrop-filter:blur(8px);
}

.overlay.hidden{display:none}

.modal{
  width:min(560px, 92vw);
  padding:18px;
  border-radius:26px;
  border:1px solid rgba(255,230,192,.11);
  background:
    radial-gradient(circle at top left, rgba(255,233,201,.06), transparent 28%),
    linear-gradient(180deg, rgba(53,37,29,.98), rgba(24,17,13,.98));
  box-shadow:var(--shadow);
}

.modalTitle{
  margin-bottom:10px;
  font-size:16px;
  font-weight:900;
  font-family:"Cinzel","Georgia",serif;
}

.modalBody{
  color:var(--muted);
  line-height:1.45;
}

.modalActions{
  margin-top:14px;
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
}

@media (max-width:980px){
  .topbar,
  .panelHead{
    flex-direction:column;
  }

  .topbarRight,
  .deckTools{
    justify-content:flex-start;
  }
}

@media (max-width:760px){
  .home-link,
  .app{
    padding-left:16px;
    padding-right:16px;
  }

  .topbar{
    margin-left:16px;
    margin-right:16px;
    padding:20px 18px;
    border-radius:26px;
  }

  .panel{
    padding:18px;
    border-radius:24px;
  }

  .rolesList{
    grid-template-columns:1fr;
  }

  .rolesGrid,
  .votesGrid,
  .wins{
    grid-template-columns:1fr;
  }

  .roleRow,
  .roleCard,
  .msg{
    align-items:flex-start;
    flex-direction:column;
  }

  .roleRight,
  .roleCard .actions{
    width:100%;
    justify-content:flex-end;
  }

  .roleButton{
    min-height:150px;
    border-radius:28px;
  }

  .row{
    flex-wrap:wrap;
  }
}
