:root {
  color-scheme: light;
  --ink: #15171c;
  --muted: #667085;
  --line: #d9dde7;
  --paper: #f7f8fb;
  --surface: #ffffff;
  --coral: #ff5a63;
  --mint: #16c7a3;
  --amber: #ffb84d;
  --steel: #253044;
  --navy: #101722;
  --admin: #141923;
  --admin-soft: #202839;
  --radius: 8px;
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.admin-page {
  background: var(--admin);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  background: var(--paper);
}

.auth-visual {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  padding: 48px;
  color: #fff;
  background:
    linear-gradient(0deg, rgba(9, 12, 20, 0.88), rgba(9, 12, 20, 0.12) 54%, rgba(9, 12, 20, 0.46)),
    url("./assets/hero-live.png") center / cover no-repeat;
}

.brand-mark {
  position: absolute;
  top: 32px;
  left: 48px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  font-weight: 900;
  letter-spacing: 0;
}

.auth-copy {
  width: min(720px, 100%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-copy h1 {
  margin: 0;
  font-size: clamp(44px, 8vw, 104px);
  line-height: 0.95;
  letter-spacing: 0;
}

.auth-copy p:last-child {
  max-width: 520px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 48px;
  background: var(--surface);
  box-shadow: -24px 0 80px rgba(25, 31, 44, 0.12);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f0f3f8;
}

.tab-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.tab-button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 6px 16px rgba(28, 35, 50, 0.08);
}

.auth-form,
.settings-grid {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: #3d4658;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
}

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.role-switch label {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.role-switch input {
  width: auto;
  min-height: auto;
}

.primary-button,
.outline-button,
.ghost-button,
.text-button {
  min-height: 44px;
  border-radius: 7px;
  font-weight: 900;
}

.primary-button {
  border: 0;
  color: #fff;
  background: var(--coral);
  box-shadow: 0 12px 28px rgba(255, 90, 99, 0.25);
}

.primary-button.compact {
  min-height: 38px;
  padding: 0 14px;
}

.outline-button,
.ghost-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  color: var(--steel);
  background: #fff;
}

.ghost-button {
  background: #eef2f7;
}

.text-button {
  border: 0;
  color: var(--coral);
  background: transparent;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.admin-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.admin-login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  color: #fff;
  background: var(--admin);
}

.admin-login-visual {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 42px;
  background:
    linear-gradient(90deg, rgba(20, 25, 35, 0.94), rgba(20, 25, 35, 0.56)),
    url("./assets/hero-live.png") center / cover no-repeat;
}

.admin-login-visual h1 {
  margin: 0 0 12px;
  font-size: clamp(38px, 6vw, 74px);
  line-height: 1;
}

.admin-login-visual p:last-child {
  max-width: 460px;
  color: #b6c0d2;
}

.admin-login-panel {
  background: #f7f8fb;
}

.form-error {
  margin: 0;
  padding: 11px 12px;
  border: 1px solid rgba(255, 90, 99, 0.24);
  border-radius: 7px;
  color: #bc2835;
  background: rgba(255, 90, 99, 0.08);
  font-size: 13px;
  font-weight: 800;
}

.admin-back-link,
.admin-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.admin-back-link {
  min-height: 40px;
  color: var(--muted);
  font-weight: 800;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  color: #e8edf6;
  background: var(--navy);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.sidebar-brand small {
  display: block;
  margin-top: 3px;
  color: #8d98ad;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--coral);
  color: #fff;
  font-weight: 900;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #b7c1d2;
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  background: #1f2837;
}

.main-area {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 251, 0.92);
  backdrop-filter: blur(14px);
}

.topbar h2 {
  margin: 0;
  font-size: 24px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.view {
  display: none;
  padding: 28px;
}

.view.active {
  display: block;
}

.hero {
  min-height: 380px;
  display: flex;
  align-items: flex-end;
  padding: 34px;
  border-radius: var(--radius);
  color: #fff;
  background:
    linear-gradient(90deg, rgba(11, 15, 24, 0.86), rgba(11, 15, 24, 0.2) 64%),
    url("./assets/hero-live.png") center / cover no-repeat;
}

.hero-content {
  max-width: 560px;
}

.hero h3 {
  margin: 12px 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.02;
}

.hero p {
  color: rgba(255, 255, 255, 0.82);
}

.pill,
.live-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(22, 199, 163, 0.18);
  color: #b8fff0;
  font-size: 12px;
  font-weight: 900;
}

.stats-grid,
.category-grid,
.stream-grid,
.admin-metrics {
  display: grid;
  gap: 14px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0 28px;
}

.stats-grid article,
.panel,
.profile-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.stats-grid strong,
.admin-metrics strong {
  display: block;
  margin-bottom: 5px;
  font-size: 28px;
}

.stats-grid span,
.section-heading span,
.video-meta p,
.profile-card p,
.clean-list span {
  color: var(--muted);
}

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

.section-heading h3 {
  margin: 0;
  font-size: 22px;
}

.category-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.category-card {
  min-height: 220px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 18px;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  text-align: left;
  background:
    linear-gradient(0deg, rgba(12, 17, 26, 0.9), rgba(12, 17, 26, 0.12)),
    url("./assets/category-collage.png") center / cover no-repeat;
}

.category-card:nth-child(2) {
  background-position: 35% center;
}

.category-card:nth-child(3) {
  background-position: 65% center;
}

.category-card:nth-child(4) {
  background-position: 80% center;
}

.category-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 21px;
}

.category-card span {
  color: rgba(255, 255, 255, 0.78);
}

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

.stream-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.stream-thumb {
  min-height: 160px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 12px;
  background:
    linear-gradient(0deg, rgba(10, 14, 22, 0.34), rgba(10, 14, 22, 0.1)),
    url("./assets/category-collage.png") center / cover no-repeat;
}

.stream-body {
  padding: 15px;
}

.stream-body h4 {
  margin: 0 0 8px;
}

.stream-body p {
  margin: 0 0 14px;
  color: var(--muted);
}

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.video-card,
.chat-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  color: #fff;
  background:
    linear-gradient(0deg, rgba(10, 14, 22, 0.72), rgba(10, 14, 22, 0.12)),
    url("./assets/hero-live.png") center / cover no-repeat;
}

