:root {
  --bg: #f5f2e9;
  --ink: #17140f;
  --muted: #5f594f;
  --card: #fffaf0;
  --card-strong: #fffdf7;
  --stroke: #d9ccb8;
  --stroke-strong: #c8b79f;
  --primary: #df5a3f;
  --primary-deep: #b63e24;
  --accent: #1b7f71;
  --accent-soft: #ddf4ef;
  --danger: #a23030;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(48, 33, 20, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'IBM Plex Sans KR', sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.6;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.22;
  font-family: 'Fraunces', serif;
  letter-spacing: 0.02em;
  font-weight: 700;
}

p {
  margin: 0;
  color: var(--muted);
}

button,
a {
  font: inherit;
}

.ambient {
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: -1;
  border-radius: 100%;
  filter: blur(2px);
}

.ambient-a {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle at 20% 20%, rgba(223, 90, 63, 0.35), transparent 60%);
  top: -50px;
  right: -60px;
}

.ambient-b {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle at 40% 35%, rgba(27, 127, 113, 0.3), transparent 65%);
  bottom: -130px;
  left: -120px;
}

.shell {
  width: min(1140px, calc(100% - 2.5rem));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 0;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(245, 242, 233, 0.92), rgba(245, 242, 233, 0.82));
  border-bottom: 1px solid rgba(217, 204, 184, 0.5);
  backdrop-filter: blur(6px);
  z-index: 30;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
}

.brand-text {
  font-family: 'Fraunces', serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.top-nav {
  margin-left: auto;
  display: inline-flex;
  gap: 0.45rem;
  background: rgba(255, 250, 240, 0.96);
  border: 1px solid var(--stroke-strong);
  border-radius: 999px;
  padding: 0.26rem;
  box-shadow: 0 6px 14px rgba(47, 31, 20, 0.06);
}

.nav-pill {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-weight: 600;
}

.nav-pill.is-active {
  background: var(--ink);
  color: #fff;
}

.auth-area {
  min-width: 160px;
  display: flex;
  justify-content: flex-end;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--stroke-strong);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  background: #fffdf8;
}

.auth-chip img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.auth-chip .name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.view {
  display: none;
  padding: 1rem 0 3.8rem;
}

.view.is-active {
  display: block;
}

.headline-wrap {
  margin-bottom: 1.35rem;
  max-width: 78ch;
  background: linear-gradient(120deg, rgba(255, 251, 242, 0.95), rgba(255, 246, 231, 0.7));
  border: 1px solid rgba(217, 204, 184, 0.75);
  border-radius: 18px;
  padding: 1.2rem 1.3rem;
  box-shadow: 0 10px 28px rgba(56, 37, 24, 0.05);
}

.headline-wrap h1 {
  font-size: clamp(2.1rem, 4.4vw, 4rem);
  margin-bottom: 0.65rem;
  letter-spacing: 0.01em;
}

.headline-wrap p {
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 72ch;
}

.section-card {
  background: var(--card-strong);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem;
  margin-bottom: 1.2rem;
}

.section-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.section-topline h2 {
  font-size: 1.7rem;
  letter-spacing: 0.01em;
}

.stack-list {
  display: grid;
  gap: 0.65rem;
}

.item-row {
  border: 1px solid var(--stroke-strong);
  border-radius: 16px;
  padding: 0.72rem;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 64px 1fr;
  background: #fffef9;
  box-shadow: 0 6px 20px rgba(61, 44, 32, 0.04);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.item-row:hover {
  transform: translateY(-1px);
  border-color: #bda88b;
  box-shadow: 0 10px 24px rgba(61, 44, 32, 0.08);
}

.poster,
.poster-fallback {
  width: 64px;
  height: 92px;
  border-radius: 10px;
  object-fit: cover;
}

.poster-fallback {
  background: linear-gradient(140deg, #f1c45a, #df5a3f);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  padding: 0.3rem;
  text-align: center;
  font-size: 0.72rem;
}

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

.item-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.5rem;
}

.move-controls {
  display: inline-flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.move-btn {
  width: 1.95rem;
  height: 1.95rem;
  border-radius: 10px;
  border: 1px solid var(--stroke-strong);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 130ms ease, background 130ms ease, border-color 130ms ease;
}

.move-btn:hover {
  transform: translateY(-1px);
  background: #fff7eb;
  border-color: #b99669;
}

.move-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  background: #faf8f2;
}

.item-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.08rem;
  line-height: 1.35;
  font-weight: 600;
}

