/* HeartLoca Portal — preview prototype */

:root {
  --color-bg: #f7f7f5;
  --color-panel: #ffffff;
  --color-panel-alt: #fafaf8;
  --color-border: #e5e5e0;
  --color-border-strong: #d4d4ce;
  --color-text-strong: #1c1c1a;
  --color-text-mid: #57574f;
  --color-text-muted: #92928a;

  --color-accent: #1c1c1a;
  --color-accent-soft: #2d2d28;
  --color-accent-on: #fafaf8;

  --color-link: #4338ca;

  --status-waiting: #a3a39a;
  --status-in-progress: #2563eb;
  --status-awaiting-review: #d97706;
  --status-completed: #15803d;
  --status-failed: #dc2626;

  --status-waiting-bg: #f1f1ec;
  --status-in-progress-bg: #eff4ff;
  --status-awaiting-review-bg: #fef5e7;
  --status-completed-bg: #ecf7ee;
  --status-failed-bg: #fdecec;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(28, 28, 26, 0.04);
  --shadow-md: 0 4px 16px rgba(28, 28, 26, 0.06);
  --shadow-lg: 0 20px 60px rgba(28, 28, 26, 0.12);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  --font-sans: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
    'Noto Sans KR', system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text-strong);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

/* ========== App Header ========== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-8);
  background: var(--color-panel);
  border-bottom: 1px solid var(--color-border);
  min-height: 64px;
}

.app-header__left {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-width: 0;
}

.app-header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--color-text-strong);
}

.app-header__logo-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1c1c1a 0%, #57574f 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent-on);
  font-size: 12px;
  font-weight: 800;
}

.app-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.app-header__nav-link {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text-mid);
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}

.app-header__nav-link:hover {
  background: var(--color-panel-alt);
  color: var(--color-text-strong);
}

.app-header__nav-link--active {
  color: var(--color-text-strong);
  background: var(--color-panel-alt);
}

.app-header__breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header__breadcrumb a {
  color: var(--color-text-mid);
}

.app-header__breadcrumb a:hover {
  color: var(--color-text-strong);
}

.app-header__breadcrumb-separator {
  color: var(--color-text-muted);
  opacity: 0.6;
}

.app-header__breadcrumb-current {
  color: var(--color-text-strong);
  font-weight: 500;
}

.app-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--color-panel-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text-mid);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 120ms ease;
}

.user-badge:hover {
  border-color: var(--color-border-strong);
}

.user-badge__role {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--color-text-strong);
  color: var(--color-accent-on);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 600;
}

.user-badge__role--user {
  background: var(--color-border-strong);
  color: var(--color-text-mid);
}

/* ========== Buttons ========== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 13px;
  line-height: 1;
  transition: background 120ms ease, border-color 120ms ease, transform 60ms ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(0.5px);
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-accent-on);
}

.btn--primary:hover {
  background: var(--color-accent-soft);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-mid);
  border-color: var(--color-border);
}

.btn--ghost:hover {
  background: var(--color-panel-alt);
  color: var(--color-text-strong);
}

.btn--subtle {
  background: var(--color-panel-alt);
  color: var(--color-text-mid);
}

.btn--subtle:hover {
  background: var(--color-border);
  color: var(--color-text-strong);
}

.btn--sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* D-20: destructive (delete) action button */
.btn--danger {
  background: var(--status-failed);
  color: var(--color-accent-on);
}

.btn--danger:hover {
  background: #b91c1c; /* hand-tuned shade of --status-failed */
}

.btn--danger:disabled {
  background: var(--color-border-strong);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* ========== Page layout ========== */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-8);
}

.page__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.page__toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 280px;
}

.page__toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  color: var(--color-text-mid);
  font-size: 13px;
  font-weight: 500;
}

.back-link:hover {
  color: var(--color-text-strong);
}

.section-heading {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--color-text-strong);
  margin: 0 0 var(--space-1);
}

.section-subtitle {
  color: var(--color-text-mid);
  font-size: 13px;
}

