:root {
  color-scheme: dark;
  --bg: #100e10;
  --surface: #191619;
  --raised: #221d20;
  --line: #3c3235;
  --text: #f8f0e6;
  --muted: #c5b7b4;
  --accent: #efc090;
  --accent-ink: #291519;
  --gutter: 5vw;
  font: 16px/1.5 Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
body.modal-open { overflow: hidden; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: wait; }
button:focus, a:focus, input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 4px; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible) { outline: none; }
.tv button:focus, .tv a:focus { outline: 3px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { line-height: 1.08; }
.display { font-family: Georgia, 'Times New Roman', serif; font-weight: normal; letter-spacing: -.05em; }
.eyebrow { color: var(--accent); font-size: .85rem; letter-spacing: .14em; font-weight: bold; text-transform: uppercase; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .9rem; }
.icon { width: 1.15em; height: 1.15em; vertical-align: middle; margin-right: .3em; }
.loading { padding: 4rem var(--gutter); }
.brand { display: inline-flex; align-items: center; text-decoration: none; font-size: 1.02rem; font-weight: bold; letter-spacing: -.01em; white-space: nowrap; }
.brand img { width: 2.45rem; height: 2.45rem; margin-right: .55rem; }
.environment-badge { margin-left: .65rem; padding: .15rem .5rem; border: 1px solid #926645; border-radius: 1rem; background: #382318; color: #ffe0b8; font-size: .75rem; letter-spacing: normal; }
[data-environment="production"] .environment-badge { border-color: #5b866e; background: #20372b; color: #e0f5e7; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.65rem; padding: .62rem 1rem; border: 1px solid var(--line); border-radius: .42rem; background: var(--raised); color: var(--text); text-decoration: none; font-weight: bold; }
.button:hover { border-color: #8b6a6a; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.primary:hover { background: #fad1a9; }
.subtle { background: transparent; }
.warn { color: #ffbfad; }
.link { border: 0; background: transparent; color: var(--accent); text-decoration: underline; padding: .25rem; }
.tag { display: inline-block; padding: .18rem .5rem; border: 1px solid #765550; border-radius: .25rem; color: var(--accent); font-weight: bold; font-size: .84rem; }
.error { padding: .65rem .8rem; background: #392027; color: #ffd1c5; border-radius: .35rem; margin: .8rem 0 0; }
label.field { display: block; margin: 0 0 1rem; }
.field > span { display: block; margin-bottom: .3rem; font-size: .95rem; font-weight: bold; }
input:not([type=checkbox]):not([type=range]), select, textarea {
  width: 100%; background: #141114; border: 1px solid #4c3b40; border-radius: .32rem; color: var(--text); padding: .65rem .72rem;
}
textarea { resize: vertical; min-height: 5.8rem; }
.check { display: inline-flex; align-items: center; margin: .5rem 1.35rem .5rem 0; }
.check input { margin: 0 .5rem 0 0; accent-color: var(--accent); }
input[type=range] { accent-color: var(--accent); }

.signin { min-height: 100vh; padding: 2rem var(--gutter) 4rem; background: linear-gradient(90deg, rgba(12,7,10,.98) 0%, rgba(12,7,10,.86) 35%, rgba(12,7,10,.03) 85%), url('/assets/intro.jpg') center / cover; }
.signin-content { width: 100%; max-width: 30rem; margin-top: 9vh; }
.signin h1 { font-size: 4rem; margin: .7rem 0 .85rem; }
.signin form { max-width: 23rem; padding-top: 1rem; }
.signin form .button { width: 100%; margin-top: .2rem; }
.signin form small { display: block; margin-top: .6rem; color: var(--muted); }
.signin .field { margin-bottom: .85rem; }

.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 4.6rem; padding: .65rem var(--gutter); border-bottom: 1px solid var(--line); background: #100d10; }
.top-actions { display: flex; align-items: center; flex-wrap: wrap; }
.top-actions > * { margin-left: .55rem; }
.top-actions .user { color: var(--muted); max-width: 14rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hero { min-height: 32rem; position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: flex-end; padding: 4rem var(--gutter); }
.hero-image { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero::before { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: -1; background: linear-gradient(0deg, var(--bg), transparent 40%), linear-gradient(90deg, rgba(16,14,16,.98), rgba(16,14,16,.8) 27%, rgba(16,14,16,.12) 75%); }
.hero-copy { max-width: 43rem; }
.hero .display { font-size: 4.3rem; margin: .65rem 0; }
.hero-text { max-width: 36rem; color: #f0e3df; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.hero .button, .detail .button { margin-right: .55rem; }
.meta { color: var(--muted); margin: .45rem 0 1rem; }
.catalog { padding: .4rem var(--gutter) 4rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 1rem; }
.section-head h2 { margin: 0; }
.search { width: 18rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.4rem, 1fr)); grid-gap: 1rem; }
.card { min-width: 0; display: block; text-align: left; border: 1px solid var(--line); border-radius: .45rem; overflow: hidden; padding: 0; color: var(--text); background: var(--surface); }
.card:hover { border-color: var(--accent); }
.cover { position: relative; padding-top: 141%; display: block; background: radial-gradient(ellipse at 70% 35%, #593838, #24171e 65%, #151114); }
.cover img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.cover > span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 2rem; color: var(--accent); }
.card-copy { display: block; padding: .68rem .78rem; }
.card-copy strong, .card-copy .hint { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { border: 1px dashed var(--line); border-radius: .55rem; padding: 1.8rem; color: var(--muted); }
.hero .empty { border: none; padding: 0; }

.admin { display: grid; grid-template-columns: 13rem minmax(0, 1fr); min-height: calc(100vh - 4.6rem); }
.sidebar { padding: 2rem 1.15rem; border-right: 1px solid var(--line); }
.sidebar > button { width: 100%; text-align: left; justify-content: flex-start; margin: 0 0 .55rem; }
.sidebar .active { background: #38262b; border-color: #6e5051; color: var(--accent); }
.workspace { padding: 2rem 4vw 4rem; width: 100%; max-width: 100rem; }
.admin-heading { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.25rem; }
.admin-heading h1 { font-size: 3.25rem; margin: 0 0 .42rem; }
.admin-heading p { margin: 0; }
.admin-heading .button { margin-top: .65rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: .85rem; margin-bottom: 1.65rem; }
.stat, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: .55rem; padding: 1rem 1.15rem; }
.stat strong { display: block; margin-top: .3rem; font-size: 1.65rem; line-height: 1; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .78rem .6rem; border-bottom: 1px solid var(--line); font-size: .95rem; }
.table th { font-weight: normal; color: var(--muted); }
.table td:last-child { text-align: right; }
.table-box { overflow: auto; }
.table .button { margin: .15rem 0 .15rem .3rem; }
.inline-form { display: flex; align-items: end; flex-wrap: wrap; margin-bottom: 1.3rem; }
.inline-form .field { min-width: 16rem; margin: 0 .65rem .55rem 0; }
.inline-form .button { margin-bottom: .55rem; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, .85fr); grid-gap: .85rem; align-items: start; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-column-gap: .65rem; }
.media-slots { margin-bottom: .15rem; }
.media-slot { border-top: 1px solid var(--line); padding: .85rem 0; }
.media-slot:first-child { border-top: 0; }
.media-slot h3 { font-size: 1rem; margin: 0 0 .1rem; }
.media-slot p { margin: .1rem 0 .45rem; }
.media-slot .button { min-height: 2.25rem; font-size: .92rem; }
.file-row { display: flex; align-items: center; margin: .38rem 0; }
.file-row img { width: 2.7rem; height: 2.1rem; object-fit: cover; margin-right: .55rem; border-radius: .25rem; }
.file-row span { flex: 1; min-width: 0; word-wrap: break-word; }
.file-row small { display: block; color: var(--muted); }
.form-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; padding-top: .85rem; }
.form-footer .button { margin-left: .4rem; }
.invite-box { margin-bottom: 1rem; }

.overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 10; background: rgba(8,6,8,.84); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { width: 100%; max-width: 39rem; max-height: 94vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: .6rem; padding: 1.3rem; box-shadow: 0 1rem 4rem #080508; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .85rem; }
.modal-head h2 { margin: 0; }
.file-list { border: 1px solid var(--line); border-radius: .3rem; overflow: auto; max-height: 32vh; margin: .55rem 0; }
.file-list button { display: block; width: 100%; padding: .55rem .65rem; color: var(--text); text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); }
.file-list button:hover { background: var(--raised); }
.file-list p { padding: .6rem; margin: 0; }
.modal progress { display: block; width: 100%; margin: .55rem 0; accent-color: var(--accent); }
.detail { max-width: 54rem; padding: 0; }
.detail-art { position: relative; overflow: hidden; background: #342329; }
.detail-art img { display: block; width: 100%; max-height: 30vh; object-fit: cover; }
.detail-art .button { position: absolute; top: .75rem; right: .25rem; }
.detail-content { padding: 1.2rem 1.5rem 1.65rem; }
.detail-content .display { font-size: 3.1rem; margin: .4rem 0; }
.detail-content p { white-space: pre-wrap; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); grid-gap: .62rem; }
.gallery img { width: 100%; height: 7rem; object-fit: cover; border-radius: .35rem; }

.playing { padding: 0; background: #000; }
.player { position: relative; width: 100%; height: 100%; }
.player video { width: 100%; height: 100%; object-fit: contain; }
.player-preparation { position: absolute; top: 50%; left: 50%; width: 30rem; max-width: 82%; transform: translate(-50%, -50%); padding: 1.15rem 1.35rem; background: #1c1618; border: 1px solid var(--line); border-radius: .55rem; pointer-events: none; }
.player-preparation p { margin: 0 0 .65rem; }
.player-preparation progress { display: block; width: 100%; height: .65rem; accent-color: var(--accent); }
.player-top, .player-controls { position: absolute; left: 0; right: 0; padding: 1.35rem var(--gutter); }
.player-top { top: 0; display: flex; align-items: center; background: linear-gradient(rgba(0,0,0,.82), transparent); }
.player-top h2 { margin: 0 0 0 1rem; font-size: 1.25rem; }
.player-controls { bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.9)); }
.transport { display: flex; align-items: center; flex-wrap: wrap; }
.transport .button { margin: .28rem .5rem .25rem 0; }
.transport-time { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.seek { display: block; width: 100%; margin: 0 0 .7rem; }
.notice { position: fixed; z-index: 20; bottom: 1rem; right: 1rem; width: 30rem; max-width: 92vw; background: var(--raised); border: 1px solid var(--line); border-radius: .45rem; padding: .75rem 1rem; margin: 0; }

@media (min-width: 1000px) { .tv { font-size: 1.22vw; } .tv .admin { display: none; } }
@media (max-width: 850px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { display: flex; border-right: 0; border-bottom: 1px solid var(--line); padding: .75rem var(--gutter) .2rem; }
  .sidebar .button { width: auto; margin-right: .5rem; }
  .editor-grid { grid-template-columns: 1fr; }
  .workspace { padding-left: var(--gutter); padding-right: var(--gutter); }
}
@media (max-width: 550px) {
  .signin { background-position: 62% center; }
  .signin h1, .hero .display { font-size: 3rem; }
  .top-actions .user { display: none; }
  .top-actions .button { font-size: .85rem; padding: .4rem .5rem; }
  .brand { font-size: .9rem; }
  .brand img { width: 2rem; height: 2rem; }
  .brand .environment-badge { margin-left: .35rem; padding: .12rem .32rem; font-size: .65rem; }
  .hero { min-height: 27rem; padding-bottom: 2rem; }
  .hero::before { background: linear-gradient(0deg, var(--bg) 0%, rgba(16,14,16,.85) 38%, rgba(16,14,16,.2) 100%); }
  .section-head { display: block; }
  .search { width: 100%; margin-top: .7rem; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: .7rem; }
}

.detail-art { min-height: 3.8rem; }
.detail-content .button { margin-bottom: .8rem; }

.tv-pair { display: grid; grid-template-columns: minmax(0, 33rem) 20rem; grid-gap: 2.5rem; align-items: center; margin-top: 7vh; }
.tv-pair h1 { font-size: 3.65rem; }
.pair-card { text-align: center; color: var(--text); background: #241a1e; border: 1px solid #5b4245; border-radius: .6rem; padding: 1rem; }
.pair-card > span, .pair-card > strong { display: block; }
.pair-qr { display: block; width: 100%; max-width: 16rem; height: auto; margin: 0 auto .7rem; border-radius: .25rem; background: #fff; }
.pair-code { font-size: 2rem; letter-spacing: .24em; padding-left: .24em; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.25; }
.phone-code { display: inline-block; margin-bottom: 1rem; padding: .55rem 1rem; background: var(--raised); border: 1px solid var(--line); border-radius: .4rem; }
.pair-actions > .button { margin: 0 .55rem .55rem 0; }
.signin-content > .button { margin-top: .8rem; }
@media (max-width: 720px) {
  .tv-pair { grid-template-columns: minmax(0, 27rem); grid-gap: 1rem; margin-top: 5vh; }
  .tv-pair h1 { font-size: 2.8rem; }
  .pair-qr { max-width: 13rem; }
}

.video-report { padding: .8rem; margin-bottom: .8rem; border: 1px solid var(--line); border-radius: .4rem; }
.video-report p { margin: 0 0 .4rem; overflow-wrap: break-word; }
.video-report ul { margin: .2rem 0 0; padding-left: 1.3rem; color: var(--muted); }
.video-upload-actions > .button { margin: 0 .45rem .4rem 0; }
.playing:fullscreen { width: 100%; height: 100%; }
.playing:-webkit-full-screen { width: 100%; height: 100%; }
