:root {
  --bg: #f3efe8;
  --surface: rgba(255, 252, 248, 0.9);
  --surface-strong: #fffdf9;
  --line: rgba(91, 90, 80, 0.14);
  --text: #232019;
  --muted: #6b6558;
  --accent: #6f8479;
  --accent-soft: #dce8df;
  --tag: #edf1ea;
  --shadow: 0 18px 40px rgba(38, 36, 31, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-body: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(210, 225, 218, 0.8), transparent 28rem),
    linear-gradient(180deg, #f6f2eb 0%, #efe8de 100%);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  padding: 0 0 calc(7rem + env(safe-area-inset-bottom));
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 1.25rem 1rem 6rem;
}

.hero {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 248, 0.76);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.eyebrow,
.section-head__eyebrow,
.player-kicker {
  margin: 0 0 0.5rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.74rem;
  color: var(--muted);
}

.hero__row,
.section-head,
.sheet-header,
.time-row,
.controls,
.recommend-section__head {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

.sheet-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.section-head {
  margin: 1.9rem 0 0.35rem;
}

.hero h1,
.section-head h2,
.recommend-section h4 {
  margin: 0;
}

.hero__text,
.sheet-description,
.cast-card__description,
.recommend-card__description,
.meta-line {
  color: var(--muted);
}

.admin-link,
.ghost-button,
.icon-button,
.control-button,
.speed-button,
.mini-player {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
}

.admin-link,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  text-decoration: none;
}

.is-hidden {
  display: none !important;
}

.status-panel {
  min-height: 0;
  margin: 0.2rem 0 0.35rem;
  color: var(--muted);
}

.status-panel:empty {
  display: none;
}

.cast-grid {
  display: grid;
  gap: 1rem;
}

.cast-card,
.recommend-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cast-card {
  padding: 0;
  text-align: left;
  overflow: hidden;
}

.cast-card__inner {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 1rem;
  padding: 1rem;
}

.cast-card__thumb,
.recommend-card__thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  background: linear-gradient(135deg, #d9e2d5, #e8e0d1);
}

.cast-card__title,
.recommend-card__title {
  margin: 0 0 0.4rem;
  font-size: 1.06rem;
}

.cast-card__description,
.recommend-card__description {
  margin: 0;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta-line {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
  font-size: 0.88rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.38rem 0.68rem;
  border-radius: 999px;
  background: var(--tag);
  color: #465247;
  font-size: 0.84rem;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(32, 29, 23, 0.26);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sheet-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.player-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  width: min(100%, 760px);
  padding: 0.9rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  border: 1px solid var(--line);
  background: rgba(255, 250, 245, 0.96);
  backdrop-filter: blur(18px);
  box-shadow: 0 -14px 36px rgba(35, 32, 25, 0.14);
  transform: translateY(100%);
  transition: transform 0.22s ease;
  z-index: 30;
}

.player-sheet.is-open {
  transform: translateY(0);
}

.player-sheet.is-dragging {
  transition: none;
}

.sheet-handle {
  width: 64px;
  height: 5px;
  margin: 0 auto 0.95rem;
  border-radius: 999px;
  background: rgba(75, 72, 65, 0.18);
  touch-action: none;
  cursor: grab;
}

.sheet-body {
  display: grid;
  gap: 1.2rem;
}

.progress-wrap {
  display: grid;
  gap: 0.55rem;
}

.seek-bar {
  width: 100%;
}

.time-row {
  font-size: 0.88rem;
  color: var(--muted);
}

.control-button,
.speed-button,
.icon-button {
  border-radius: 999px;
  padding: 0.8rem 1rem;
  cursor: pointer;
}

.control-button {
  flex: 1;
}

.control-button--primary {
  background: var(--accent);
  color: #f7f6f2;
  border-color: transparent;
}

.speed-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 0.65rem;
}

.speed-button.is-active {
  background: var(--accent-soft);
  border-color: rgba(91, 113, 101, 0.28);
}

.recommend-list {
  display: grid;
  gap: 0.8rem;
}

.recommend-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.9rem;
  padding: 0.75rem;
  text-align: left;
}

.recommend-card__thumb {
  border-radius: 16px;
}

.recommend-empty {
  margin: 0;
  color: var(--muted);
}

.mini-player {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 2rem), 720px);
  padding: 0.65rem 0.8rem;
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  z-index: 35;
}

.mini-player__surface {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border: none;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.mini-player__meta {
  display: grid;
  gap: 0.2rem;
  text-align: left;
  min-width: 0;
}

.mini-player__meta span,
#miniTime {
  color: var(--muted);
  font-size: 0.84rem;
}

#miniTitle,
#miniTime {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.mini-icon-button {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
}

@media (max-width: 640px) {
  .hero__row,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .cast-card__inner {
    grid-template-columns: 92px 1fr;
  }

  .player-sheet {
    width: 100%;
    max-height: 52vh;
    padding: 0.7rem 0.85rem calc(0.85rem + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .sheet-handle {
    margin-bottom: 0.65rem;
  }

  .sheet-header {
    gap: 0.7rem;
    align-items: center;
  }

  .sheet-header h3 {
    font-size: 1rem;
    line-height: 1.3;
  }

  .sheet-actions {
    gap: 0.4rem;
    flex-shrink: 0;
  }

  .sheet-body {
    gap: 0.8rem;
    overflow-y: auto;
    padding-right: 0.1rem;
  }

  .sheet-description {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .tag-list {
    gap: 0.35rem;
    margin-top: 0.55rem;
  }

  .tag {
    padding: 0.28rem 0.55rem;
    font-size: 0.78rem;
  }

  .icon-button {
    padding: 0.5rem 0.72rem;
    font-size: 0.84rem;
  }

  .controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .control-button {
    width: 100%;
    padding: 0.62rem 0.4rem;
    font-size: 0.88rem;
  }

  .control-button--primary {
    font-size: 1rem;
  }

  .speed-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .speed-button {
    padding: 0.46rem 0.3rem;
    font-size: 0.78rem;
  }

  .time-row {
    font-size: 0.8rem;
  }

  .mini-player {
    width: min(calc(100% - 1rem), 720px);
    padding: 0.5rem 0.6rem;
    gap: 0.6rem;
    bottom: calc(0.5rem + env(safe-area-inset-bottom));
  }

  .mini-player__surface {
    gap: 0.7rem;
  }

  .mini-player__meta span,
  #miniTime {
    font-size: 0.76rem;
  }

  .mini-icon-button {
    width: 2.15rem;
    height: 2.15rem;
    font-size: 0.9rem;
  }
}