/* D-19: title row + inline edit affordance */
.title-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.title-edit-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.title-edit-trigger:hover,
.title-edit-trigger:focus-visible {
  background: var(--color-panel-alt);
  border-color: var(--color-border);
  color: var(--color-text-strong);
  outline: none;
}

.title-edit-trigger--inline {
  width: 18px;
  height: 18px;
  font-size: 11px;
  margin-left: 6px;
  opacity: 0;
  pointer-events: none;
  vertical-align: middle;
}

/* D-20: ··· more menu (drill-down 헤더 + table row) */
.more-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.more-menu__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-mid);
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.more-menu__trigger:hover,
.more-menu__trigger:focus-visible {
  background: var(--color-panel-alt);
  border-color: var(--color-border);
  color: var(--color-text-strong);
  outline: none;
}

.more-menu__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  min-width: 160px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 4px;
  display: none;
}

.more-menu__dropdown[data-open='true'] {
  display: block;
}

.more-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-strong);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
}

.more-menu__item:hover {
  background: var(--color-panel-alt);
}

.more-menu__item--danger {
  color: var(--status-failed);
}

.more-menu__item--danger:hover {
  background: var(--status-failed-bg);
  color: var(--status-failed);
}

/* drill-down table: 우측 ··· 더 보기 열 */
.table__col-more {
  width: 56px;
  text-align: right;
}

/* ========== Search ========== */

.search-input {
  flex: 1;
  max-width: 360px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-panel);
  color: var(--color-text-strong);
  font-size: 13px;
  transition: border-color 120ms ease, background 120ms ease;
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-text-strong);
  background: var(--color-panel);
}

/* ========== Comic grid ========== */

.comic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-5);
}

