:root {
  --bg: #f6f2ec;
  --surface: #ffffff;
  --surface-soft: #fbf8f4;
  --ink: #26201b;
  --ink-muted: #76695e;
  --gold: #b88d57;
  --gold-dark: #946d3d;
  --gold-soft: rgba(184, 141, 87, 0.14);
  --border: #e7ddd0;
  --danger: #c64b42;
  --success: #3e7a52;
  --font-serif: "Noto Serif TC", "Songti TC", Georgia, serif;
  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Top Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.brand-sub {
  font-size: 12px;
  color: var(--ink-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold-dark);
  background: #fdf9f3;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #c19761, #9b7341);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(155, 115, 65, 0.28);
}

.btn-primary:hover:not(:disabled) {
  color: #ffffff;
  background: linear-gradient(135deg, #b58b55, #896333);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(198, 75, 66, 0.32);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(198, 75, 66, 0.08);
  border-color: var(--danger);
  color: var(--danger);
}

/* Main Container */
.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

/* Stats Strip */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
}

.stat-label {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stat-value.stat-url {
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.45;
  padding-top: 4px;
  word-break: break-all;
}

.stat-sub {
  font-size: 12px;
  color: var(--gold-dark);
  margin-top: 2px;
  word-break: break-all;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.tab-btn.is-active {
  background: var(--surface);
  color: var(--gold-dark);
  border-color: var(--border);
  box-shadow: 0 4px 12px rgba(60, 40, 20, 0.06);
}

.tab-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold-dark);
}

/* Section Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 6px 22px rgba(60, 42, 24, 0.04);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.panel-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.panel-desc {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* Form Layout */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

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

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.field-help {
  font-size: 12px;
  color: var(--ink-muted);
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-soft);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  background: #ffffff;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

/* Live Cinema Title Preview */
.title-preview-stage {
  margin-top: 18px;
  padding: 26px 28px;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at top right, rgba(230, 203, 168, 0.16), transparent 60%),
    linear-gradient(135deg, #1b1714, #0d0b0a);
  color: #fbf8f3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  border: 1px solid rgba(230, 203, 168, 0.24);
}

.preview-tag {
  align-self: flex-start;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(230, 203, 168, 0.78);
  margin-bottom: 10px;
}

.preview-subtitle {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #e6cba8;
  margin-bottom: 4px;
}

.preview-zh {
  font-size: 32px;
  letter-spacing: 0.12em;
  line-height: 1.25;
}

.preview-en {
  font-size: 20px;
  color: rgba(251, 248, 243, 0.9);
  margin-top: 4px;
}

.preview-date {
  font-size: 13px;
  letter-spacing: 0.24em;
  color: #e6cba8;
  margin-top: 8px;
}

/* Font Cards */
.font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.font-card {
  text-align: left;
  padding: 15px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  cursor: pointer;
  transition: all 0.2s ease;
}

.font-card:hover {
  border-color: var(--gold);
  background: #ffffff;
}

.font-card.is-selected {
  border-color: var(--gold-dark);
  background: #fffcf7;
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.font-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-dark);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.font-sample-zh {
  font-size: 21px;
  color: var(--ink);
  line-height: 1.3;
}

.font-sample-en {
  font-size: 16px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* Switches & Checkboxes */
.toggle-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.toggle-text {
  display: flex;
  flex-direction: column;
}

.toggle-title {
  font-size: 14px;
  font-weight: 500;
}

.toggle-sub {
  font-size: 12px;
  color: var(--ink-muted);
}

.switch {
  width: 44px;
  height: 24px;
  appearance: none;
  -webkit-appearance: none;
  background: #d7cec2;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.switch:checked {
  background: var(--gold);
}

.switch:checked::after {
  transform: translateX(20px);
}

/* Styles & Photos Accordion */
.style-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  margin-bottom: 14px;
  overflow: hidden;
}

.style-card.is-disabled {
  opacity: 0.65;
}

.style-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #ffffff;
  flex-wrap: wrap;
}

.style-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.style-cover {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.style-title-input {
  width: 170px;
  padding: 6px 10px;
  font-size: 14px;
}

.style-meta {
  font-size: 12px;
  color: var(--ink-muted);
}

.style-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.photo-tile {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--gold);
  background: #14110f;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

.photo-tile:hover {
  transform: translateY(-2px);
}

.photo-tile.is-excluded {
  border-color: transparent;
  opacity: 0.42;
  filter: grayscale(0.75);
}

.photo-tile img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  object-position: center 22%;
  display: block;
}

.photo-tile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: #ffffff;
  font-size: 11px;
  color: var(--ink);
}

.photo-badge {
  position: absolute;
  top: 7px;
  left: 7px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  background: rgba(14, 11, 10, 0.72);
  color: #f6ede1;
}

.photo-check {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--gold);
  color: #fff;
}

.photo-tile.is-excluded .photo-check {
  background: rgba(0, 0, 0, 0.55);
}

/* Audio Track Rows */
.track-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.track-row.is-disabled {
  opacity: 0.55;
}

.track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  flex: 1;
}

.track-title {
  font-weight: 500;
  font-size: 14.5px;
}

.track-file {
  font-size: 12px;
  color: var(--ink-muted);
}

.track-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.track-controls audio {
  height: 34px;
  max-width: 260px;
}

/* Messages Table / List */
.msg-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.msg-toolbar .input {
  max-width: 320px;
}

.quick-add-box {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.quick-add-box .input-author {
  width: 230px;
}

.quick-add-box .input-text {
  flex: 1;
  min-width: 220px;
}

.msg-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 16px;
  background: var(--surface-soft);
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.msg-main {
  flex: 1;
  min-width: 240px;
}

.msg-author-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.msg-author {
  font-weight: 600;
  color: var(--gold-dark);
  font-size: 14.5px;
}

.msg-time {
  font-size: 12px;
  color: var(--ink-muted);
}

.msg-text {
  font-size: 14.5px;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Toast Notification */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  padding: 12px 18px;
  border-radius: 12px;
  background: #231d18;
  color: #fbf8f3;
  font-size: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(230, 203, 168, 0.35);
}

.toast.is-error {
  background: #8c2f28;
}

.unsaved-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffd670;
}
