﻿/* UI v2: "Neon Atrium" (presentation only)
   Loaded after tokens.css + styles.css + mobile.css so it can override without breaking logic.
   Uses design tokens from tokens.css for consistency. */

body.ui-v2 {
  /* Map tokens to legacy variable names for backwards compatibility */
  --bg: var(--color-bg);
  --fg: var(--color-text);
  --muted: var(--color-text-muted);
  --panel: var(--color-surface);
  --border: var(--color-border);
  --accent: var(--color-accent);
  --accent2: var(--color-accent-secondary);
  --good: var(--color-success);
  --warn: var(--color-warning);
  --bad: var(--color-danger);

  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

body.ui-v2::before {
  content: "";
  position: fixed;
  inset: -20vh -10vw;
  pointer-events: none;
  z-index: -2;
  background:
    radial-gradient(60% 50% at 20% 0%, rgba(179, 140, 255, 0.22), transparent 60%),
    radial-gradient(50% 40% at 85% 15%, rgba(53, 227, 255, 0.16), transparent 55%),
    radial-gradient(55% 45% at 55% 90%, rgba(255, 77, 141, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(7, 6, 11, 0.9), rgba(7, 6, 11, 1) 55%);
  filter: saturate(115%) contrast(110%);
}

body.ui-v2::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.1;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: overlay;
}

/* ========================================
   TENSION REACTIVITY
   ======================================== */

/* Intensity 1: Subtle atmosphere Shift */
html[data-tension-intensity="1"] body.ui-v2::before {
  filter: saturate(130%) contrast(115%);
  opacity: 0.95;
}

/* Intensity 2: Rising Pressure */
html[data-tension-intensity="2"] body.ui-v2::before {
  filter: saturate(150%) contrast(125%) hue-rotate(-5deg);
  background:
    radial-gradient(70% 60% at 20% 0%, rgba(179, 140, 255, 0.3), transparent 65%),
    radial-gradient(60% 50% at 85% 15%, rgba(53, 227, 255, 0.25), transparent 60%),
    radial-gradient(65% 55% at 55% 90%, rgba(255, 77, 141, 0.2), transparent 65%),
    linear-gradient(180deg, rgba(7, 6, 11, 0.9), rgba(7, 6, 11, 1) 55%);
}

html[data-tension-intensity="2"] body.ui-v2 #content {
  box-shadow: 0 0 30px rgba(179, 140, 255, 0.15), var(--shadow-xl);
  border-color: color-mix(in srgb, var(--color-border-strong) 60%, transparent);
}

/* Intensity 3: Critical Pressure */
html[data-tension-intensity="3"] body.ui-v2::before {
  filter: saturate(180%) contrast(140%) hue-rotate(-15deg);
  background:
    radial-gradient(80% 70% at 20% 0%, rgba(255, 77, 141, 0.35), transparent 70%),
    radial-gradient(70% 60% at 85% 15%, rgba(179, 140, 255, 0.3), transparent 65%),
    radial-gradient(75% 65% at 55% 90%, rgba(255, 40, 40, 0.25), transparent 70%),
    linear-gradient(180deg, rgba(12, 5, 5, 0.9), rgba(7, 0, 0, 1) 55%);
}

html[data-tension-intensity="3"] body.ui-v2::after {
  opacity: 0.2;
  animation: jitter 0.15s infinite;
}

html[data-tension-intensity="3"] body.ui-v2 #content {
  box-shadow: 0 0 50px rgba(255, 77, 141, 0.25), var(--shadow-xl);
  border-color: var(--color-danger);
}

html[data-tension-intensity="3"] body.ui-v2 #sceneText {
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

@keyframes jitter {
  0% {
    transform: translate(0, 0);
  }

  25% {
    transform: translate(1px, -1px);
  }

  50% {
    transform: translate(-1px, 1px);
  }

  75% {
    transform: translate(1px, 1px);
  }

  100% {
    transform: translate(0, 0);
  }
}

html[data-theme="light"] body.ui-v2 {
  --bg: var(--color-bg);
  --fg: var(--color-text);
  --muted: var(--color-text-muted);
  --panel: var(--color-surface);
  --border: var(--color-border);
  --accent: var(--color-accent);
  --accent2: var(--color-accent-secondary);
}

