:root {
  --accent: #d64028;
  --ink: #171412;
  --muted: #6d625d;
  --paper: #fffaf2;
  --panel: #ffffff;
  --line: rgba(23, 20, 18, 0.12);
  --green: #1f7a4d;
  --gold: #e0a316;
  --shadow: 0 12px 36px rgba(42, 25, 12, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 122, 77, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(214, 64, 40, 0.09), transparent 28%),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-shell {
  width: min(1540px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 32px;
}

.topbar,
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.brand-logo {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 18px rgba(42, 25, 12, 0.16));
}

.brand-kicker,
.eyebrow,
.slot-label {
  display: block;
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand strong {
  display: block;
  font-size: clamp(1.15rem, 2.2vw, 1.9rem);
  line-height: 1;
}

.top-actions,
.admin-actions,
.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.top-actions a,
.text-link {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-weight: 700;
}

.button,
.slot-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--ink);
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.button--primary {
  background: var(--accent);
  color: #fff;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.8);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(160px, 230px) minmax(0, 1fr) minmax(160px, 230px);
  gap: 14px;
  align-items: start;
}

.main-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.video-first-layout {
  display: grid;
  gap: 14px;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.video-stage--first {
  min-height: clamp(260px, 62vw, 630px);
}

.video-stage--first iframe {
  min-height: clamp(260px, 62vw, 630px);
}

.channel-panel--compact {
  grid-template-columns: minmax(0, 1fr) minmax(210px, 280px);
  padding: clamp(14px, 2vw, 22px);
}

.channel-panel--compact .channel-copy h1 {
  max-width: none;
  font-size: clamp(2rem, 4.8vw, 4.4rem);
}

.channel-panel--compact .channel-status {
  min-height: 150px;
}

.left-rail,
.right-rail {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 14px;
}

.channel-panel,
.money-slot,
.video-stage,
.latest-section,
.admin-panel,
.login-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.channel-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 16px;
  align-items: stretch;
  padding: clamp(18px, 3vw, 34px);
}

.channel-copy h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2.45rem, 7vw, 6.2rem);
  line-height: 0.95;
}

.lead {
  max-width: 650px;
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.48;
}

.channel-status {
  display: grid;
  align-content: end;
  gap: 8px;
  min-height: 210px;
  padding: 18px;
  background:
    linear-gradient(160deg, rgba(31, 122, 77, 0.18), transparent),
    #181410;
  color: #fff;
}

.channel-ad-panel {
  display: grid;
  align-content: center;
  min-height: 150px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.channel-ad-panel .money-slot-ad {
  min-height: 150px;
}

.channel-status span,
.channel-status small {
  color: rgba(255, 255, 255, 0.68);
}

.channel-status strong {
  font-size: 1.5rem;
  line-height: 1.08;
}

.money-slot {
  display: grid;
  gap: 10px;
  min-height: 118px;
  padding: 14px;
  overflow: hidden;
}

.money-slot img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
}

.money-slot h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.18;
}

.money-slot p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.money-slot--empty {
  background: repeating-linear-gradient(
      -45deg,
      rgba(31, 122, 77, 0.08),
      rgba(31, 122, 77, 0.08) 8px,
      rgba(255, 255, 255, 0.86) 8px,
      rgba(255, 255, 255, 0.86) 18px
    );
}

.money-slot--top,
.money-slot--footer,
.money-slot--inline,
.money-slot--feed {
  min-height: auto;
}

.money-slot--top,
.money-slot--footer {
  margin: 0 0 14px;
}

.video-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 280px;
  overflow: hidden;
}

.video-stage iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 280px;
  border: 0;
}

.video-fallback {
  display: grid;
  gap: 14px;
  justify-items: start;
  padding: 30px;
}

.latest-section {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.video-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.video-card a {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 100px;
  border: 1px solid var(--line);
  background: #fff;
  text-decoration: none;
  overflow: hidden;
}

.video-card img {
  width: 132px;
  height: 100%;
  min-height: 100px;
  object-fit: cover;
  background: #211d1a;
}

.video-card span {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  padding: 10px 10px 10px 0;
}

.video-card small {
  color: var(--green);
  font-weight: 800;
}

.video-card strong {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.empty-videos {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px dashed var(--line);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 0 0;
  color: var(--muted);
}

.floating-cta {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  gap: 2px;
  min-width: 180px;
  padding: 14px;
  border: 2px solid var(--ink);
  background: var(--gold);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.admin-body {
  background: #f6f1e9;
}

.admin-topbar,
.admin-shell {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
}

.admin-topbar h1 {
  margin: 0;
}

.admin-actions form {
  margin: 0;
}

.admin-shell {
  padding-bottom: 80px;
}

.admin-form {
  display: grid;
  gap: 14px;
}

.admin-panel,
.login-card {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.panel-heading h2,
.panel-heading p {
  margin: 0;
}

.panel-heading p,
.hint {
  color: var(--muted);
}

.form-grid,
.slot-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.slot-editor-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px;
  font-weight: 500;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.slot-editor {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.slot-editor legend {
  padding: 0 6px;
  color: var(--accent);
  font-weight: 900;
}

.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  padding: 12px 0;
  background: linear-gradient(180deg, rgba(246, 241, 233, 0), #f6f1e9 32%);
}

.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.flash {
  margin: 0;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  font-weight: 750;
}

.flash--success {
  border-color: rgba(31, 122, 77, 0.35);
  color: var(--green);
}

.flash--error {
  border-color: rgba(214, 64, 40, 0.38);
  color: var(--accent);
}

.login-card {
  width: min(420px, calc(100% - 28px));
  margin: 12vh auto 0;
}

.login-card h1 {
  margin: 0 0 18px;
}

.login-card form {
  display: grid;
  gap: 12px;
}

.login-card .text-link {
  display: inline-flex;
  margin-top: 12px;
}

@media (max-width: 1080px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .left-rail,
  .right-rail {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .slot-editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-shell,
  .admin-topbar,
  .admin-shell {
    width: min(100% - 18px, 760px);
  }

  .topbar,
  .admin-topbar,
  .panel-heading,
  .channel-panel,
  .channel-panel--compact {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .top-actions,
  .admin-actions {
    align-items: stretch;
  }

  .top-actions a,
  .admin-actions .button,
  .admin-actions form {
    width: 100%;
  }

  .channel-copy h1 {
    max-width: none;
    font-size: clamp(2.3rem, 15vw, 4.2rem);
  }

  .channel-status {
    min-height: auto;
  }

  .left-rail,
  .right-rail,
  .video-list,
  .form-grid,
  .slot-editor-grid {
    grid-template-columns: 1fr;
  }

  .video-card a {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .video-card img {
    width: 112px;
  }

  .floating-cta {
    right: 9px;
    bottom: 9px;
    left: 9px;
  }
}