.item-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.item-overview {
  font-size: 0.98rem;
  line-height: 1.6;
  color: #3a3229;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.action-row:empty {
  display: none;
}

.badge {
  border-radius: 999px;
  border: 1px solid var(--stroke-strong);
  padding: 0.18rem 0.52rem;
  font-size: 0.76rem;
}

.badge-netflix {
  background: #ffeeee;
  border-color: #d47373;
  color: #8d2222;
}

.badge-viki {
  background: #eaf7ff;
  border-color: #72add0;
  color: #175778;
}

.badge-score {
  background: var(--accent-soft);
  border-color: #8dd2c7;
  color: #0f6056;
}

.badge-muted {
  background: #f8f2e8;
  color: #746754;
}

.pill-stat {
  border-radius: 999px;
  border: 1px solid var(--stroke-strong);
  padding: 0.3rem 0.7rem;
  background: #fff;
  font-size: 0.88rem;
  color: var(--muted);
}

.search-input {
  width: 100%;
  border: 1px solid var(--stroke-strong);
  border-radius: 12px;
  padding: 0.92rem 1rem;
  font-size: 1.03rem;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(35, 26, 20, 0.06);
}

.search-input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(27, 127, 113, 0.18);
}

.search-results {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.62rem;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.58rem 1.05rem;
  font-weight: 600;
  transition: transform 150ms ease, filter 150ms ease, background 150ms ease;
}

.primary-btn {
  border: 1px solid var(--primary-deep);
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover {
  background: var(--primary-deep);
  transform: translateY(-1px);
}

.secondary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.ghost-btn {
  border: 1px solid var(--stroke-strong);
  color: var(--ink);
  background: #fff;
}

.remove-show-btn {
  border-color: #d9a7a7;
  color: #8f2a2a;
  background: #fff6f6;
}

.remove-show-btn:hover {
  background: #ffe9e9;
}

.rank-num {
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.73rem;
  min-width: 1.8rem;
  min-height: 1.8rem;
  display: inline-grid;
  place-items: center;
}

.note {
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 0.85rem;
}

.hidden {
  display: none !important;
}

.compare-dialog {
  width: min(760px, calc(100% - 1.2rem));
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
}

.compare-shell {
  padding: 0.9rem;
  background: var(--card);
}

.compare-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.compare-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: 1fr;
  margin-bottom: 0.9rem;
}

.compare-choice {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  border-radius: 12px;
}

.compare-choice .show-mini {
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.compare-choice:hover .show-mini,
.compare-choice:focus-visible .show-mini {
  border-color: #b59467;
  box-shadow: 0 0 0 3px rgba(223, 90, 63, 0.14);
  transform: translateY(-1px);
}

.show-mini {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.65rem;
  background: #fff;
}

.compare-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.footer-note {
  padding-bottom: 2rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%) translateY(120%);
  transition: transform 220ms ease;
  background: var(--ink);
  color: #fff;
  padding: 0.54rem 0.82rem;
  border-radius: 999px;
  font-size: 0.83rem;
  max-width: calc(100% - 2rem);
  z-index: 60;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

@media (min-width: 740px) {
  .item-row {
    grid-template-columns: 84px 1fr;
  }

  .poster,
  .poster-fallback {
    width: 84px;
    height: 122px;
  }

  .compare-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: calc(100% - 1.25rem);
  }

  .site-header {
    flex-wrap: wrap;
  }

  .headline-wrap h1 {
    font-size: clamp(1.9rem, 9vw, 2.7rem);
  }

  .headline-wrap p {
    font-size: 1rem;
  }

  .section-card {
    padding: 1rem;
  }

  .headline-wrap {
    padding: 1rem;
  }

  .top-nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .top-nav .nav-pill {
    flex: 1;
  }

  .auth-area {
    margin-left: auto;
  }
}