/* Top bar - using tokens */
body.ui-v2 header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: color-mix(in srgb, var(--color-surface) 75%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.ui-v2 header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

body.ui-v2 header .tag {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* Shell layout - improved grid with tokens */
body.ui-v2 main {
  max-width: min(100%, var(--max-content-width));
  margin: 0 auto;
  padding: var(--space-5);
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(280px, 30vw, var(--sidebar-width));
  grid-template-areas: "content sidebar";
  gap: var(--space-5);
  align-items: start;
  min-height: calc(100vh - var(--header-height));
}

body.ui-v2 #content {
  grid-area: content;
  border-radius: var(--radius-xl);
  border: 1px solid color-mix(in srgb, var(--color-border) 90%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 92%, transparent), color-mix(in srgb, var(--color-surface) 82%, transparent));
  box-shadow: var(--shadow-xl);
  padding: var(--space-5);
  min-height: 66vh;
  position: relative;
  overflow-x: clip;
  overflow-y: visible;
}

body.ui-v2 #content::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  border-radius: calc(var(--radius-xl) + 2px);
  background:
    radial-gradient(120% 70% at 30% 0%, rgba(179, 140, 255, 0.16), transparent 60%),
    radial-gradient(100% 55% at 85% 20%, rgba(53, 227, 255, 0.12), transparent 55%),
    radial-gradient(80% 45% at 55% 110%, rgba(255, 77, 141, 0.10), transparent 55%);
  opacity: 0.9;
  filter: blur(12px);
}

body.ui-v2 #sidebar {
  grid-area: sidebar;
  position: sticky;
  top: calc(var(--header-height) + var(--space-5));
  max-height: calc(100vh - var(--header-height) - var(--space-8));
  overflow: auto;
  padding-right: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

body.ui-v2 #sidebar .panel {
  margin: 0;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}


body.ui-v2 #content,
body.ui-v2 #sidebar,
body.ui-v2 #sceneText,
body.ui-v2 #sceneText p,
body.ui-v2 #sceneTitle,
body.ui-v2 #sceneMeta,
body.ui-v2 #inventory,
body.ui-v2 #quests,
body.ui-v2 #endings,
body.ui-v2 #achievements,
body.ui-v2 .panel li,
body.ui-v2 .scene-dialogue,
body.ui-v2 .scene-narration {
  user-select: text;
  -webkit-user-select: text;
}

body.ui-v2 #gameControlsPanel .btnrow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  align-items: stretch;
}

body.ui-v2 #gameControlsPanel .btnrow > label {
  align-self: center;
}

body.ui-v2 #gameControlsPanel .btnrow > :is(select, button) {
  width: 100%;
}

body.ui-v2 #sidebar .panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--color-accent-secondary) 28%, transparent), transparent);
  opacity: 0.6;
}

body.ui-v2 .panel h3,
body.ui-v2 .panel h4 {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0 0 10px;
}

body.ui-v2 #sidebar .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-2) 0 var(--space-3);
  margin: 0 0 var(--space-3);
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 65%, transparent);
  background: transparent;
  border-radius: 0;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

body.ui-v2 #sidebar .panel-header:hover {
  background: color-mix(in srgb, var(--color-surface) 30%, transparent);
  margin-left: calc(-1 * var(--space-3));
  margin-right: calc(-1 * var(--space-3));
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  border-radius: var(--radius-sm);
}

body.ui-v2 #sidebar .panel-header h3,
body.ui-v2 #sidebar .panel-header h4 {
  margin: 0;
}

/* OPEN button - improved visibility */
body.ui-v2 #sidebar .panel-header::after {
  content: "Open";
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid color-mix(in srgb, var(--color-accent) 50%, var(--color-border));
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  transition: all var(--transition-fast);
}

body.ui-v2 #sidebar .panel-header:hover::after {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