.comic-card {
  display: flex;
  flex-direction: column;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.comic-card:hover {
  border-color: var(--color-border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.comic-card__thumb {
  aspect-ratio: 3 / 4;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: var(--space-3);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.comic-card__thumb--g1 {
  background: linear-gradient(135deg, #2d4a3e 0%, #6b8e76 100%);
}
.comic-card__thumb--g2 {
  background: linear-gradient(135deg, #b86a5b 0%, #f4c2a1 100%);
}
.comic-card__thumb--g3 {
  background: linear-gradient(135deg, #2c3e62 0%, #5b7aa8 100%);
}
.comic-card__thumb--g4 {
  background: linear-gradient(135deg, #5d3a6b 0%, #b07cc8 100%);
}
.comic-card__thumb--g5 {
  background: linear-gradient(135deg, #5a5028 0%, #b9a253 100%);
}
.comic-card__thumb--g6 {
  background: linear-gradient(135deg, #1f3a4d 0%, #427093 100%);
}

.comic-card__body {
  padding: var(--space-3) var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comic-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-strong);
  letter-spacing: -0.01em;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.comic-card__meta {
  font-size: 12px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.comic-card__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--space-2);
}

/* ========== Status mini-pill ========== */

.mini-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px 2px 5px;
  border-radius: 999px;
  background: var(--color-panel-alt);
  color: var(--color-text-mid);
}

.mini-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.mini-pill--waiting {
  background: var(--status-waiting-bg);
}
.mini-pill--waiting .mini-pill__dot {
  background: var(--status-waiting);
}
.mini-pill--in_progress {
  background: var(--status-in-progress-bg);
  color: var(--status-in-progress);
}
.mini-pill--in_progress .mini-pill__dot {
  background: var(--status-in-progress);
}
.mini-pill--awaiting_review {
  background: var(--status-awaiting-review-bg);
  color: var(--status-awaiting-review);
}
.mini-pill--awaiting_review .mini-pill__dot {
  background: var(--status-awaiting-review);
}
.mini-pill--completed {
  background: var(--status-completed-bg);
  color: var(--status-completed);
}
.mini-pill--completed .mini-pill__dot {
  background: var(--status-completed);
}
.mini-pill--failed {
  background: var(--status-failed-bg);
  color: var(--status-failed);
}
.mini-pill--failed .mini-pill__dot {
  background: var(--status-failed);
}

/* ========== Status chip (drill-down filter) ========== */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-panel);
  color: var(--color-text-mid);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.chip:hover {
  border-color: var(--color-border-strong);
}

.chip--active {
  background: var(--color-text-strong);
  color: var(--color-accent-on);
  border-color: var(--color-text-strong);
}

.chip__count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 12px;
}

.chip--active .chip__count {
  color: var(--color-accent-on);
}

.chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.chip[data-status='waiting'] .chip__dot {
  background: var(--status-waiting);
}
.chip[data-status='in_progress'] .chip__dot {
  background: var(--status-in-progress);
}
.chip[data-status='awaiting_review'] .chip__dot {
  background: var(--status-awaiting-review);
}
.chip[data-status='completed'] .chip__dot {
  background: var(--status-completed);
}
.chip[data-status='failed'] .chip__dot {
  background: var(--status-failed);
}

/* ========== Filter row ========== */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.filter-select {
  appearance: none;
  padding: 8px 30px 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-panel)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'><path d='M3 4.5L6 7.5L9 4.5' stroke='%2357574f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>")
    no-repeat right 10px center;
  color: var(--color-text-strong);
  font-size: 13px;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--color-text-strong);
}

/* ========== Table ========== */

.table-card {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-panel-alt);
}

.table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.table tbody tr {
  cursor: pointer;
  transition: background 100ms ease;
}

.table tbody tr:hover {
  background: var(--color-panel-alt);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table__col-num {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-mid);
  width: 64px;
}

.table__col-title {
  color: var(--color-text-strong);
  font-weight: 500;
}

.table__col-title--muted {
  color: var(--color-text-muted);
  font-style: italic;
}

/* D-19: drill-down 회차 제목 cell inline edit */
.title-cell {
  position: relative;
}

.title-cell__label {
  display: inline;
}

.title-cell--editable {
  cursor: text;
}

.title-cell--editable:hover .title-edit-trigger--inline {
  opacity: 0.7;
}

.title-cell--editing {
  background: var(--color-panel-alt);
  padding-block: 6px;
}

.title-inline-input {
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-text-strong);
  background: var(--color-panel);
  color: var(--color-text-strong);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
}

.title-inline-input:focus {
  outline: none;
}

.table__col-lang {
  width: 90px;
}

.table__col-status {
  width: 160px;
}

.table__col-assignee {
  width: 200px;
  color: var(--color-text-mid);
}

.assignee-muted {
  color: var(--color-text-muted);
  font-style: italic;
}

/* ========== Status badge (table) ========== */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-badge--waiting {
  background: var(--status-waiting-bg);
  color: var(--color-text-mid);
}
.status-badge--waiting .status-badge__dot {
  background: var(--status-waiting);
}
.status-badge--in_progress {
  background: var(--status-in-progress-bg);
  color: var(--status-in-progress);
}
.status-badge--in_progress .status-badge__dot {
  background: var(--status-in-progress);
}
.status-badge--awaiting_review {
  background: var(--status-awaiting-review-bg);
  color: var(--status-awaiting-review);
}
.status-badge--awaiting_review .status-badge__dot {
  background: var(--status-awaiting-review);
}
.status-badge--completed {
  background: var(--status-completed-bg);
  color: var(--status-completed);
}
.status-badge--completed .status-badge__dot {
  background: var(--status-completed);
}
.status-badge--failed {
  background: var(--status-failed-bg);
  color: var(--status-failed);
}
.status-badge--failed .status-badge__dot {
  background: var(--status-failed);
}

/* ========== Lang label ========== */

.lang-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-panel-alt);
  border: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-mid);
  font-weight: 500;
}

/* ========== Detail header ========== */

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.detail-header__left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.detail-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.assignee-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  color: var(--color-text-mid);
  font-size: 13px;
}

.assignee-row__label {
  color: var(--color-text-muted);
}

/* ========== Scene grid ========== */

.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-4);
}

.scene-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease;
}

.scene-card:hover {
  border-color: var(--color-border-strong);
  transform: translateY(-2px);
}

