/* ================================================================
   Tuduck Studio Visual Upgrade — Phase 0
   Art-Directed Design Tokens + Glass System + Micro-interactions
   Loaded AFTER styles.css, overrides with same specificity.
   ================================================================ */

/* ----------------------------------------------------------------
   1. DESIGN TOKENS — Optical color system (Layer 0~3)
   ---------------------------------------------------------------- */
:root {
  /* Atmosphere */
  --td-bg: #040508;
  --td-bg-2: #0A0E18;
  --td-bg-elevated: #0F1522;
  --td-bg-deep: #020305;

  /* Optical glows — air itself */
  --td-atmosphere-gold: rgba(245, 193, 108, 0.04);
  --td-atmosphere-cyan: rgba(105, 216, 255, 0.03);
  --td-atmosphere-purple: rgba(167, 139, 250, 0.025);

  /* Structure */
  --td-border: rgba(255, 255, 255, 0.06);
  --td-border-strong: rgba(255, 255, 255, 0.10);
  --td-border-gold: rgba(233, 196, 106, 0.20);
  --td-line: rgba(255, 255, 255, 0.04);

  /* Content */
  --td-text-main: rgba(255, 255, 255, 0.92);
  --td-text-sub: rgba(255, 255, 255, 0.58);
  --td-text-faint: rgba(255, 255, 255, 0.32);
  --td-text-gold: #F5C16C;

  /* Brand optical */
  --td-gold: #E9C46A;
  --td-gold-2: #FFD98A;
  --td-gold-glow: rgba(233, 196, 106, 0.18);
  --td-cyan: #69D8FF;
  --td-cyan-glow: rgba(105, 216, 255, 0.15);
  --td-mint: #73E6AD;
  --td-purple: #A78BFA;

  /* Focus / Action */
  --td-action-gradient: linear-gradient(135deg, #6366F1 0%, #A855F7 50%, #EC4899 100%);
  --td-action-glow: rgba(236, 72, 153, 0.25);
  --td-gold-gradient: linear-gradient(135deg, #E9C46A, #FFD98A);

  /* Depth & Shadow (optical, not "black boxes") */
  --td-shadow-sm: 0 1px 2px rgba(0,0,0,0.20), 0 0 1px rgba(0,0,0,0.10);
  --td-shadow-md: 0 4px 12px rgba(0,0,0,0.25), 0 0 1px rgba(0,0,0,0.15);
  --td-shadow-lg: 0 12px 40px rgba(0,0,0,0.35), 0 0 1px rgba(0,0,0,0.20);
  --td-shadow-xl: 0 24px 80px rgba(0,0,0,0.45), 0 0 1px rgba(0,0,0,0.25);
  --td-inset-glow: inset 0 1px 1px rgba(255,255,255,0.08);
  --td-inset-glow-strong: inset 0 1px 1px rgba(255,255,255,0.12);

  /* Easing curves */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light theme optical system */
:root[data-theme="light"] {
  --td-bg: #F0EDE8;
  --td-bg-2: #FAF8F5;
  --td-bg-elevated: #FFFFFF;
  --td-bg-deep: #E8E4DE;

  --td-atmosphere-gold: rgba(217, 119, 6, 0.04);
  --td-atmosphere-cyan: rgba(59, 130, 246, 0.03);

  --td-border: rgba(0, 0, 0, 0.06);
  --td-border-strong: rgba(0, 0, 0, 0.10);
  --td-border-gold: rgba(217, 119, 6, 0.25);
  --td-line: rgba(0, 0, 0, 0.04);

  --td-text-main: rgba(28, 32, 44, 0.92);
  --td-text-sub: rgba(28, 32, 44, 0.58);
  --td-text-faint: rgba(28, 32, 44, 0.32);
  --td-text-gold: #B45309;

  --td-gold: #D97706;
  --td-gold-2: #F59E0B;
  --td-gold-glow: rgba(217, 119, 6, 0.12);
  --td-cyan: #3B82F6;
  --td-cyan-glow: rgba(59, 130, 246, 0.12);

  --td-action-gradient: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #DB2777 100%);
  --td-action-glow: rgba(219, 39, 119, 0.20);

  --td-shadow-sm: 0 1px 2px rgba(0,0,0,0.06), 0 0 1px rgba(0,0,0,0.04);
  --td-shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.04);
  --td-shadow-lg: 0 12px 40px rgba(0,0,0,0.10), 0 0 1px rgba(0,0,0,0.05);
  --td-shadow-xl: 0 24px 80px rgba(0,0,0,0.12), 0 0 1px rgba(0,0,0,0.06);
  --td-inset-glow: inset 0 1px 1px rgba(255,255,255,0.80);
  --td-inset-glow-strong: inset 0 1px 1px rgba(255,255,255,1);
}

/* ----------------------------------------------------------------
   2. FILM GRAIN SYSTEM — switchable via data-grain
   ---------------------------------------------------------------- */
[data-grain="off"] .app::before {
  display: none;
}

.app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
}

[data-theme="light"] .app::before {
  opacity: 0.015;
  filter: invert(1);
}

/* ----------------------------------------------------------------
   3. GLOBAL ATMOSPHERE — .app background upgrade
   ---------------------------------------------------------------- */
.app {
  background:
    radial-gradient(ellipse 60% 50% at 8% 5%, rgba(245, 193, 108, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 92% 8%, rgba(105, 216, 255, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(10, 14, 28, 0.8) 0%, transparent 70%),
    linear-gradient(180deg, #040508 0%, #060810 40%, #05070D 100%);
}

[data-theme="light"] .app {
  background:
    radial-gradient(ellipse 60% 50% at 8% 5%, rgba(217, 119, 6, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 92% 8%, rgba(59, 130, 246, 0.04) 0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(240, 237, 232, 0.6) 0%, transparent 70%),
    linear-gradient(180deg, #F0EDE8 0%, #FAF8F5 40%, #F5F2EC 100%);
}

/* ----------------------------------------------------------------
   4. GLASS SYSTEM — unified glassmorphism classes
   ---------------------------------------------------------------- */
.td-glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.055) 0%, rgba(255,255,255,0.02) 100%);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--td-border);
  box-shadow: var(--td-inset-glow), var(--td-shadow-md);
}

.td-glass-thick {
  background: linear-gradient(180deg, rgba(15, 21, 34, 0.85) 0%, rgba(10, 14, 24, 0.90) 100%);
  backdrop-filter: blur(32px) saturate(140%);
  -webkit-backdrop-filter: blur(32px) saturate(140%);
  border: 1px solid var(--td-border-strong);
  box-shadow: var(--td-inset-glow-strong), var(--td-shadow-xl);
}

.td-glass-shine {
  background:
    radial-gradient(circle at 30% 0%, rgba(245, 193, 108, 0.08), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(105, 216, 255, 0.05), transparent 40%),
    linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--td-border-strong);
  box-shadow: var(--td-inset-glow), 0 20px 60px rgba(0,0,0,0.35);
}

[data-theme="light"] .td-glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.72) 0%, rgba(255,255,255,0.60) 100%);
  border-color: rgba(0,0,0,0.06);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.90), var(--td-shadow-md);
}