body.ui-v2 #sidebar .panel-header:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Empty state for panels with no content */
body.ui-v2 #sidebar #stats:empty::after,
body.ui-v2 #sidebar #vitals:empty::after,
body.ui-v2 #sidebar #inventory:empty::after,
body.ui-v2 #sidebar #quests:empty::after,
body.ui-v2 #sidebar #achievements:empty::after,
body.ui-v2 #sidebar #endings:empty::after {
  content: "Start a game to see content";
  display: block;
  padding: var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-dim);
  font-style: italic;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-bg) 30%, transparent);
  border: 1px dashed color-mix(in srgb, var(--color-border) 50%, transparent);
}

/* More specific empty messages */
body.ui-v2 #sidebar #inventory:empty::after {
  content: "Your bag is empty";
}

body.ui-v2 #sidebar #quests:empty::after {
  content: "No active quests";
}

body.ui-v2 #sidebar #achievements:empty::after {
  content: "No achievements yet";
}

body.ui-v2 #sidebar #endings:empty::after {
  content: "No endings discovered";
}

/* Now/Next panel */
body.ui-v2 #nowPanel .now-goal {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

body.ui-v2 #nowPanel .now-hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-2);
}

body.ui-v2 #nowPanel .now-echo {
  font-size: var(--text-xs);
  color: var(--color-text-dim);
  border-top: 1px solid color-mix(in srgb, var(--color-border) 60%, transparent);
  padding-top: var(--space-2);
  line-height: var(--leading-snug);
  min-height: 18px;
}

body.ui-v2 #sidebar #stats {
  font-size: 13px;
  display: grid;
  gap: 10px;
}

body.ui-v2 #sidebar .progress-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  background: color-mix(in srgb, var(--bg) 26%, transparent);
}

body.ui-v2 #sidebar .progress-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

body.ui-v2 #sidebar .progress-summary-points {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

body.ui-v2 #sidebar .progress-summary-points strong {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

body.ui-v2 #sidebar .progress-summary-points.muted {
  color: color-mix(in srgb, var(--muted) 80%, transparent);
}

body.ui-v2 #sidebar .progress-summary .level-tag {
  color: var(--fg);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.ui-v2 #sidebar .progress-summary .xp-label {
  font-variant-numeric: tabular-nums;
}

body.ui-v2 #sidebar .progress-summary-bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel) 75%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

body.ui-v2 #sidebar .progress-summary-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent2) 70%, transparent), color-mix(in srgb, var(--accent) 70%, transparent));
  box-shadow: 0 0 12px rgba(53, 227, 255, 0.25);
}

body.ui-v2 #sidebar .stat-row {
  --stat-accent: color-mix(in srgb, var(--accent2) 80%, transparent);
  --stat-accent-2: color-mix(in srgb, var(--accent) 80%, transparent);
  margin-bottom: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: color-mix(in srgb, var(--bg) 22%, transparent);
}

body.ui-v2 #sidebar .stat-row.focus {
  border-color: color-mix(in srgb, var(--accent2) 55%, var(--border));
  background: color-mix(in srgb, var(--panel) 75%, transparent);
}

body.ui-v2 #sidebar .stat-row:last-child {
  margin-bottom: 0;
}

body.ui-v2 #sidebar .stat-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

body.ui-v2 #sidebar .stat-title {
  display: flex;
  gap: 8px;
  align-items: center;
}

body.ui-v2 #sidebar .stat-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body.ui-v2 #sidebar .stat-badge {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  color: var(--fg);
  background: color-mix(in srgb, var(--panel) 60%, transparent);
}

body.ui-v2 #sidebar .stat-name {
  color: var(--fg);
  font-size: 13px;
}

body.ui-v2 #sidebar .stat-desc {
  font-size: 11px;
  color: color-mix(in srgb, var(--muted) 80%, transparent);
}

body.ui-v2 #sidebar .stat-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

body.ui-v2 #sidebar .stat-delta {
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.ui-v2 #sidebar .stat-delta.positive {
  color: rgba(79, 255, 201, 0.9);
  border-color: rgba(79, 255, 201, 0.5);
  background: color-mix(in srgb, rgba(79, 255, 201, 0.2) 70%, transparent);
}

body.ui-v2 #sidebar .stat-delta.negative {
  color: rgba(255, 112, 112, 0.9);
  border-color: rgba(255, 112, 112, 0.5);
  background: color-mix(in srgb, rgba(255, 112, 112, 0.2) 70%, transparent);
}