/* D-20: scene card hover trash affordance */
.scene-card__delete {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(28, 28, 26, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms ease, background 140ms ease;
}

.scene-card:hover .scene-card__delete,
.scene-card__delete:focus-visible {
  opacity: 1;
}

.scene-card__delete:hover {
  background: var(--status-failed);
}

.scene-card__image {
  aspect-ratio: 4 / 5;
  background: var(--color-panel-alt);
  position: relative;
  overflow: hidden;
}

.scene-card__image::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(160deg, #c7c0b2 0%, #948b76 100%);
  opacity: 0.85;
}

.scene-card__image[data-variant='2']::after {
  background-image: radial-gradient(circle at 70% 40%, rgba(255, 255, 255, 0.15), transparent 60%),
    linear-gradient(160deg, #a8b4c1 0%, #4f6478 100%);
}
.scene-card__image[data-variant='3']::after {
  background-image: radial-gradient(circle at 40% 70%, rgba(255, 255, 255, 0.15), transparent 60%),
    linear-gradient(160deg, #d6b5a0 0%, #8a5b40 100%);
}
.scene-card__image[data-variant='4']::after {
  background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(160deg, #b6c3a5 0%, #5d7048 100%);
}

.scene-card__body {
  padding: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.scene-card__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-strong);
}

.scene-card__sub {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ========== Scene upload card ========== */

.scene-uploader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  aspect-ratio: 4 / 5;
  border: 1.5px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
  padding: var(--space-4);
  text-align: center;
}

.scene-uploader:hover,
.scene-uploader--dragover {
  border-color: var(--color-text-strong);
  background: var(--color-panel-alt);
  color: var(--color-text-strong);
}

.scene-uploader__icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-panel-alt);
  color: var(--color-text-mid);
  font-size: 18px;
  font-weight: 300;
}

.scene-uploader__hint {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ========== Modal ========== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 28, 26, 0.4);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--space-6);
}

.modal-backdrop[data-open='true'] {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--color-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px);
  overflow: hidden;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.modal__title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.modal__close {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 18px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease;
}

.modal__close:hover {
  background: var(--color-panel-alt);
  color: var(--color-text-strong);
}

.modal__body {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overflow-y: auto;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-panel-alt);
}

/* ========== Form ========== */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-mid);
  letter-spacing: 0.01em;
}

.field__label-required::after {
  content: ' *';
  color: var(--status-failed);
}

.field__input,
.field__select {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-panel);
  color: var(--color-text-strong);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 120ms ease;
}

.field__input:focus,
.field__select:focus {
  outline: none;
  border-color: var(--color-text-strong);
}

.field__hint {
  font-size: 11px;
  color: var(--color-text-muted);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* D-20: cascade confirm modal body sections */
.cascade-modal__summary {
  font-size: 13px;
  color: var(--color-text-strong);
  line-height: 1.6;
}

.cascade-modal__impact {
  background: var(--color-panel-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--color-text-mid);
}

.cascade-modal__impact strong {
  color: var(--color-text-strong);
  font-variant-numeric: tabular-nums;
}

.cascade-modal__block {
  background: var(--status-awaiting-review-bg);
  border: 1px solid var(--status-awaiting-review);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  color: var(--status-awaiting-review);
  line-height: 1.55;
}

.cascade-modal__block strong {
  color: var(--status-awaiting-review);
  font-variant-numeric: tabular-nums;
}

/* ========== Empty state ========== */

.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--color-text-muted);
}

.empty-state__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-mid);
  margin: 0 0 var(--space-2);
}

.empty-state__body {
  font-size: 13px;
  margin-bottom: var(--space-4);
}

/* ========== Login ========== */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
}

.login-card__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  font-weight: 700;
  font-size: 18px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ========== Toast ========== */

.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-text-strong);
  color: var(--color-accent-on);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 200;
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== Misc ========== */

.muted {
  color: var(--color-text-muted);
}

.spacer {
  flex: 1;
}

@media (max-width: 720px) {
  .app-header {
    padding: var(--space-3) var(--space-4);
  }
  .page {
    padding: var(--space-5) var(--space-4);
  }
  .comic-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}
