/* Two skins on one layout: the day skin (몽글 파스텔) is the default, html[data-theme="night"]
   (심야 스튜디오) overrides the tokens and the few components whose shape changes. theme.js sets
   the attribute before first paint; app.js keeps it on the station clock. */

:root {
  --bg: #fff7f0;
  --ink: #3a2e3f;
  --muted: #6f6478;
  --card: #ffffff;
  --line: #f0e4e8;
  --line-strong: #e9d9e0;
  --lavender: #b596e8;
  --brand: #7a5bc4;
  --mint: #7fd8c4;
  --pink: #f49ac1;
  --blue: #3f86bd;
  --peach: #e08a2e;
  --live: #ff5c7a;
  --live-ink: #d8305a;
  --now-bg: #f3ecff;
  --portrait-bg: #fdf3ff;
  --frame-bg: #ffffff;
  --frame-border: 0 solid transparent;
  --frame-shadow: 0 18px 40px rgba(181, 150, 232, 0.28), 0 1px 0 #f0e4e8;
  --frame-pad: 10px;
  --frame-radius: 30px;
  --tv-radius: 22px;
  --tv-bg: #f6ecff;
  --overlay: rgba(28, 23, 36, 0.55);
  --btn-bg: linear-gradient(120deg, #f49ac1, #b596e8);
  --btn-ink: #ffffff;
  --btn-shadow: 0 10px 30px rgba(244, 154, 193, 0.5);
  --radius-card: 18px;
  --radius-btn: 999px;
  --display: "Jua", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --body: "Gowun Dodum", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

html[data-theme="night"] {
  --bg: #120f17;
  --ink: #f3eef7;
  --muted: #b4a9c2;
  --card: #1d1725;
  --line: #2d2538;
  --line-strong: #3b3048;
  --lavender: #c9b3ff;
  --brand: #f3eef7;
  --blue: #7fd8c4;
  --live-ink: #ff5c7a;
  --now-bg: transparent;
  --portrait-bg: #2a2236;
  --frame-bg: #221a33;
  --frame-border: 1px solid #3b3048;
  --frame-shadow: 0 0 48px rgba(201, 179, 255, 0.22), 0 30px 60px rgba(0, 0, 0, 0.6);
  --frame-pad: 0px;
  --frame-radius: 14px;
  --tv-radius: 13px;
  --tv-bg: #221a33;
  --overlay: rgba(11, 9, 16, 0.62);
  --btn-bg: #c9b3ff;
  --btn-ink: #120f17;
  --btn-shadow: 0 0 30px rgba(201, 179, 255, 0.45);
  --radius-card: 12px;
  --radius-btn: 10px;
  --display: "Black Han Sans", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --body: "Gothic A1", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); color: var(--ink); }

body {
  font-family: var(--body);
  padding: 0 16px 48px;
  line-height: 1.5;
}

/* Header */

.top {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 0 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 8px; }
.logo .cloud { width: 46px; height: 31px; display: block; }
.logo .wordmark { font-family: var(--display); font-size: 32px; letter-spacing: -0.5px; color: var(--brand); line-height: 1; }
.slogan { color: var(--muted); font-size: 14px; }

.status { display: flex; align-items: center; gap: 14px; font-size: 14px; }

.live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-family: var(--display); font-size: 15px; }
.live .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: inline-block; }
.live.on { color: var(--live-ink); }
.live.on .dot { background: var(--live); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.clock { font-variant-numeric: tabular-nums; color: var(--muted); }
.clock small { font-size: 12px; }

html[data-theme="night"] .top { padding: 24px 0 18px; border-bottom: 1px solid var(--line); }
html[data-theme="night"] .logo .cloud { display: none; }
html[data-theme="night"] .logo .wordmark { font-size: 38px; letter-spacing: 0; }
html[data-theme="night"] .live {
  padding: 7px 14px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
}
html[data-theme="night"] .live .dot { width: 8px; height: 8px; }
html[data-theme="night"] .live.on .dot { animation: glow 1.6s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { opacity: 1; box-shadow: 0 0 12px var(--live); }
  50% { opacity: 0.55; box-shadow: 0 0 2px var(--live); }
}
html[data-theme="night"] .clock { color: var(--ink); font-size: 32px; font-weight: 700; letter-spacing: 0.04em; line-height: 1; }
html[data-theme="night"] .clock small { font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0.1em; }

/* Stage: the TV, its controls and the headline card */

.layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

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

.frame {
  background: var(--frame-bg);
  border: var(--frame-border);
  border-radius: var(--frame-radius);
  padding: var(--frame-pad);
  box-shadow: var(--frame-shadow);
}

.tv {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--tv-radius);
  overflow: hidden;
  background: var(--tv-bg);
}