.video-frame .live-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--coral);
  color: #fff;
}

.play-mark {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.video-frame p {
  position: absolute;
  left: 18px;
  bottom: 14px;
  margin: 0;
  font-weight: 900;
}

.video-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.video-meta h3 {
  margin: 0 0 6px;
}

.video-meta p {
  margin: 0;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 540px;
}

.chat-head,
.chat-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.chat-head span {
  color: var(--muted);
  font-size: 13px;
}

.chat-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  overflow: auto;
}

.chat-message {
  padding: 10px;
  border-radius: 7px;
  background: #f1f4f8;
}

.chat-message strong {
  display: block;
  margin-bottom: 3px;
  color: var(--coral);
  font-size: 12px;
}

.chat-form {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.chat-form input {
  min-height: 40px;
}

.chat-form button {
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--steel);
  font-weight: 900;
}

.profile-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.profile-card {
  text-align: center;
}

.avatar {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin: 0 auto 14px;
  border-radius: 50%;
  color: #fff;
  background: var(--mint);
  font-size: 34px;
  font-weight: 900;
}

.clean-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.clean-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.clean-list li:last-child {
  border-bottom: 0;
}

.admin-shell {
  padding: 22px;
  border-radius: var(--radius);
  color: #e8edf6;
  background: var(--admin);
}

.admin-topbar {
  background: rgba(20, 25, 35, 0.94);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.admin-topbar h2 {
  color: #e8edf6;
}

.admin-toolbar,
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.admin-toolbar h3 {
  margin: 0;
  font-size: 24px;
}

.admin-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0;
}

.admin-metrics article,
.admin-panel {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: var(--admin-soft);
}

.admin-metrics article {
  padding: 16px;
}

.admin-metrics span {
  color: #98a6bd;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.admin-panel {
  padding: 16px;
}

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

.admin-full-panel {
  margin-top: 16px;
}

.panel-title {
  margin-bottom: 14px;
}

.panel-title h4 {
  margin: 0;
}

.panel-title button {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: #e8edf6;
  background: #2d374b;
  font-weight: 800;
}

.table {
  display: grid;
  gap: 8px;
}

.table-row,
.admin-list button {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.6fr;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 6px;
  color: #dbe4f2;
  background: #182031;
}

.table-row span,
.admin-list small {
  color: #96a3b8;
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-list button {
  grid-template-columns: 1fr auto;
  border: 0;
  text-align: left;
}

.settings-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-grid label {
  color: #c8d2e2;
}

.settings-grid input,
.settings-grid select {
  border-color: rgba(255, 255, 255, 0.12);
  color: #e8edf6;
  background: #101722;
}

@media (max-width: 1080px) {
  .category-grid,
  .stream-grid,
  .admin-metrics,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .watch-layout,
  .profile-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .auth-screen,
  .app-shell,
  .admin-app,
  .admin-login-screen {
    display: block;
  }

  .admin-login-visual {
    min-height: 38vh;
    padding: 24px;
  }

  .auth-visual {
    min-height: 42vh;
    padding: 24px;
  }

  .brand-mark {
    top: 20px;
    left: 24px;
  }

  .auth-panel {
    padding: 24px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 5;
    height: auto;
    padding: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .sidebar-brand {
    display: none;
  }

  .side-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  body[data-role="user"] .side-nav,
  .app-shell .side-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item {
    min-height: 42px;
    padding: 0 4px;
    text-align: center;
    font-size: 12px;
  }

  .topbar {
    align-items: flex-start;
    padding: 18px;
  }

  .topbar-actions {
    flex-direction: column;
  }

  .view {
    padding: 18px 18px 82px;
  }

  .hero {
    min-height: 330px;
    padding: 22px;
  }

  .stats-grid,
  .category-grid,
  .stream-grid,
  .admin-metrics,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .video-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-panel {
    min-height: 420px;
  }

  .admin-shell {
    padding: 14px;
  }

  .table-row {
    grid-template-columns: 1fr;
    padding: 10px;
  }
}