[data-theme="light"] .td-glass-thick {
  background: linear-gradient(180deg, rgba(250,248,245,0.92) 0%, rgba(240,237,232,0.95) 100%);
  border-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .td-glass-shine {
  background:
    radial-gradient(circle at 30% 0%, rgba(217,119,6,0.06), transparent 50%),
    linear-gradient(180deg, rgba(255,255,255,0.80) 0%, rgba(255,255,255,0.65) 100%);
}

/* ----------------------------------------------------------------
   5. TOPBAR — cinematic navigation
   ---------------------------------------------------------------- */
.topbar {
  background: linear-gradient(180deg, rgba(4, 5, 8, 0.85) 0%, rgba(6, 8, 14, 0.75) 100%);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.06), 0 4px 24px rgba(0,0,0,0.30);
}

[data-theme="light"] .topbar {
  background: linear-gradient(180deg, rgba(255,255,255,0.82) 0%, rgba(250,248,245,0.72) 100%);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.90), 0 4px 24px rgba(0,0,0,0.06);
}

/* Logo */
.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--td-gold-gradient);
  box-shadow:
    0 0 0 1px rgba(233,196,106,0.30),
    0 4px 12px rgba(233,196,106,0.20);
  transition: box-shadow 0.25s ease, transform 0.15s ease;
}

.logo:hover .logo-mark {
  box-shadow:
    0 0 0 1px rgba(233,196,106,0.50),
    0 6px 20px rgba(233,196,106,0.30);
  transform: translateY(-1px);
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--td-text-main);
  letter-spacing: -0.3px;
}

