:root {
  --bg: #08090d;
  --surface: #11131a;
  --surface-2: #171923;
  --border: rgba(255, 255, 255, 0.14);
  --text: #f7f1e5;
  --muted: #b9b0a0;
  --gold: #d6ae54;
  --red: #9f3f32;
  --green: #51684b;
  --radius: 8px;
  --glass: rgba(14, 16, 22, 0.46);
  --glass-strong: rgba(14, 16, 22, 0.68);
  --glass-line: rgba(255, 255, 255, 0.18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }
body.deck-open { overflow: hidden; }
button, a { font: inherit; }
button { cursor: pointer; }

.home {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(5,6,9,0.92) 0%, rgba(5,6,9,0.70) 40%, rgba(5,6,9,0.30) 70%, rgba(5,6,9,0.50) 100%),
    url('/images/rome-colosseum-hero.png') center / cover no-repeat;
}

.home::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8,9,13,0.10), rgba(8,9,13,0.92)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 96px);
}

.site-top {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0.72rem 0.78rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  top: 0.75rem;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.035)), var(--glass);
  box-shadow: 0 18px 70px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.14);
  backdrop-filter: blur(18px) saturate(132%);
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 850;
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.top-actions button,
.top-actions a {
  min-height: 38px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.075);
  color: var(--text);
  padding: 0 0.8rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.top-actions button:hover,
.top-actions a:hover {
  border-color: var(--gold);
  background: rgba(214,174,84,0.14);
}

.home-hero {
  position: relative;
  z-index: 1;
  min-height: 76vh;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(320px,520px);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(3.2rem, 7vw, 6.2rem) 0 2.2rem;
}

.home-copy { max-width: 680px; position: relative; }

.kicker {
  width: fit-content;
  margin: 0 0 0.9rem;
  color: var(--gold);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  padding: 0.42rem 0.72rem;
  border-radius: var(--radius);
  border: 1px solid rgba(214,174,84,0.34);
  background: rgba(214,174,84,0.10);
  backdrop-filter: blur(12px);
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 7.4vw, 6.25rem);
  line-height: 0.94;
  text-shadow: 0 18px 72px rgba(0,0,0,0.68);
}

.subtitle {
  margin: 1.2rem 0 0;
  font-size: clamp(1.25rem, 2.8vw, 2rem);
  color: #fff3d2;
  font-weight: 650;
}

.author {
  margin: 0.65rem 0 0;
  color: var(--gold);
  font-weight: 750;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
}

.intro {
  max-width: 620px;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.2rem);
  line-height: 1.55;
}

.home-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}

.home-stats {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}

.home-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--glass-line);
  background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.035)), var(--glass);
  color: var(--muted);
  backdrop-filter: blur(16px) saturate(128%);
}

.home-stats strong { color: var(--text); }

.primary-action,
.secondary-action,
#controls button,
#controls a,
#ov-close {
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.035)), rgba(17,19,26,0.72);
  transition: border-color 0.16s, background 0.16s, transform 0.12s;
  box-shadow: 0 12px 38px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.10);
  backdrop-filter: blur(14px) saturate(130%);
}

.primary-action {
  background: linear-gradient(135deg, #f3d891, var(--gold) 52%, #a96f2c);
  color: #181108;
  border-color: rgba(255,255,255,0.2);
  font-weight: 800;
  box-shadow: 0 16px 48px rgba(214,174,84,0.20), inset 0 1px 0 rgba(255,255,255,0.38);
}

.primary-action:hover,
.secondary-action:hover,
#controls button:hover,
#controls a:hover,
#ov-close:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.secondary-action:hover,
#controls button:hover,
#controls a:hover,
#ov-close:hover {
  background: rgba(214,174,84,0.16);
}

.preview {
  position: relative;
  display: block;
  width: 100%;
  padding: 0.55rem;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.045)), var(--glass);
  box-shadow: 0 30px 90px rgba(0,0,0,0.50), inset 0 1px 0 rgba(255,255,255,0.14);
  transform: rotate(1.5deg);
  backdrop-filter: blur(18px) saturate(132%);
  cursor: pointer;
}

.preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
}

.preview-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius);
  background: rgba(8,9,13,0.64);
  border: 1px solid var(--glass-line);
  color: var(--gold);
  font-weight: 800;
  backdrop-filter: blur(12px);
}

.home-band {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding-bottom: 2rem;
}

.home-band article {
  min-height: 168px;
  padding: 1.15rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.11), rgba(255,255,255,0.035)), var(--glass-strong);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  box-shadow: 0 18px 55px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.10);
  backdrop-filter: blur(16px) saturate(128%);
}