body.ui-v2 #sidebar .stat-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.ui-v2 #sidebar .stat-bar {
  height: 12px;
  flex: 1;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
}

body.ui-v2 #sidebar .stat-fill {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--stat-accent), var(--stat-accent-2));
  box-shadow: 0 0 16px rgba(53, 227, 255, 0.18);
}

body.ui-v2 #sidebar .stat-fill::after {
  content: none;
}

body.ui-v2 #sidebar .stat-end {
  min-width: 46px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

body.ui-v2 #sidebar .stat-row[data-stat="brains"] {
  --stat-accent: rgba(53, 227, 255, 0.7);
  --stat-accent-2: rgba(79, 255, 201, 0.7);
}

body.ui-v2 #sidebar .stat-row[data-stat="banter"] {
  --stat-accent: rgba(255, 200, 87, 0.7);
  --stat-accent-2: rgba(255, 145, 92, 0.7);
}

body.ui-v2 #sidebar .stat-row[data-stat="bravery"] {
  --stat-accent: rgba(255, 112, 112, 0.7);
  --stat-accent-2: rgba(255, 77, 141, 0.7);
}

body.ui-v2 #sidebar .stat-row[data-stat="bizarre"] {
  --stat-accent: rgba(179, 140, 255, 0.7);
  --stat-accent-2: rgba(93, 160, 255, 0.7);
}

body.ui-v2 #sidebar .stats-summary {
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: color-mix(in srgb, var(--bg) 26%, transparent);
  font-size: 11px;
  color: var(--muted);
}

body.ui-v2 #sidebar .stats-summary strong {
  color: var(--fg);
  font-weight: 600;
}

body.ui-v2 #sidebar .stats-summary-scale {
  font-variant-numeric: tabular-nums;
}

body.ui-v2 #sidebar .stats-summary-label {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 10px;
}

body.ui-v2 #sidebar #vitals {
  font-variant-numeric: tabular-nums;
  display: grid;
  gap: 6px;
}

body.ui-v2 #sidebar .vitals-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.ui-v2 #sidebar .vitals-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  margin-bottom: 6px;
}

body.ui-v2 #sidebar .vitals-bar.warning .vitals-bar-fill {
  background: linear-gradient(90deg, rgba(255, 200, 87, 0.85), rgba(255, 145, 92, 0.85));
  box-shadow: 0 0 12px rgba(255, 200, 87, 0.25);
}

body.ui-v2 #sidebar .vitals-bar.danger .vitals-bar-fill {
  background: linear-gradient(90deg, rgba(255, 77, 141, 0.9), rgba(255, 112, 112, 0.9));
  box-shadow: 0 0 12px rgba(255, 77, 141, 0.25);
}

body.ui-v2 #sidebar .vitals-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 112, 112, 0.8), rgba(255, 145, 92, 0.8));
  box-shadow: 0 0 12px rgba(255, 112, 112, 0.25);
}

body.ui-v2 #sidebar .vitals-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}

body.ui-v2 #sidebar .vital-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  background: color-mix(in srgb, var(--bg) 28%, transparent);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body.ui-v2 #sidebar .vital-chip strong {
  color: var(--fg);
  font-weight: 600;
  letter-spacing: 0.02em;
}

body.ui-v2 #sidebar .vital-label {
  font-size: 10px;
}

body.ui-v2 #sidebar .vitals-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

body.ui-v2 #sidebar .status-chip {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.ui-v2 #sidebar .status-chip.muted {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}

body.ui-v2 #sidebar .quest-summary {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

body.ui-v2 #sidebar .quest-card {
  list-style: none;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: color-mix(in srgb, var(--bg) 20%, transparent);
}

body.ui-v2 #sidebar .quest-card.urgent {
  border-color: color-mix(in srgb, var(--accent2) 70%, var(--border));
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent2) 15%, transparent);
}

body.ui-v2 #sidebar .quest-card:last-child {
  margin-bottom: 0;
}

body.ui-v2 #sidebar .quest-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  margin-bottom: 6px;
}