/* Nav buttons */
.topbar-nav button {
  min-height: 34px;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 34px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--td-text-sub);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.topbar-nav button::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(245,193,108,0.10), rgba(105,216,255,0.06));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.topbar-nav button:hover {
  color: var(--td-text-main);
  border-color: var(--td-border-strong);
}

.topbar-nav button:hover::before {
  opacity: 1;
}

.topbar-nav button.active {
  color: var(--td-text-main);
  background: rgba(255,255,255,0.08);
  border-color: rgba(233,196,106,0.25);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.06), 0 0 0 1px rgba(233,196,106,0.08);
}

.topbar-nav button.active::before {
  opacity: 0.6;
}

[data-theme="light"] .topbar-nav button {
  color: var(--td-text-sub);
}

[data-theme="light"] .topbar-nav button.active {
  background: rgba(201,151,42,0.10);
  border-color: rgba(201,151,42,0.30);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.80), 0 0 0 1px rgba(201,151,42,0.08);
}

/* ----------------------------------------------------------------
   6. BUTTON SYSTEM — mechanical precision
   ---------------------------------------------------------------- */
button {
  min-height: var(--button-h);
  padding: 0 16px;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius-md);
  color: var(--td-text-main);
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%);
  font-size: var(--td-font-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.12s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

button:hover {
  border-color: var(--td-border-strong);
  background: linear-gradient(180deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.04) 100%);
  transform: translateY(-1px);
  box-shadow: var(--td-shadow-sm);
}

button:hover::after {
  opacity: 1;
}

button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: none;
  transition-duration: 0.08s;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
  transform: none;
  box-shadow: none;
}

/* Primary (Gold) */
button.primary,
.primary {
  min-height: var(--button-h-primary);
  padding: 0 20px;
  border-color: transparent;
  border-radius: 12px;
  color: #0A0E18;
  font-size: var(--td-font-md);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--td-gold-gradient);
  box-shadow:
    0 0 0 1px rgba(233,196,106,0.30),
    0 4px 14px rgba(233,196,106,0.25);
}

button.primary::after {
  background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, transparent 60%);
  opacity: 0.5;
}

button.primary:hover {
  background: linear-gradient(135deg, #F0C87A, #FFE49A);
  box-shadow:
    0 0 0 1px rgba(233,196,106,0.50),
    0 6px 24px rgba(233,196,106,0.35);
  transform: translateY(-2px);
}

button.primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow:
    0 0 0 1px rgba(233,196,106,0.30),
    0 2px 8px rgba(233,196,106,0.20);
}

/* Action (Gradient) — NEW VARIANT */
button.action,
.action {
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  background: var(--td-action-gradient);
  box-shadow:
    0 0 0 1px rgba(167,139,250,0.25),
    0 4px 16px rgba(236,72,153,0.25);
}

button.action::after {
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0.4;
}

button.action:hover {
  box-shadow:
    0 0 0 1px rgba(167,139,250,0.40),
    0 6px 28px rgba(236,72,153,0.35);
  transform: translateY(-2px);
  filter: brightness(1.08);
}

button.action:active {
  transform: translateY(0) scale(0.97);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  border-color: var(--td-border-strong);
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.14);
}

/* Icon button */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  font-size: 16px;
  min-height: unset;
}

/* Light overrides for buttons */
[data-theme="light"] button {
  border-color: rgba(0,0,0,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.80) 0%, rgba(255,255,255,0.60) 100%);
  color: var(--td-text-main);
}

[data-theme="light"] button:hover {
  border-color: rgba(0,0,0,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.80) 100%);
}