.home-band span { color: var(--gold); font-weight: 800; font-size: 0.85rem; }
.home-band h2 { margin: 0.65rem 0 0.45rem; font-size: 1.15rem; }
.home-band p { margin: 0; color: var(--muted); line-height: 1.45; }

#app.loading {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(8,9,13,0.92);
}

#deck {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: #07080c;
}

#stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: clamp(0.55rem, 1.8vw, 1.25rem);
  background:
    radial-gradient(920px 520px at 14% 8%, rgba(214,174,84,0.13), transparent 57%),
    radial-gradient(820px 500px at 92% 88%, rgba(159,63,50,0.16), transparent 58%),
    #07080c;
}

.modern-slide {
  --slide-bg: none;
  width: min(100%, calc((100vh - 102px) * 16 / 9));
  aspect-ratio: 16/9;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background-color: #1a1208;
  background-image: var(--slide-bg);
  background-size: cover;
  background-position: center;
  box-shadow: 0 30px 105px rgba(0,0,0,0.66), inset 0 1px 0 rgba(255,255,255,0.16);
}

.modern-slide.tone-gold { --slide-tint: rgba(214,174,84,0.17); --slide-tint-2: rgba(159,63,50,0.10); }
.modern-slide.tone-red  { --slide-tint: rgba(159,63,50,0.17);  --slide-tint-2: rgba(214,174,84,0.10); }
.modern-slide.tone-green{ --slide-tint: rgba(81,104,75,0.18);  --slide-tint-2: rgba(214,174,84,0.10); }

.slide-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7,8,12,0.62) 0%, rgba(7,8,12,0.30) 45%, rgba(7,8,12,0.10) 100%);
}

.modern-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  border-left: clamp(7px, 0.7vw, 12px) solid var(--gold);
  pointer-events: none;
  z-index: 1;
}

.modern-slide::after { content: none; }

.slide-shell {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(1rem, 2vw, 2.05rem);
}

.slide-header,
.slide-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: rgba(247,241,229,0.62);
  font-size: clamp(0.68rem, 0.95vw, 0.85rem);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.slide-header { position: relative; min-height: 32px; }

.slide-kicker,
.slide-count,
.slide-section {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.07);
  padding: 0 0.72rem;
  backdrop-filter: blur(14px) saturate(135%);
}

.slide-section {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: 42%;
  justify-content: center;
  color: #fff4d8;
  font-weight: 900;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, rgba(214,174,84,0.26), rgba(255,255,255,0.07));
  border-color: rgba(214,174,84,0.34);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slide-kicker { color: var(--gold); font-weight: 850; }

.slide-main {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(1.1rem, 2.2vw, 2.1rem);
  align-items: center;
  padding: clamp(0.55rem, 1.2vw, 1.25rem) 0;
}

.slide-title-block {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: clamp(0.5rem, 1vw, 0.9rem);
}

.title-pill {
  width: 100%;
  overflow: hidden;
  padding: clamp(0.6rem, 1.2vw, 1.1rem) clamp(0.7rem, 1.4vw, 1.3rem);
  border-radius: 12px;
  border: 1px solid rgba(214,174,84,0.42);
  background:
    linear-gradient(135deg, rgba(214,174,84,0.26), rgba(255,255,255,0.08)),
    linear-gradient(145deg, rgba(8,9,13,0.62), rgba(8,9,13,0.30));
  box-shadow: 0 22px 58px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.18);
  backdrop-filter: blur(8px) saturate(135%);
}

.slide-title-block h2 {
  margin: 0;
  color: #fff4d8;
  font-size: 30px;
  line-height: 1.3;
  word-break: break-word;
}

.slide-title-block p {
  margin: clamp(0.7rem, 1.2vw, 1rem) 0 0;
  color: var(--gold);
  font-weight: 750;
  font-size: clamp(0.88rem, 1.15vw, 1.08rem);
  padding-left: clamp(0.3rem, 0.7vw, 0.65rem);
}

.slide-content-card {
  list-style: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.32rem, 0.6vw, 0.55rem);
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: clamp(0.72rem, 1.1vw, 1rem) clamp(0.82rem, 1.25vw, 1.18rem);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)),
    rgba(8,9,13,0.36);
  box-shadow: 0 18px 52px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.10);
  backdrop-filter: blur(8px) saturate(128%);
}

