:root {
  --bg: #0f0e0d;
  --bg-2: #181614;
  --bg-3: #23201d;
  --line: #2e2a26;
  --text: #f4efe8;
  --muted: #a39b91;
  --dim: #6f685f;
  --accent: #e63b2e;
  --accent-ink: #fff;
  --gold: #d9b26a;
  --radius: 16px;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: #000; }
body {
  margin: 0 auto;
  max-width: 480px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }

#view { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); min-height: 100vh; }
#view.no-tabbar { padding-bottom: calc(var(--safe-b) + 32px); }

/* ---------- Header ---------- */
.brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 10px;
}
.brand__name { font: 800 22px/1 var(--serif); letter-spacing: .01em; }
.brand__name em { font-style: normal; color: var(--accent); }
.brand__sub { margin-top: 5px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-3);
  flex: none;
}
.icon-btn svg, .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { transform: scale(.94); }

.page-title { padding: 18px 16px 12px; font: 800 26px/1.1 var(--serif); }

/* ---------- Sticky date strip + chips ---------- */
.sticky {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.strip, .chips {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 8px 16px;
}
.strip::-webkit-scrollbar, .chips::-webkit-scrollbar, .cast::-webkit-scrollbar { display: none; }
.strip__month {
  flex: none; align-self: stretch; display: grid; place-items: center;
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
  padding: 0 2px;
}
.day {
  flex: none; width: 46px; padding: 7px 0 8px; border-radius: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text); position: relative;
}
.day__wd { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.day__n { font: 600 17px/1.1 var(--sans); }
.day__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); margin-top: 2px; }
.day.is-weekend .day__wd { color: var(--accent); }
.day.is-empty { opacity: .28; pointer-events: none; }
.day.is-empty .day__dot { visibility: hidden; }
.day.is-active { background: var(--text); color: var(--bg); }
.day.is-active .day__wd { color: #5a534b; }
.day.is-active .day__dot { background: var(--bg); }

.chips { padding-top: 2px; padding-bottom: 10px; }
.chip {
  flex: none; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
  font-size: 13px; font-weight: 500; white-space: nowrap;
}
.chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Day groups & event rows ---------- */
.daygroup { padding: 18px 16px 0; scroll-margin-top: 130px; }
.daygroup__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.daygroup__date { font: 700 19px/1.2 var(--serif); }
.daygroup__wd { font-size: 13px; color: var(--muted); }
.daygroup__tag { margin-left: auto; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }

.event {
  display: grid; grid-template-columns: 104px 1fr; gap: 12px;
  padding: 10px; margin-bottom: 10px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.event:active { background: var(--bg-3); }
.event__img { position: relative; width: 104px; height: 124px; border-radius: 11px; overflow: hidden; background: var(--bg-3); }
.event__img img { width: 100%; height: 100%; object-fit: cover; }
.event__body { min-width: 0; display: flex; flex-direction: column; }
.event__top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.event__time { font: 700 15px/1 var(--sans); color: var(--text); font-variant-numeric: tabular-nums; }
.event__title { margin-top: 6px; font: 700 18px/1.18 var(--serif); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.event__meta { margin-top: 4px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event__foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; gap: 8px; }

.badge {
  display: inline-block; padding: 3px 7px; border-radius: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.badge--prem { background: var(--gold); color: #1c1508; }
.badge--age { border: 1px solid var(--line); color: var(--muted); }
.event__img .badge--prem { position: absolute; left: 6px; top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.btn:active { filter: brightness(.9); transform: scale(.98); }
.btn--ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn--sold { background: var(--bg-3); color: var(--dim); pointer-events: none; }
.btn--lg { height: 48px; padding: 0 22px; font-size: 15px; width: 100%; }

.empty { padding: 56px 32px; text-align: center; color: var(--muted); }
.empty h3 { font: 700 20px/1.2 var(--serif); color: var(--text); margin-bottom: 8px; }
.empty .btn { margin-top: 18px; }

/* ---------- Repertoire ---------- */
.search { padding: 0 16px 12px; }
.search input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  font: inherit; outline: none;
}
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: var(--muted); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 16px 0; }
.card { position: relative; min-width: 0; }
.card__img { position: relative; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; background: var(--bg-3); }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card__img::after { content: ''; position: absolute; inset: 40% 0 0; background: linear-gradient(transparent, rgba(0,0,0,.82)); }
.card__next { position: absolute; left: 10px; right: 10px; bottom: 9px; z-index: 1; font-size: 12px; font-weight: 600; }
.card__next small { display: block; font-weight: 400; color: #cfc7bc; font-size: 11px; }
.card__badges { position: absolute; left: 8px; top: 8px; z-index: 1; display: flex; gap: 4px; }
.card__title { margin-top: 8px; font: 700 16px/1.2 var(--serif); }
.card__meta { margin-top: 2px; font-size: 12px; color: var(--muted); }
.heart {
  position: absolute; right: 8px; top: 8px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0,0,0,.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.heart svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linejoin: round; }
.heart.is-on svg { fill: var(--accent); stroke: var(--accent); }
.heart:active { transform: scale(.88); }

/* ---------- Show page ---------- */
.hero { position: relative; aspect-ratio: 4 / 3; background: var(--bg-3); overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ''; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent, var(--bg)); }
.hero__bar { position: absolute; inset: 12px 12px auto; z-index: 2; display: flex; justify-content: space-between; }
.hero__bar .icon-btn { background: rgba(0,0,0,.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.hero__bar .icon-btn.is-on svg { fill: var(--accent); stroke: var(--accent); }
.hero__bar > div { display: flex; gap: 8px; margin-left: auto; }

.show { padding: 0 16px; margin-top: -44px; position: relative; z-index: 1; }
.show__badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.show__title { font: 800 30px/1.08 var(--serif); }
.show__genre { margin-top: 8px; color: var(--muted); }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.fact { padding: 11px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.fact span { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.fact b { display: block; margin-top: 3px; font-weight: 600; font-size: 14px; line-height: 1.3; }

.section { margin-top: 28px; }
.section > h2 { font: 700 20px/1.2 var(--serif); margin-bottom: 12px; display: flex; align-items: baseline; gap: 8px; }
.section > h2 small { font: 400 13px var(--sans); color: var(--muted); }

.dates { display: flex; flex-direction: column; gap: 8px; }
.daterow {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
}
.daterow__d { width: 44px; text-align: center; flex: none; }
.daterow__d b { display: block; font: 700 22px/1 var(--serif); }
.daterow__d span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.daterow__info { flex: 1; min-width: 0; }
.daterow__info b { display: block; font-weight: 600; }
.daterow__info span { font-size: 12.5px; color: var(--muted); }

.about p { color: #d9d2c8; margin-bottom: 12px; }
.about.is-clamped { max-height: 9.2em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.more { color: var(--gold); font-weight: 600; font-size: 14px; padding: 4px 0; }

.cast { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.actor { flex: none; width: 92px; }
.actor__ph { width: 92px; height: 118px; border-radius: 12px; overflow: hidden; background: var(--bg-3); display: grid; place-items: center; font: 700 26px var(--serif); color: var(--dim); }
.actor__ph img { width: 100%; height: 100%; object-fit: cover; }
.actor b { display: block; margin-top: 7px; font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.actor span { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.25; margin-top: 2px; }

.credits { display: grid; gap: 0; }
.credits div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.credits div:last-child { border-bottom: 0; }
.credits span { color: var(--muted); flex: none; max-width: 45%; }
.credits b { font-weight: 500; text-align: right; }

.buybar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 30;
  width: 100%; max-width: 480px;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(transparent, var(--bg) 35%);
}
.has-buybar { padding-bottom: calc(var(--safe-b) + 96px) !important; }

/* ---------- Theatre ---------- */
.info { margin: 0 16px 12px; padding: 16px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.info h3 { font: 700 18px/1.2 var(--serif); margin-bottom: 6px; }
.info p { color: var(--muted); font-size: 14px; }
.info .btn { margin-top: 12px; }
.links { margin: 0 16px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.links button { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 15px 16px; text-align: left; border-bottom: 1px solid var(--line); font-weight: 500; }
.links button:last-child { border-bottom: 0; }
.links button:active { background: var(--bg-3); }
.links svg { width: 18px; height: 18px; fill: none; stroke: var(--dim); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 16px 12px; }
.stage { padding: 14px 10px; text-align: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; }
.stage b { display: block; font: 700 22px/1 var(--serif); color: var(--gold); }
.stage span { display: block; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.note { padding: 8px 24px 0; font-size: 12px; color: var(--dim); text-align: center; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 25;
  width: 100%; max-width: 480px; height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--dim); font-size: 10.5px; font-weight: 500; }
.tabbar a.is-on { color: var(--text); }
.tabbar a.is-on svg { stroke: var(--accent); }
.tabbar[hidden] { display: none; }

/* ---------- Calendar sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet[hidden] { display: none; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); animation: fade .2s; }
.sheet__panel {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px; max-height: 86vh; display: flex; flex-direction: column;
  background: var(--bg-2); border-radius: 22px 22px 0 0;
  padding-bottom: var(--safe-b);
  animation: rise .26s cubic-bezier(.2,.8,.2,1);
}
.sheet__grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 6px 20px; }
.sheet__head h2 { font: 700 20px var(--serif); }
.sheet__body { overflow-y: auto; padding: 0 16px 20px; }
.cal__month { margin: 14px 4px 8px; font: 700 16px var(--serif); color: var(--gold); text-transform: capitalize; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal__wd { text-align: center; font-size: 10.5px; text-transform: uppercase; color: var(--dim); padding: 4px 0; }
.cal__d {
  aspect-ratio: 1; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-weight: 600; font-size: 15px; color: var(--dim);
}
.cal__d.has { background: var(--bg-3); color: var(--text); }
.cal__d.has:active { background: var(--accent); }
.cal__d.is-today { outline: 1.5px solid var(--gold); outline-offset: -1.5px; }
.cal__d small { font-size: 9.5px; font-weight: 500; color: var(--accent); line-height: 1; }
.cal__d.is-past { opacity: .3; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translate(-50%, 100%); } }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
#view > * { animation: in .22s ease-out both; }
#view > .sticky, #view > .buybar { animation: none; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