[data-theme="light"] button.primary,
[data-theme="light"] .primary {
  color: #2a1f08;
  background: linear-gradient(135deg, #E9C46A, #f5c16c);
  box-shadow: 0 0 0 1px rgba(194,138,27,0.25), 0 4px 16px rgba(194,138,27,0.22);
}

[data-theme="light"] button.primary:hover {
  background: linear-gradient(135deg, #f0cc7a, #ffd78a);
  box-shadow: 0 0 0 1px rgba(194,138,27,0.40), 0 6px 22px rgba(194,138,27,0.28);
}

[data-theme="light"] button.action {
  box-shadow:
    0 0 0 1px rgba(124,58,237,0.20),
    0 4px 16px rgba(219,39,119,0.20);
}

[data-theme="light"] .btn-ghost:hover {
  background: rgba(0,0,0,0.03);
}

/* ----------------------------------------------------------------
   7. CARD SYSTEM — tactile surfaces
   ---------------------------------------------------------------- */
.hero,
.card,
.modal,
.lane {
  background:
    radial-gradient(circle at 90% 8%, rgba(105, 216, 255, 0.04), transparent 30%),
    radial-gradient(circle at 10% 90%, rgba(245, 193, 108, 0.03), transparent 25%),
    linear-gradient(180deg, rgba(255,255,255,0.045) 0%, rgba(255,255,255,0.015) 100%),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 8px 32px rgba(0,0,0,0.25);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--td-border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 16px 48px rgba(0,0,0,0.32);
}

/* Media card image zoom */
.media-card > img {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.media-card:hover > img {
  transform: scale(1.03);
}

/* Selected state */
.selected {
  border-color: rgba(233,196,106,0.50) !important;
  box-shadow:
    0 0 0 1px rgba(233,196,106,0.15),
    0 0 24px rgba(233,196,106,0.12),
    0 14px 38px rgba(0,0,0,0.28) !important;
  transform: translateY(-1px);
}

[data-theme="light"] .selected {
  box-shadow:
    0 0 0 1px rgba(201,151,42,0.18),
    0 0 20px rgba(201,151,42,0.10),
    0 10px 28px rgba(60,40,10,0.08) !important;
}

/* Light card overrides */
[data-theme="light"] .hero,
[data-theme="light"] .card,
[data-theme="light"] .modal,
[data-theme="light"] .lane {
  background:
    radial-gradient(circle at 90% 8%, rgba(59,130,246,0.03), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.80) 0%, rgba(255,255,255,0.60) 100%),
    var(--panel);
  box-shadow: inset 0 1px 0 rgba(255,255,255,1), 0 4px 18px rgba(60,40,10,0.06);
}

[data-theme="light"] .card:hover {
  box-shadow: inset 0 1px 0 rgba(255,255,255,1), 0 8px 28px rgba(60,40,10,0.10);
}

/* ----------------------------------------------------------------
   8. MODAL SYSTEM — spatial layer crossing
   ---------------------------------------------------------------- */
.modal-backdrop {
  background: rgba(2, 3, 5, 0.65);
  backdrop-filter: blur(12px) saturate(80%);
  -webkit-backdrop-filter: blur(12px) saturate(80%);
  animation: modal-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-in {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to { opacity: 1; backdrop-filter: blur(12px); }
}

.modal {
  background:
    radial-gradient(circle at 20% 0%, rgba(245, 193, 108, 0.06), transparent 40%),
    linear-gradient(180deg, rgba(15, 21, 34, 0.95) 0%, rgba(8, 12, 22, 0.98) 100%);
  border: 1px solid var(--td-border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 40px 100px rgba(0,0,0,0.55);
  animation: modal-content-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-content-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--td-line);
}

.modal-head h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--td-text-main);
}

.modal-head > button {
  min-height: 32px;
  width: 32px;
  padding: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--td-text-sub);
  background: transparent;
  border-color: transparent;
}

.modal-head > button:hover {
  background: rgba(255,255,255,0.06);
  color: var(--td-text-main);
}

[data-theme="light"] .modal-backdrop {
  background: rgba(240, 237, 232, 0.55);
}

[data-theme="light"] .modal {
  background:
    radial-gradient(circle at 20% 0%, rgba(217,119,6,0.04), transparent 40%),
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(250,248,245,0.96) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    0 40px 100px rgba(0,0,0,0.12);
}

[data-theme="light"] .modal-head > button:hover {
  background: rgba(0,0,0,0.04);
}

/* ----------------------------------------------------------------
   9. FORM ELEMENTS
   ---------------------------------------------------------------- */
input[type="text"],
input[type="search"],
textarea,
select {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--td-border);
  border-radius: var(--td-radius-md);
  color: var(--td-text-main);
  font-size: var(--td-font-sm);
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--td-text-faint);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(233,196,106,0.35);
  box-shadow: 0 0 0 3px rgba(233,196,106,0.08);
}

textarea {
  min-height: 120px;
  padding: 12px;
  line-height: 1.6;
  resize: vertical;
}

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="search"],
[data-theme="light"] textarea,
[data-theme="light"] select {
  background: linear-gradient(180deg, rgba(255,255,255,0.90) 0%, rgba(255,255,255,0.70) 100%);
  border-color: rgba(0,0,0,0.08);
}

