:root {
  /* Primary */
  --brand-1: #9b8afb;
  --brand-2: #8db8f5;

  /* Accent */
  --accent-pink: #f4a6b8;
  --accent-peach: #f6b89a;
  --accent-yellow: #f4d58d;
  --accent-green: #a8d5ba;

  /* Background */
  --bg: #f8f7fc;
  --surface: #ffffff;
  --surface-soft: #fcfbff;

  /* Text */
  --text: #343443;
  --text-dim: #77768a;
  --text-light: #9a99aa;

  /* Border */
  --border: #e8e5f0;
  --border-soft: #f0edf6;

  /* Semantic */
  --korea: #8db8f5;
  --korea-bg: #edf5ff;
  --korea-text: #5d83b7;
  --korea-border: #d7e8fb;

  --international: #b4a3f5;
  --international-bg: #f2eeff;
  --international-text: #7565aa;
  --international-border: #e2d9fa;

  --hot-issue: #f2a6a6;
  --hot-issue-bg: #fdebec;
  --hot-issue-text: #b96c73;
  --hot-issue-border: #f5d1d5;

  --common: #a8d5ba;
  --common-bg: #eef8f2;
  --common-text: #5f8a70;
  --common-border: #d8ecdd;

  /* Shadows */
  --shadow-sm: 0 2px 10px rgba(72, 65, 100, 0.06);
  --shadow-md: 0 8px 24px rgba(72, 65, 100, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 10% 0%, rgba(155, 138, 251, 0.08), transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(141, 184, 245, 0.08), transparent 28%), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.page-header {
  padding: 2.5rem 1.5rem 1.5rem;
  text-align: center;
}

.page-header h1 {
  margin: 0 0 0.4rem;
  font-size: 2.2rem;
  background: linear-gradient(135deg, #8f80e8, #78a9e8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-header p {
  margin: 0;
  color: var(--text-dim);
}

/* ---------- 레이아웃: 좌측 메뉴 + 우측 상세 ---------- */

main.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.movie-menu {
  position: sticky;
  top: 1.5rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 0.8rem;
  box-shadow: var(--shadow-sm);
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

.menu-item {
  display: block;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.menu-item:hover {
  background: #f5f2ff;
  border-color: #e8e2fa;
}

.menu-item.active {
  background: #eee9ff;
  border-color: #dcd3ff;
  color: #51467a;
}

.menu-item-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.menu-item-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.menu-item.active .menu-item-sub {
  color: #756b9a;
}

.menu-item-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.menu-item.active .menu-item-stats {
  color: #756b9a;
}

/* ---------- 반응 아이템 (국내/해외/공통) ---------- */

.reaction-item {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  background: var(--surface-soft);
}

.reaction-item:last-child {
  margin-bottom: 0;
}

.reaction-item--kr {
  background: var(--korea-bg);
  border-color: var(--korea-border);
}

.reaction-item--intl {
  background: var(--international-bg);
  border-color: var(--international-border);
}

.reaction-item--common {
  background: var(--common-bg);
  border-color: var(--common-border);
}

.reaction-topic {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.reaction-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
}

.reaction-meta a,
.issue-sources a {
  color: #7565aa;
  text-decoration: none;
  font-weight: 600;
}

.reaction-meta a:hover,
.issue-sources a:hover {
  text-decoration: underline;
}

.tag {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.tag.confidence-high {
  background: var(--common-bg);
  border-color: var(--common-border);
  color: var(--common-text);
}

.tag.confidence-medium {
  background: #fdf6e3;
  border-color: #f0e0ae;
  color: #a8823f;
}

.tag.confidence-low {
  background: var(--surface-soft);
  border-color: var(--border);
  color: var(--text-light);
}

/* ---------- Hot Issue 카드 ---------- */

.hot-issue-card {
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--hot-issue);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.hot-issue-card:last-child {
  margin-bottom: 0;
}

.hot-issue-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.hot-issue-header h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.heat-badge {
  font-size: 0.8rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--hot-issue-bg);
  color: var(--hot-issue-text);
  border: 1px solid var(--hot-issue-border);
}

.issue-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin: 0.6rem 0;
}

.issue-col {
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
}

.issue-col:nth-child(1) {
  background: var(--korea-bg);
  border-color: var(--korea-border);
}

.issue-col:nth-child(2) {
  background: var(--international-bg);
  border-color: var(--international-border);
}

.issue-col p {
  margin: 0.3rem 0 0.4rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.issue-col-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

.issue-comparison {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.issue-comparison p {
  margin: 0.3rem 0;
}

.issue-sources {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- 국내 vs 해외 비교 ---------- */

.comparison-row {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
  background: var(--surface);
}

.comparison-row:last-child {
  margin-bottom: 0;
}

.comparison-topic {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

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

.detail-pane {
  min-width: 0;
}

@media (max-width: 800px) {
  main.layout {
    grid-template-columns: 1fr;
  }
  .movie-menu {
    position: static;
  }
  .layout.has-selection .movie-menu {
    display: none;
  }
  .layout:not(.has-selection) .detail-pane {
    display: none;
  }
}

/* ---------- 상세 뷰 ---------- */

.back-link {
  display: inline-block;
  margin-bottom: 1.2rem;
  color: #858398;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 0.95rem;
  padding: 0;
}

.back-link:hover {
  color: #5e5677;
}

.detail-header h2 {
  margin: 0 0 0.2rem;
  font-size: 1.8rem;
  color: var(--text);
}

.detail-header .subtitle {
  color: var(--text-dim);
  margin: 0 0 1.2rem;
}

.update-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.update-badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 1.4rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease;
}

.section-card:hover {
  box-shadow: var(--shadow-md);
}

.section-card h3 {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
  color: var(--text);
}

.section-card p.summary {
  margin: 0 0 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.section-card ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.section-card ul li {
  margin-bottom: 0.4rem;
}

/* 평점 */

.ratings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.rating-chip {
  flex: 1 1 160px;
  background: #faf9fd;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 0.8rem 1rem;
}

.rating-chip .label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.rating-chip .value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.rating-chip .source {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

/* 국가별 흥행 바차트 */

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
}

.bar-row .country-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.bar-track {
  height: 20px;
  background: #f0eef5;
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #afc9f7, #91b8f0);
  transition: width 0.6s ease;
  width: 0;
}

.bar-row .bar-value {
  white-space: nowrap;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.bar-note {
  grid-column: 2 / 4;
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: -0.35rem;
  margin-bottom: 0.4rem;
}

/* 주간 추이 */

.trend-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  color: var(--text);
}

.trend-track {
  height: 14px;
  background: #f0eef5;
  border-radius: 5px;
  overflow: hidden;
}

.trend-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #b9acf5, #9b8afb);
  width: 0;
  transition: width 0.6s ease;
}

.empty-note {
  color: #9997a8;
  font-size: 0.85rem;
  font-style: italic;
}

@media (max-width: 640px) {
  .bar-row {
    grid-template-columns: 70px 1fr;
    row-gap: 0.2rem;
  }
  .bar-row .bar-value {
    grid-column: 1 / 3;
  }
  .bar-note {
    grid-column: 1 / 3;
  }
}

/* ---------- 영화 추가 ---------- */

.add-movie-box {
  margin-bottom: 1.2rem;
}

.add-movie-btn {
  background: #9b8afb;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(155, 138, 251, 0.2);
  transition: background 0.15s ease;
}

.add-movie-btn:hover {
  background: #8e7ceb;
}

.add-movie-form {
  position: relative;
  margin-top: 0.8rem;
  max-width: 420px;
}

.add-movie-form input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
}

.add-movie-form input:focus {
  outline: none;
  border-color: #b8abf3;
  box-shadow: 0 0 0 3px rgba(155, 138, 251, 0.12);
}

.add-movie-suggestions {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  position: absolute;
  width: 100%;
  z-index: 20;
  max-height: 280px;
  overflow-y: auto;
}

.suggestion-item {
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: #f7f4ff;
}

.suggestion-item.empty {
  cursor: default;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.suggestion-item .s-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.suggestion-item .s-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 모달 */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(62, 57, 78, 0.28);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-box {
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(55, 48, 75, 0.14);
}

.modal-box h4 {
  margin: 0 0 0.6rem;
  color: var(--text);
}

.modal-box p {
  color: var(--text);
  line-height: 1.5;
}

.modal-note {
  color: var(--text-dim) !important;
  font-size: 0.82rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

.modal-actions button {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.modal-actions button#modal-confirm {
  background: #9b8afb;
  color: #ffffff;
  border: none;
}