body.ui-v2 #sidebar .quest-title {
  color: var(--fg);
  font-weight: 600;
}

body.ui-v2 #sidebar .quest-count {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

body.ui-v2 #sidebar .quest-next {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--fg);
  line-height: 1.4;
}

body.ui-v2 #sidebar .quest-chip {
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 60%, transparent);
}

body.ui-v2 #sidebar .quest-optional {
  font-size: 11px;
  color: color-mix(in srgb, var(--muted) 80%, transparent);
  margin-top: 6px;
}

body.ui-v2 #sidebar .quest-alert {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent2) 60%, var(--border));
  background: color-mix(in srgb, var(--panel) 75%, transparent);
  font-size: 11px;
  color: color-mix(in srgb, var(--fg) 80%, var(--muted));
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.ui-v2 .quest-card {
  list-style: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  background: color-mix(in srgb, var(--bg) 20%, transparent);
}

body.ui-v2 .quest-card.urgent {
  border-color: color-mix(in srgb, var(--accent2) 70%, var(--border));
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent2) 15%, transparent);
}

body.ui-v2 .quest-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  margin-bottom: 6px;
}

body.ui-v2 .quest-title {
  color: var(--fg);
  font-weight: 600;
}

body.ui-v2 .quest-count {
  color: var(--muted);
  font-size: 11px;
}

body.ui-v2 .quest-next {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--fg);
  line-height: 1.4;
}

body.ui-v2 .quest-chip {
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 60%, transparent);
}

body.ui-v2 .quest-optional {
  font-size: 11px;
  color: color-mix(in srgb, var(--muted) 80%, transparent);
  margin-top: 6px;
}

body.ui-v2 .quest-alert {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent2) 60%, var(--border));
  background: color-mix(in srgb, var(--panel) 75%, transparent);
  font-size: 11px;
  color: color-mix(in srgb, var(--fg) 80%, var(--muted));
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.ui-v2 .quest-journal .quest-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

body.ui-v2 .quest-journal .quest-card {
  margin-bottom: 12px;
}

body.ui-v2 .quest-journal .quest-card:last-child {
  margin-bottom: 0;
}

body.ui-v2 #sidebar .now-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

body.ui-v2 #sidebar .now-progress-chip,
body.ui-v2 #sidebar .progress-signal-chip {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.ui-v2 #sidebar .now-progress-chip,
body.ui-v2 #sidebar .progress-signal-chip {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 11px;
}

body.ui-v2 #sidebar .now-progress-chip.muted {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}

body.ui-v2 #sidebar .progress-signal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

body.ui-v2 #sidebar .tension-meter {
  padding: 9px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 30%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

body.ui-v2 #sidebar .pace-meter {
  padding: 9px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 30%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

body.ui-v2 #sidebar .tension-labels {
  font-size: 11px;
}

body.ui-v2 #sidebar .pace-labels {
  font-size: 11px;
}

body.ui-v2 #sidebar .tension-tag {
  padding: 5px 9px;
  font-size: 11px;
  border-color: color-mix(in srgb, var(--border) 65%, transparent);
  background: color-mix(in srgb, var(--bg) 30%, transparent);
}

body.ui-v2 #sidebar ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.ui-v2 #sidebar ul li {
  padding: 6px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  font-size: 13px;
  color: var(--fg);
}

body.ui-v2 #sidebar ul li:last-child {
  border-bottom: 0;
}

body.ui-v2 #sidebar #quests {
  gap: 6px;
}

body.ui-v2 #sidebar #quests li.quest-card,
body.ui-v2 #sidebar #quests li.quest-summary {
  border-bottom: 0;
}

body.ui-v2 #sidebar #quests li.quest-summary {
  padding: 0;
}

body.ui-v2 #sidebar #endingsSummary {
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}

body.ui-v2 #sidebar::-webkit-scrollbar {
  width: 6px;
}

body.ui-v2 #sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 80%, transparent);
}

/* Scene chrome becomes a HUD */
body.ui-v2 .scene-chrome {
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.28);
}

body.ui-v2 .scene-title {
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

body.ui-v2 .scene-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
}