[data-theme="light"] input:focus,
[data-theme="light"] textarea:focus,
[data-theme="light"] select:focus {
  border-color: rgba(217,119,6,0.35);
  box-shadow: 0 0 0 3px rgba(217,119,6,0.08);
}

/* ----------------------------------------------------------------
   10. BADGE / TAG SYSTEM
   ---------------------------------------------------------------- */
.badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  width: fit-content;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.15s ease;
}

.badge:hover,
.tag:hover {
  transform: translateY(-1px);
}

.badge.ok,
.status-可用,
.status-已通过,
.status-已锁定,
.status-推荐,
.status-已同步,
.status-已生成 {
  border-color: rgba(115,230,173,0.30);
  color: #73E6AD;
  background: rgba(115,230,173,0.08);
}

.status-缺失,
.status-要重做,
.status-需补齐,
.status-已废弃 {
  border-color: rgba(255,100,100,0.30);
  color: #FF8080;
  background: rgba(255,100,100,0.08);
}

.status-待确认,
.status-待制作,
.status-未生成,
.status-生成中,
.status-候选生成 {
  border-color: rgba(245,193,108,0.30);
  color: #F5C16C;
  background: rgba(245,193,108,0.08);
}

.status-生成中 {
  animation: pulse-gold 2s ease-in-out infinite;
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,193,108,0.20); }
  50% { box-shadow: 0 0 0 4px rgba(245,193,108,0); }
}

/* ----------------------------------------------------------------
   11. SCROLLBAR — detail reveals craft
   ---------------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  border: 1px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }
::-webkit-scrollbar-corner { background: transparent; }

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.08);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.14);
}

/* ----------------------------------------------------------------
   12. ANIMATIONS & MICRO-INTERACTIONS
   ---------------------------------------------------------------- */