.slide-body {
  margin: 0;
  color: rgba(247,241,229,0.92);
  font-size: clamp(0.78rem, 1.0vw, 1.0rem);
  line-height: 1.45;
}
.slide-body:has(.bullet-item) {
  padding-left: 1.1em;
  position: relative;
}
.slide-body:has(.bullet-item)::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 0.8em;
  top: 0.12em;
}

.slide-visual {
  min-height: 54%;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 18px 60px rgba(0,0,0,0.35);
}

.modern-slide.visual-mode .slide-main {
  grid-template-columns: minmax(300px, 0.75fr) minmax(360px, 1.25fr);
}

.modern-slide.visual-mode .slide-title-block h2 {
  font-size: 30px;
}

.slide-footer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#progress { height: 4px; background: rgba(255,255,255,0.08); }
#progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green));
  transition: width 0.25s ease;
}

#controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem;
  flex-wrap: wrap;
  background: rgba(9,10,15,0.92);
  border-top: 1px solid var(--border);
}

#controls button,
#controls a {
  min-width: 44px;
  height: 42px;
  font-size: 0.9rem;
}

#counter {
  min-width: 82px;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

#cur { color: var(--text); font-weight: 800; }

#overview {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(8,9,13,0.98);
  display: flex;
  flex-direction: column;
}

#overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--border);
}

#overview-head strong { font-weight: 700; }
#ov-title { color: var(--gold); }
#ov-close { min-height: 38px; }

#overview-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.8rem;
  padding: clamp(1rem, 4vw, 2.5rem);
  align-content: start;
}

.ov-item {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s, transform 0.1s;
}

.ov-item:hover { border-color: var(--gold); transform: translateY(-2px); }
.ov-item img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #111; }
.ov-item .cap {
  display: block;
  min-height: 48px;
  padding: 0.55rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--muted);
}
.ov-item .cap b { color: var(--text); }

#hint {
  position: fixed;
  left: 50%;
  bottom: 74px;
  z-index: 8;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.82rem;
  background: rgba(8,9,14,0.82);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: opacity 0.6s;
  pointer-events: none;
}

@media (max-width: 860px) {
  .home-hero { min-height: auto; grid-template-columns: 1fr; padding-top: 1.35rem; gap: 1.2rem; }
  h1 { font-size: clamp(3.05rem, 13.5vw, 5.25rem); line-height: 0.93; }
  .home-band { grid-template-columns: 1fr; }
  .slide-footer { display: none; }
  .slide-main { grid-template-columns: 0.88fr 1.12fr; }
  .slide-title-block h2 { font-size: clamp(1.55rem, 4.5vw, 2.85rem); }
  .content-line { font-size: clamp(0.74rem, 1.95vw, 0.9rem); }
}

@media (max-width: 640px) {
  .home-hero, .home-band { width: min(100% - 22px, 1180px); }
  h1 { font-size: clamp(3rem, 15.2vw, 4.72rem); line-height: 0.91; }
  .home-actions { display: grid; grid-template-columns: 1fr; }
  .primary-action, .secondary-action { width: 100%; }
  #controls { justify-content: stretch; }
  #controls button, #controls a { flex: 1 1 auto; padding: 0 0.7rem; }
  #btn-fs { display: none; }
  .modern-slide { width: min(100%, calc((100vh - 152px) * 16 / 9)); border-radius: 10px; }
  .modern-slide.text-mode { width: min(100%, 430px); height: calc(100vh - 152px); min-height: 560px; aspect-ratio: auto; }
  .slide-shell { padding: 0.72rem; }
  .slide-header { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 0.45rem; font-size: 0.62rem; }
  .slide-section { position: static; transform: none; grid-column: 1/-1; justify-self: center; max-width: 86%; min-height: 24px; padding: 0 0.58rem; order: 3; }
  .slide-main { grid-template-columns: 1fr; gap: 0.55rem; align-content: start; padding: 0.42rem 0 0; }
  .slide-title-block { padding: 0.62rem; border-radius: 8px; }
  .title-pill { padding: 0.58rem 0.68rem; border-radius: 8px; }
  .slide-title-block h2 { font-size: clamp(1.35rem, 6.2vw, 2.22rem); line-height: 1; }
  .slide-title-block p { margin-top: 0.42rem; font-size: clamp(0.72rem, 2.6vw, 0.86rem); }
  .slide-content-card { gap: 0.38rem; padding: 0.55rem; border-radius: 8px; }
  .content-line { font-size: clamp(0.66rem, 2.55vw, 0.82rem); line-height: 1.16; padding-bottom: 0.4rem; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