body.ui-v2 .hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--bg) 35%, transparent);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

body.ui-v2 .hud-chip strong {
  font-weight: 600;
  color: var(--fg);
}

body.ui-v2 .hud-chip.badge {
  border-color: color-mix(in srgb, var(--accent2) 55%, var(--border));
  background: color-mix(in srgb, rgba(53, 227, 255, 0.15) 70%, transparent);
}

/* Narrative */
body.ui-v2 #sceneText {
  max-width: var(--narrative-max-width);
  margin: var(--space-2) auto 0;
  /* Reduced from space-4 to fix gap */
  padding: clamp(var(--space-3), 2vw, var(--space-5));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
}

html[data-theme="light"] body.ui-v2 #sceneText {
  background: rgba(255, 255, 255, 0.55);
}

body.ui-v2 #sceneText .scene-body {
  font-family: var(--font-narrative);
  font-size: clamp(1.05rem, 1vw + 0.7rem, 1.26rem);
  line-height: 1.72;
  letter-spacing: 0.01em;
}

body.ui-v2 #sceneText .scene-body p {
  margin: 0 0 var(--space-3);
}

body.ui-v2 #sceneText .scene-narration {
  margin: 0 0 var(--space-3);
}

body.ui-v2 #sceneText .scene-dialogue {
  margin: 0 0 var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--color-accent) 28%, transparent);
  border-left: 4px solid color-mix(in srgb, var(--color-accent) 70%, transparent);
  background: color-mix(in srgb, var(--color-bg) 55%, transparent);
}

body.ui-v2 #sceneText .scene-dialogue-speaker {
  display: block;
  margin-bottom: var(--space-1);
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-accent) 85%, white);
}

body.ui-v2 #sceneText .scene-dialogue-line {
  margin: 0;
}

/* Choice tools */
body.ui-v2 .choice-tools {
  max-width: var(--narrative-max-width);
  margin: var(--space-4) auto 0;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
}

html[data-theme="light"] body.ui-v2 .choice-tools {
  background: rgba(255, 255, 255, 0.55);
}

body.ui-v2 #choiceFilter {
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
  background: color-mix(in srgb, var(--color-bg) 20%, transparent);
  padding: var(--space-3);
}

body.ui-v2 #choiceFilter::placeholder {
  color: color-mix(in srgb, var(--color-text-muted) 90%, transparent);
}

/* Suggestions */
body.ui-v2 .suggestions {
  max-width: 78ch;
  margin: 12px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 0;
}

body.ui-v2 .suggestions:empty {
  display: none;
}

body.ui-v2 .suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
  color: var(--fg);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

html[data-theme="light"] body.ui-v2 .suggestion-chip {
  background: rgba(255, 255, 255, 0.55);
}

body.ui-v2 .suggestion-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 1px rgba(179, 140, 255, 0.2), 0 10px 30px rgba(0, 0, 0, 0.25);
}

body.ui-v2 .suggestion-chip .k {
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: color-mix(in srgb, var(--bg) 30%, transparent);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

/* Mall mood / tension panel */
body.ui-v2 .tension-meter {
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--bg) 35%, transparent);
  padding: 10px 12px;
}

body.ui-v2 .pace-meter {
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--bg) 35%, transparent);
  padding: 10px 12px;
}

body.ui-v2 .tension-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

body.ui-v2 .pace-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

body.ui-v2 .tension-bar>.fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(53, 227, 255, 0.75), rgba(179, 140, 255, 0.75), rgba(255, 77, 141, 0.85));
  transition: width 240ms ease;
}

body.ui-v2 .pace-bar>.fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.8), rgba(56, 189, 248, 0.8), rgba(250, 204, 21, 0.85));
  transition: width 240ms ease;
}

body.ui-v2 .tension-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

body.ui-v2 .pace-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

body.ui-v2 .tension-events {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

body.ui-v2 .tension-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  font-size: 12px;
  color: var(--fg);
}

/* Choices as action cards */
body.ui-v2 #choices {
  max-width: var(--narrative-max-width);
  margin: var(--space-4) auto var(--space-3);
  display: grid;
  gap: var(--space-3);
  align-content: start;
}