/* Page enter */
.page {
  animation: page-enter 0.4s var(--ease-out-expo);
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card stagger (apply .card-stagger on parent) */
.card-stagger > * {
  animation: card-enter 0.5s var(--ease-out-expo) backwards;
}
.card-stagger > *:nth-child(1) { animation-delay: 0.04s; }
.card-stagger > *:nth-child(2) { animation-delay: 0.08s; }
.card-stagger > *:nth-child(3) { animation-delay: 0.12s; }
.card-stagger > *:nth-child(4) { animation-delay: 0.16s; }
.card-stagger > *:nth-child(5) { animation-delay: 0.20s; }
.card-stagger > *:nth-child(6) { animation-delay: 0.24s; }

@keyframes card-enter {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Interactive hover language */
.interactive {
  transition: transform 0.2s var(--ease-out-quart), box-shadow 0.2s ease, border-color 0.15s ease;
}
.interactive:hover { transform: translateY(-1px); }
.interactive:active { transform: translateY(0) scale(0.98); transition-duration: 0.08s; }

/* ----------------------------------------------------------------
   13. HERO CINEMA — poster-grade hero sections
   ---------------------------------------------------------------- */
.hero.cinema {
  position: relative;
  min-height: 360px;
  padding: 40px 36px;
  border-radius: var(--td-radius-xl);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 30%),
    radial-gradient(ellipse 70% 60% at 30% 50%, rgba(105, 216, 255, 0.04), transparent 60%),
    radial-gradient(circle at 85% 15%, rgba(245, 193, 108, 0.10), transparent 35%),
    linear-gradient(135deg, #070A14 0%, #0C1120 50%, #060810 100%);
  border: 1px solid var(--td-border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 24px 80px rgba(0,0,0,0.35);
}

.hero.cinema::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.03;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hero.cinema h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -1.8px;
  line-height: 1.1;
  color: var(--td-text-main);
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.hero.cinema .eyebrow {
  display: inline-block;
  color: var(--td-gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 14px;
  padding: 4px 10px;
  border: 1px solid rgba(233,196,106,0.20);
  border-radius: 6px;
  background: rgba(233,196,106,0.06);
}

.hero-sub {
  font-size: 16px;
  line-height: 1.7;
  color: var(--td-text-sub);
  max-width: 520px;
  margin-top: 14px;
}

.hero-stats {
  display: flex;
  gap: 32px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--td-line);
}

.hero-stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-stats strong {
  font-size: 28px;
  font-weight: 800;
  color: var(--td-text-main);
  line-height: 1;
  letter-spacing: -0.5px;
}

.hero-stats span {
  font-size: 12px;
  color: var(--td-text-faint);
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* Hero CTA button */
.hero-cta button.primary {
  min-height: 48px;
  padding: 0 28px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(233,196,106,0.35),
    0 6px 24px rgba(233,196,106,0.30),
    0 16px 48px rgba(233,196,106,0.12);
}

.hero-cta button.primary:hover {
  transform: translateY(-3px);
  box-shadow:
    0 0 0 1px rgba(233,196,106,0.50),
    0 10px 36px rgba(233,196,106,0.40),
    0 24px 60px rgba(233,196,106,0.18);
}

/* Light hero */
[data-theme="light"] .hero.cinema {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.40) 0%, transparent 30%),
    radial-gradient(ellipse 70% 60% at 30% 50%, rgba(59,130,246,0.03), transparent 60%),
    radial-gradient(circle at 85% 15%, rgba(217,119,6,0.06), transparent 35%),
    linear-gradient(135deg, #FAF8F5 0%, #FFFFFF 50%, #F5F2EC 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,1), 0 24px 80px rgba(0,0,0,0.06);
}

/* Video player page: suppress grain for immersion */
.app.no-grain::before {
  display: none;
}

/* ----------------------------------------------------------------
   14. COMMAND PALETTE — professional console
   ---------------------------------------------------------------- */
.command-palette {
  background: linear-gradient(180deg, rgba(15,21,34,0.95) 0%, rgba(8,12,22,0.98) 100%);
  backdrop-filter: blur(32px) saturate(140%);
  -webkit-backdrop-filter: blur(32px) saturate(140%);
  border: 1px solid var(--td-border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 40px 100px rgba(0,0,0,0.55);
  border-radius: var(--td-radius-xl);
  animation: modal-content-in 0.2s var(--ease-out-expo);
}

.command-palette input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--td-border);
  border-radius: 0;
  font-size: 18px;
  padding: 16px 20px;
  box-shadow: none;
}

.command-palette input:focus {
  box-shadow: none;
  border-bottom-color: rgba(233,196,106,0.35);
}

.command-palette button {
  display: flex;
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
  cursor: pointer;
  text-align: left;
  background: transparent;
  color: var(--td-text-main);
}

.command-palette button:hover,
.command-palette button.selected {
  background: rgba(255,255,255,0.06);
  border-left: 2px solid var(--td-gold);
}

[data-theme="light"] .command-palette {
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(250,248,245,0.96) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,1), 0 40px 100px rgba(0,0,0,0.12);
}

[data-theme="light"] .command-palette-item:hover,
[data-theme="light"] .command-palette-item.selected {
  background: rgba(0,0,0,0.04);
}

/* ----------------------------------------------------------------
   15. EMPTY STATE — breathing waiting room
   ---------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.empty-state::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 40px,
      rgba(255,255,255,0.5) 40px,
      rgba(255,255,255,0.5) 41px
    );
  animation: empty-scan 8s linear infinite;
  pointer-events: none;
}

@keyframes empty-scan {
  from { transform: translateX(-41px); }
  to { transform: translateX(0); }
}

.empty-state-icon {
  font-size: 40px;
  opacity: 0.45;
  filter: grayscale(0.3);
  transition: opacity 0.3s ease, filter 0.3s ease;
  animation: float 3s ease-in-out infinite;
}

.empty-state:hover .empty-state-icon {
  opacity: 0.8;
  filter: grayscale(0);
}

.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--td-text-sub);
}

.empty-state-subtitle {
  font-size: 13px;
  color: var(--td-text-faint);
  max-width: 320px;
  line-height: 1.6;
}

.empty-state-action {
  margin-top: 8px;
}

[data-theme="light"] .empty-state::before {
  opacity: 0.02;
  background: repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(0,0,0,0.4) 40px, rgba(0,0,0,0.4) 41px);
}

/* ----------------------------------------------------------------
   16. FOCUS SYSTEM — soft gold glow (accessibility + art)
   ---------------------------------------------------------------- */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(233,196,106,0.35), 0 0 0 4px rgba(233,196,106,0.10);
  border-radius: inherit;
}

[data-theme="light"] :focus-visible {
  box-shadow: 0 0 0 2px rgba(217,119,6,0.30), 0 0 0 4px rgba(217,119,6,0.08);
}

/* Override older focus styles from styles.css */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
}