.tv canvas, .tv video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.tv video { object-fit: cover; display: none; background: #000; }
.tv.film video { display: block; }
.tv.film canvas { pointer-events: none; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  backdrop-filter: blur(2px);
}
.overlay.hidden { display: none; }

#powerBtn {
  font-family: var(--display);
  font-size: 22px;
  color: var(--btn-ink);
  background: var(--btn-bg);
  border: 0;
  border-radius: var(--radius-btn);
  padding: 16px 34px;
  cursor: pointer;
  box-shadow: var(--btn-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
#powerBtn small { font-family: var(--body); font-size: 12px; opacity: 0.9; }

.controls {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.ghost {
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-btn);
  padding: 10px 18px;
  min-height: 44px;
  cursor: pointer;
}
.ghost:hover { border-color: var(--lavender); }

.now { display: grid; gap: 4px; font-size: 14px; min-width: 0; }
.slot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.slot .label {
  min-width: 40px;
  text-align: center;
  color: #ffffff;
  background: var(--brand);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
}
.slot.up-next .label { background: var(--blue); }
.slot strong { font-family: var(--display); font-weight: 400; font-size: 16px; }
.slot.up-next strong { font-size: 15px; }
.slot .meta { color: var(--muted); font-size: 13px; }

html[data-theme="night"] .controls { align-items: stretch; gap: 12px; }
html[data-theme="night"] .ghost { font-weight: 700; border-color: var(--line-strong); min-height: 48px; }
html[data-theme="night"] .now {
  flex: 1 1 320px;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 12px;
}
html[data-theme="night"] .slot {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
}
html[data-theme="night"] .slot .label {
  min-width: 0;
  padding: 0;
  background: none;
  color: var(--lavender);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}
html[data-theme="night"] .slot.up-next .label { color: var(--mint); }
html[data-theme="night"] .slot strong { font-family: var(--body); font-weight: 700; font-size: 18px; line-height: 1.2; }
html[data-theme="night"] .slot .meta { font-size: 12px; }

.story {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: grid;
  gap: 8px;
}
.story[hidden] { display: none; }
.story h2 {
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 15px;
  font-weight: 400;
}
.story h2 .label { color: #ffffff; background: var(--brand); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.story h2 strong { font-family: var(--display); font-weight: 400; font-size: 16px; }
.story ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; line-height: 1.45; }
.story li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; }
.story li .source { color: var(--muted); }
.story li a { color: inherit; text-decoration: none; }
.story li a:hover { text-decoration: underline; }

html[data-theme="night"] .story h2 .label { background: none; padding: 0; color: var(--lavender); font-size: 11px; font-weight: 700; letter-spacing: 0.16em; }
html[data-theme="night"] .story h2 strong { font-family: var(--body); font-weight: 700; font-size: 15px; }

/* Guide */

.guide {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px 12px 10px;
  min-width: 0;
}
.guide h2 {
  margin: 0 4px 8px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.guide h2 small { color: var(--muted); font-family: var(--body); font-size: 12px; }
.guide ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.guide li {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 13px;
  align-items: baseline;
}
.guide li .when { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.guide li .what { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; min-width: 0; }
.guide li .what strong { font-family: var(--display); font-weight: 400; font-size: 14px; }
.guide li .what span { color: var(--muted); font-size: 12px; }
.guide li.on-now { background: var(--now-bg); }
.guide li.on-now .what strong::after { content: " · 방송 중"; color: var(--live-ink); font-size: 11px; }
.guide li.up-next .what strong::after { content: " · 다음"; color: var(--blue); font-size: 11px; }
.guide li.video .what strong::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent var(--peach);
  margin-right: 6px;
  vertical-align: 1px;
}

html[data-theme="night"] .guide { padding: 16px 18px 10px; }
html[data-theme="night"] .guide h2 { margin: 0 0 10px; font-size: 20px; }
html[data-theme="night"] .guide ol { position: relative; gap: 0; }
html[data-theme="night"] .guide ol::before { content: ""; position: absolute; left: 8px; top: 12px; bottom: 12px; width: 1px; background: var(--line); }
html[data-theme="night"] .guide li {
  grid-template-columns: 18px 82px minmax(0, 1fr);
  gap: 10px;
  padding: 5px 0;
  border-radius: 0;
  align-items: start;
  line-height: 1.25;
  background: none;
}
html[data-theme="night"] .guide li::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line);
  border: 1px solid var(--line-strong);
  justify-self: center;
  margin-top: 4px;
}
html[data-theme="night"] .guide li .when { padding-top: 1px; letter-spacing: 0.02em; }
html[data-theme="night"] .guide li .what { flex-direction: column; gap: 1px; align-items: flex-start; }
html[data-theme="night"] .guide li .what strong {
  font-family: var(--body);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
html[data-theme="night"] .guide li .what span { font-size: 11px; line-height: 1.3; }
html[data-theme="night"] .guide li.on-now::before { background: var(--lavender); border-color: var(--lavender); box-shadow: 0 0 10px var(--lavender); }
html[data-theme="night"] .guide li.on-now .what strong { color: var(--lavender); }
html[data-theme="night"] .guide li.on-now .what strong::after,
html[data-theme="night"] .guide li.up-next .what strong::after {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  padding: 1px 6px;
  border-radius: 999px;
}
html[data-theme="night"] .guide li.on-now .what strong::after { content: "방송 중"; background: var(--lavender); color: var(--bg); }
html[data-theme="night"] .guide li.up-next::before { background: var(--bg); border-color: var(--mint); }
html[data-theme="night"] .guide li.up-next .what strong { color: var(--mint); }
html[data-theme="night"] .guide li.up-next .what strong::after { content: "다음"; background: var(--bg); color: var(--mint); border: 1px solid var(--mint); }
html[data-theme="night"] .guide li.video .what strong::before { border-width: 5px 0 5px 9px; border-color: transparent transparent transparent var(--muted); }

/* Cast */

.cast { max-width: 1180px; margin: 28px auto 0; }
.cast h2 { font-family: var(--display); font-weight: 400; font-size: 18px; margin: 0 0 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.card .portrait {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--accent, var(--lavender));
  background: var(--portrait-bg);
}
.card .portrait img, .card .portrait canvas { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; display: block; }
.card strong { display: block; font-family: var(--display); font-weight: 400; font-size: 17px; }
.card .role { font-size: 12px; color: var(--muted); }
.card .tag { font-size: 12px; margin-top: 4px; line-height: 1.4; }

html[data-theme="night"] .cards { gap: 14px; }
html[data-theme="night"] .card { grid-template-columns: 1fr; gap: 8px; padding: 16px; border-radius: 14px; align-items: start; }
html[data-theme="night"] .card .portrait { width: 88px; height: 88px; box-shadow: 0 0 18px color-mix(in srgb, var(--accent, var(--lavender)) 40%, transparent); }
html[data-theme="night"] .card strong { font-family: var(--body); font-weight: 700; font-size: 18px; line-height: 1.2; }
html[data-theme="night"] .card .tag { font-size: 13px; line-height: 1.5; }

/* Footer */

.foot {
  max-width: 1180px;
  margin: 28px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  border-top: 1px dashed var(--line-strong);
  padding-top: 16px;
}
.foot p { margin: 0; }

html[data-theme="night"] .foot { border-top: 1px solid var(--line); font-size: 13px; line-height: 1.65; padding-top: 18px; }

/* ?stream: the TV alone, edge to edge, for OBS */

html.stream body { padding: 0; background: #000; }
html.stream .top, html.stream .controls, html.stream .story, html.stream .guide, html.stream .cast, html.stream .foot { display: none; }
html.stream .layout { display: block; max-width: none; }
html.stream .frame { padding: 0; border: 0; border-radius: 0; box-shadow: none; background: #000; }
html.stream .tv { border-radius: 0; width: 100vw; height: 100vh; aspect-ratio: auto; }
html.stream .overlay { background: rgba(28, 23, 36, 0.3); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .logo .wordmark { font-size: 26px; }
  html[data-theme="night"] .logo .wordmark { font-size: 30px; }
  html[data-theme="night"] .clock { font-size: 24px; }
}