body.ui-v2 #choices button {
  margin: 0;
  padding: var(--space-4);
  min-height: 56px;
  width: 100%;
  /* Improved touch target */
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--color-accent) 40%, var(--color-border));
  /* More visible border */
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--color-surface) 50%, transparent),
      color-mix(in srgb, var(--color-bg) 30%, transparent));
  /* More visible background */
  color: var(--color-text);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  /* Added inset highlight */
  transform: translateZ(0);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: all var(--transition-normal);
  cursor: pointer;
}

body.ui-v2 #choices button:hover {
  border-color: var(--color-accent);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--color-accent) 15%, var(--color-surface)),
      color-mix(in srgb, var(--color-accent) 8%, var(--color-bg)));
  box-shadow:
    0 14px 44px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(179, 140, 255, 0.4),
    0 0 42px rgba(179, 140, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

body.ui-v2 #choices button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent2) 80%, transparent);
  outline-offset: 2px;
}

body.ui-v2 #choices button .index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  margin-right: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: color-mix(in srgb, var(--bg) 40%, transparent);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

body.ui-v2 #choices button .choice-text {
  flex: 1;
  line-height: 1.45;
}

body.ui-v2 #choices button .choice-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

body.ui-v2 #choices button .choice-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  font-size: 11px;
  color: var(--fg);
  white-space: nowrap;
}

/* Buttons/inputs baseline to match the new game look */
body.ui-v2 button {
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  color: var(--fg);
}

body.ui-v2 .primary-btn,
body.ui-v2 #newGame,
body.ui-v2 #continueGame {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 85%, #000), color-mix(in srgb, var(--accent2) 45%, var(--accent)));
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 12px 36px rgba(179, 140, 255, 0.22);
}

body.ui-v2 .secondary-btn {
  background: color-mix(in srgb, var(--panel) 80%, transparent);
}

body.ui-v2 input,
body.ui-v2 select {
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  background: color-mix(in srgb, var(--bg) 16%, transparent);
  color: var(--fg);
}

/* Title screen overlay (v2) */
body.ui-v2 #titleScreen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(70% 60% at 30% 20%, rgba(179, 140, 255, 0.20), transparent 60%),
    radial-gradient(55% 45% at 80% 30%, rgba(53, 227, 255, 0.14), transparent 55%),
    linear-gradient(180deg, rgba(7, 6, 11, 0.65), rgba(7, 6, 11, 0.92));
  backdrop-filter: blur(16px);
}

html[data-theme="light"] body.ui-v2 #titleScreen {
  background:
    radial-gradient(70% 60% at 30% 20%, rgba(111, 66, 193, 0.12), transparent 60%),
    radial-gradient(55% 45% at 80% 30%, rgba(14, 165, 233, 0.10), transparent 55%),
    linear-gradient(180deg, rgba(247, 247, 255, 0.65), rgba(247, 247, 255, 0.92));
}

/* Ensure existing modals stack above title screen */
body.ui-v2 #modal {
  z-index: 220;
}

body.ui-v2 #cutsceneModal {
  z-index: 230;
}

body.ui-v2 #titleScreen.hidden {
  display: none !important;
}

/* Command palette */
body.ui-v2 #commandPalette {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: grid;
  place-items: start center;
  padding: 90px 18px 18px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
}

body.ui-v2 #commandPalette.hidden {
  display: none !important;
}

body.ui-v2 .palette-card {
  width: min(860px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  box-shadow: 0 26px 120px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

body.ui-v2 .palette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

body.ui-v2 .palette-title {
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}

body.ui-v2 .palette-close {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
}

body.ui-v2 #paletteInput {
  width: 100%;
  padding: 14px 14px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.12);
  color: var(--fg);
  outline: none;
}

body.ui-v2 #paletteInput::placeholder {
  color: color-mix(in srgb, var(--muted) 90%, transparent);
}

body.ui-v2 .palette-list {
  max-height: min(56vh, 520px);
  overflow: auto;
}

body.ui-v2 .palette-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

body.ui-v2 .palette-item:hover,
body.ui-v2 .palette-item[aria-selected="true"] {
  background: rgba(179, 140, 255, 0.12);
}