/* ----------------------------------------------------------------
   17. CONTEXT BAR — project/quick mode indicator (预留组件样式)
   ---------------------------------------------------------------- */
.context-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px var(--td-page-pad-x);
  border-bottom: 1px solid var(--td-border);
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(16px);
}

.context-bar-quick {
  background: linear-gradient(90deg, rgba(99,102,241,0.08) 0%, rgba(236,72,153,0.04) 100%);
}

.context-bar-project {
  background: linear-gradient(90deg, rgba(245,193,108,0.08) 0%, rgba(105,216,255,0.04) 100%);
}

.context-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.context-icon { font-size: 14px; }

.context-label {
  color: var(--td-text-sub);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 10px;
}

.context-project-name {
  color: var(--td-text-main);
  font-weight: 700;
  font-size: 13px;
}

.context-chevron { color: var(--td-text-faint); font-size: 14px; }

.context-shot {
  color: var(--td-gold);
  font-weight: 700;
  font-size: 12px;
  font-family: "SF Mono", monospace;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(233,196,106,0.08);
  border: 1px solid rgba(233,196,106,0.15);
}

.context-switch {
  font-size: 11px;
  font-weight: 700;
  color: var(--td-cyan);
  background: transparent;
  border: 1px solid rgba(105,216,255,0.20);
  padding: 4px 12px;
  border-radius: 6px;
  min-height: unset;
}

.context-switch:hover {
  background: rgba(105,216,255,0.08);
  border-color: rgba(105,216,255,0.35);
}

.context-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--td-mint);
  box-shadow: 0 0 6px rgba(115,230,173,0.40);
  animation: status-breathe 3s ease-in-out infinite;
}

@keyframes status-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ----------------------------------------------------------------
   18. MOTION PREFERENCES — respect the user
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .page,
  .card-stagger > *,
  .modal-backdrop,
  .modal,
  .command-palette,
  .empty-state::before,
  .status-生成中,
  .context-status-dot {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* ----------------------------------------------------------------
   19. MOBILE RESPONSIVE — Public Review + Template Picker
   ---------------------------------------------------------------- */

/* Public Review mobile tabs */
.public-review-mobile-tabs {
  display: none;
  padding: 8px 16px;
  gap: 8px;
  border-bottom: 1px solid var(--td-border);
  background: var(--td-bg-elevated);
}
.public-review-mobile-tabs button {
  flex: 1;
  padding: 10px 0;
  font-size: 14px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--td-border);
  color: var(--td-text-sub);
}
.public-review-mobile-tabs button.active {
  background: var(--td-gold-gradient);
  color: #0A0E18;
  border-color: transparent;
  font-weight: 700;
}

/* Template picker */
.template-picker-modal {
  max-width: 720px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}
.template-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 16px 0;
}
.template-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.template-card h3 {
  font-size: 15px;
  margin: 0;
}
.template-card p {
  font-size: 12px;
  color: var(--td-text-sub);
  margin: 0;
}
.template-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.template-preset {
  opacity: 0.85;
}

/* Report export modal */
.report-export-modal {
  max-width: 640px;
  width: 90vw;
}

/* Mobile breakpoint */
@media (max-width: 768px) {
  .public-review-mobile-tabs {
    display: flex;
  }
  .public-review-body {
    display: block;
    padding: 0;
  }
  .public-shot-list,
  .public-issues {
    display: none;
    width: 100%;
    padding: 12px;
  }
  .public-shot-list.mobile-active,
  .public-issues.mobile-active,
  .public-canvas.mobile-active {
    display: block;
  }
  .public-canvas {
    display: none;
    padding: 12px;
  }
  .public-player-canvas {
    min-height: 240px;
  }
  .public-player-canvas img {
    max-height: 50vh;
  }
  .public-feedback .button-row {
    flex-direction: column;
  }
  .public-feedback .button-row button {
    width: 100%;
    min-height: 44px;
  }
  .public-shot-list button {
    min-height: 44px;
  }
  .template-picker-grid {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------------------------------------------
   20. MOTION PREFERENCES — respect the user
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .page,
  .card-stagger > *,
  .modal-backdrop,
  .modal,
  .command-palette,
  .empty-state::before,
  .status-生成中,
  .context-status-dot {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* ----------------------------------------------------------------
   21. INBOX POPOVER & DRAWER STYLES
   ---------------------------------------------------------------- */

.inbox-popover {
  position: relative;
}

.inbox-trigger {
  position: relative;
}

.inbox-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

.inbox-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--td-bg-elevated);
  border: 1px solid var(--td-border);
  border-radius: 12px;
  box-shadow: var(--td-shadow-md);
  z-index: 200;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.inbox-head,
.inbox-drawer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--td-border);
  font-size: 13px;
}