body.ui-v2 .palette-item .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

body.ui-v2 .palette-item .label {
  font-weight: 600;
}

body.ui-v2 .palette-item .sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

body.ui-v2 .palette-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 1200px) {
  body.ui-v2 main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "content"
      "sidebar";
  }

  body.ui-v2 #sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 900px) {
  body.ui-v2 #commandPalette {
    padding-top: 70px;
  }
}

body.ui-v2 .title-card {
  width: min(920px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  box-shadow: 0 26px 120px rgba(0, 0, 0, 0.55);
  padding: 20px;
  overflow: hidden;
  position: relative;
}

body.ui-v2 .title-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 24px;
  background:
    radial-gradient(120% 80% at 10% 0%, rgba(179, 140, 255, 0.24), transparent 62%),
    radial-gradient(100% 70% at 95% 30%, rgba(53, 227, 255, 0.16), transparent 55%);
  filter: blur(18px);
  opacity: 0.8;
  pointer-events: none;
}

body.ui-v2 .title-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: start;
}

body.ui-v2 .title-brand {
  padding: 6px 6px 14px;
}

body.ui-v2 .title-brand h2 {
  margin: 0;
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  font-size: 34px;
  letter-spacing: 0.06em;
}

body.ui-v2 .title-brand p {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 52ch;
  line-height: 1.55;
}

body.ui-v2 .title-brand .title-badges {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.ui-v2 .title-badge {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.20);
  color: var(--muted);
  font-size: 12px;
}

body.ui-v2 .title-actions {
  padding: 6px;
  display: grid;
  gap: 10px;
}

body.ui-v2 .title-actions button {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

body.ui-v2 .title-actions button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

body.ui-v2 .title-actions button:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.ui-v2 .title-actions button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

body.ui-v2 .title-actions button.primary {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 85%, #000), color-mix(in srgb, var(--accent2) 45%, var(--accent)));
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: 0 4px 14px rgba(179, 140, 255, 0.3);
}

body.ui-v2 .title-actions button.primary:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(179, 140, 255, 0.45);
}

body.ui-v2 .title-actions button.ghost {
  background: rgba(0, 0, 0, 0.18);
}

body.ui-v2 .title-actions button.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}

body.ui-v2 .title-footer {
  position: relative;
  margin-top: 14px;
  padding: 12px 6px 2px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Mobile v2 */
@media (max-width: 900px) {
  body.ui-v2 main {
    grid-template-columns: 1fr;
    grid-template-areas:
      "content"
      "sidebar";
    padding: var(--space-4);
    gap: var(--space-4);
  }

  body.ui-v2 #sidebar {
    position: static;
    max-height: none;
  }

  body.ui-v2 .title-inner {
    grid-template-columns: 1fr;
  }

  body.ui-v2 #sceneText,
  body.ui-v2 #choices,
  body.ui-v2 .choice-tools,
  body.ui-v2 .suggestions {
    max-width: 100%;
  }

  body.ui-v2 #sceneText {
    margin-top: var(--space-1);
    padding: var(--space-3);
  }

  body.ui-v2 #choices button {
    min-height: 56px;
    /* Maintain touch target on mobile */
    padding: var(--space-4) var(--space-3);
    align-items: flex-start;
  }

  body.ui-v2 #choices button .choice-badges {
    margin-left: 0;
    width: 100%;
  }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Skip to content link */
body.ui-v2 .skip-to-content {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: var(--space-3) var(--space-5);
  background: var(--color-accent);
  color: #fff;
  font-weight: var(--font-semibold);
  text-decoration: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-lg);
  transition: top var(--transition-fast);
}

body.ui-v2 .skip-to-content:focus {
  top: 0;
  outline: none;
}

/* Consistent focus-visible styles */
body.ui-v2 *:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

body.ui-v2 button:focus-visible,
body.ui-v2 a:focus-visible,
body.ui-v2 input:focus-visible,
body.ui-v2 select:focus-visible,
body.ui-v2 [role="button"]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  box-shadow: var(--shadow-glow);
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {

  body.ui-v2 *,
  body.ui-v2 *::before,
  body.ui-v2 *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