.inbox-head strong,
.inbox-drawer-head strong {
  font-size: 14px;
  color: var(--td-text-main);
}

.inbox-head span,
.inbox-drawer-head span {
  color: var(--td-text-sub);
  font-size: 12px;
  flex: 1;
}

.inbox-pin-btn {
  background: transparent;
  border: none;
  font-size: 14px;
  padding: 4px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.inbox-pin-btn:hover,
.inbox-pin-btn.active {
  opacity: 1;
}

.inbox-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}

.inbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 4px;
  transition: background 0.2s;
  position: relative;
}

.inbox-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.inbox-item.unread {
  background: rgba(59, 130, 246, 0.06);
}

.inbox-item.handled {
  opacity: 0.6;
}

.inbox-icon {
  font-size: 18px;
  margin-top: 2px;
}

.inbox-body {
  flex: 1;
  min-width: 0;
}

.inbox-body strong {
  font-size: 13px;
  color: var(--td-text-main);
  display: block;
  margin-bottom: 2px;
}

.inbox-body p {
  font-size: 12px;
  color: var(--td-text-sub);
  margin: 0 0 4px;
  line-height: 1.4;
}

.inbox-body em {
  font-size: 11px;
  color: var(--td-text-faint);
  font-style: normal;
}

.inbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.inbox-actions button.small {
  padding: 3px 10px;
  font-size: 11px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--td-cyan);
  border: 1px solid rgba(105, 216, 255, 0.25);
}

.inbox-actions button.small.ghost {
  background: transparent;
  color: var(--td-text-sub);
  border: 1px solid var(--td-border);
}

.inbox-actions button.small:hover {
  background: rgba(59, 130, 246, 0.25);
}

.handled-badge {
  font-size: 11px;
  color: var(--td-mint);
  margin-top: 4px;
  display: inline-block;
}

.inbox-markread {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.inbox-item:hover .inbox-markread {
  opacity: 1;
}

.inbox-read-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--td-text-faint);
}

.inbox-item.unread .inbox-read-dot {
  background: var(--td-cyan);
  box-shadow: 0 0 6px rgba(105, 216, 255, 0.4);
}

.inbox-empty {
  text-align: center;
  color: var(--td-text-faint);
  font-size: 13px;
  padding: 24px;
}

/* Pinned drawer */
.inbox-drawer {
  position: fixed;
  top: 56px;
  right: 0;
  width: 320px;
  height: calc(100vh - 56px);
  background: var(--td-bg-elevated);
  border-left: 1px solid var(--td-border);
  z-index: 150;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.3);
}

.inbox-drawer .inbox-list {
  flex: 1;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .inbox-dropdown {
    width: 100vw;
    right: -8px;
    border-radius: 0;
    top: calc(100% + 4px);
  }
  .inbox-drawer {
    width: 100vw;
    top: 0;
    height: 100vh;
    z-index: 300;
  }
}

/* ----------------------------------------------------------------
   22. PAGE TRANSITIONS
   ---------------------------------------------------------------- */

.page-content > .page {
  animation: page-enter 0.3s ease-out;
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------------
   23. BUDGET & CALENDAR STYLES
   ---------------------------------------------------------------- */

.budget-modal .settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--td-line);
}

.budget-modal .settings-row label {
  font-size: 13px;
  color: var(--td-text-sub);
}

.budget-modal .settings-row input[type="number"] {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--td-border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--td-text-main);
  font-size: 13px;
}

.budget-modal .settings-row input[type="number"]:focus {
  outline: none;
  border-color: var(--td-gold);
}

/* Calendar page */
.project-calendar-page .calendar-grid {
  margin-top: 8px;
}

.project-calendar-page .calendar-grid .card {
  padding: 12px;
  transition: transform 0.2s, border-color 0.2s;
}

.project-calendar-page .calendar-grid .card:hover {
  transform: translateY(-2px);
}

.calendar-task {
  transition: background 0.2s;
}

.calendar-task:hover {
  background: rgba(255,255,255,0.06) !important;
}

@media (max-width: 768px) {
  .project-calendar-page .calendar-grid {
    grid-template-columns: 1fr !important;
  }
}
