/* =========================================================
   cupc.io — Aero Studio 2030 Design System
   Self-hosted typography (SIL OFL 1.1), porcelain architectural
   surfaces, aerospace cobalt launch CTA, zero-clip responsive UI.
   ========================================================= */

@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/space-grotesk-latin.woff2') format('woff2');
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #11151d;
  --ink-soft: #434e63;
  --ink-muted: #5a667c;
  --porcelain: rgba(250, 251, 253, 0.96);
  --surface: #ffffff;
  --surface-sub: #f1f5f9;
  --surface-hover: #e9eff7;
  --hud-bg: rgba(255, 255, 255, 0.91);
  --hud-bg-strong: rgba(255, 255, 255, 0.96);
  --hud-ink: #11151d;
  --hud-ink-soft: #455167;
  --hud-border: rgba(17, 21, 29, 0.13);
  --border-ink: rgba(17, 21, 29, 0.11);
  --border-strong: rgba(17, 21, 29, 0.22);
  --cobalt: #1858ff;
  --cobalt-deep: #1143cc;
  --cobalt-soft: rgba(24, 88, 255, 0.10);
  --sky-gust: #0284c7;
  --gold: #d97706;
  --gold-bright: #eab308;
  --gold-bg: #fef9c3;
  --gold-ink: #854d0e;
  --vermilion: #dc2626;
  --vermilion-deep: #b91c1c;
  --emerald: #0d9460;
  --shadow-card: 0 24px 56px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-hud: 0 6px 18px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(15, 23, 42, 0.08);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --font-display: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease-studio: cubic-bezier(0.22, 1, 0.36, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #56725d;
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.is-hidden {
  display: none !important;
}

#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

/* =========================================================
   Buttons, Focus, Icons & Spatial Continuity Motion
   ========================================================= */

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

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2.5px solid var(--cobalt);
  outline-offset: 2px;
}

.icon-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

.inline-icon {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 4px;
  display: inline-block;
}

.inline-icon-sm {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  display: block;
}

.icon-sound-off {
  display: none;
}

[data-muted="true"] .icon-sound-on {
  display: none;
}

[data-muted="true"] .icon-sound-off {
  display: block;
}

.studio-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

/* Aerospace Cobalt Primary Launch CTA (never danger-red!) */
.btn-primary {
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid rgba(17, 67, 204, 0.9);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #2764ff 0%, #164ce6 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(24, 88, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.26);
  transition: transform 0.14s var(--ease-studio), box-shadow 0.16s var(--ease-studio), filter 0.16s ease;
}

.btn-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(24, 88, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(24, 88, 255, 0.24);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: default;
  transform: none;
}

.btn-primary.is-quiet {
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 8px 20px rgba(17, 21, 29, 0.18);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}

.btn-secondary:hover {
  background: var(--surface-sub);
  border-color: rgba(17, 21, 29, 0.32);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--border-ink);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 600;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.btn-ghost:hover {
  background: var(--surface-sub);
  border-color: var(--border-strong);
}

.btn-icon-pill {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-minor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--border-ink);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.btn-minor:hover:not(:disabled) {
  background: var(--surface-sub);
  border-color: var(--border-strong);
}

.btn-minor:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-minor.is-equipped-btn {
  background: var(--cobalt-soft);
  border-color: rgba(24, 88, 255, 0.35);
  color: var(--cobalt);
  opacity: 1;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hud-border);
  background: var(--hud-bg-strong);
  color: var(--hud-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-hud);
  transition: transform 0.12s ease, background 0.14s ease, border-color 0.14s ease;
}

.icon-btn:hover {
  background: var(--hud-bg-strong);
  border-color: var(--border-strong);
}

.modal-x-btn {
  box-shadow: none;
  background: var(--surface-sub);
  color: var(--ink);
  border-color: var(--border-ink);
}

/* Subtle shimmering highlight reserved for Workshop "Surprise me" */
.btn-shimmer {
  position: relative;
  overflow: hidden;
  border-color: rgba(24, 88, 255, 0.28);
  background: linear-gradient(135deg, #ffffff 0%, #f1f6ff 100%);
  color: var(--cobalt-deep);
}

.btn-shimmer::after {
  content: '';
  position: absolute;
  inset: -40% -80%;
  background: linear-gradient(110deg, transparent 40%, rgba(24, 88, 255, 0.14) 50%, transparent 60%);
  transform: translateX(-60%);
  animation: studioShimmer 4.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes studioShimmer {
  0%, 72%, 100% { transform: translateX(-65%); }
  88% { transform: translateX(65%); }
}

@keyframes studioModalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes studioRailIn {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* =========================================================
   Overlays & Porcelain Studio Surfaces
   ========================================================= */

.overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(14px, var(--sat)) max(14px, var(--sar)) max(14px, var(--sab)) max(14px, var(--sal));
  background: rgba(15, 23, 42, 0.32);
}

/* Start screen: minimal veil so live rooftop duel stays vivid & unobstructed */
.overlay-title {
  background: radial-gradient(circle at 22% 50%, rgba(15, 23, 42, 0.18) 0%, rgba(15, 23, 42, 0.04) 55%, transparent 100%);
}

.parchment-card {
  width: 100%;
  background: var(--porcelain);
  border: 1px solid rgba(17, 21, 29, 0.14);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  animation: studioModalIn 0.22s var(--ease-studio) both;
}

/* =========================================================
   Start Screen — Left-Docked Desktop Studio Rail
   ========================================================= */

.title-card {
  max-width: 416px;
  max-height: calc(100dvh - 28px - var(--sat) - var(--sab));
  overflow-y: auto;
  padding: 20px 20px 18px;
}

@media (min-width: 960px) {
  .overlay-title {
    justify-content: flex-start;
    align-items: center;
    padding: 24px 28px;
  }

  .title-card {
    width: 404px;
    max-width: 404px;
    padding: 22px 22px 20px;
    animation: studioRailIn 0.26s var(--ease-studio) both;
  }
}

.title-header {
  margin-bottom: 14px;
}

.title-brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.title-emblem {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.title-emblem svg {
  width: 100%;
  height: 100%;
}

.title-heading-group {
  flex: 1;
  min-width: 0;
}

.title-heading-group h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.52rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.title-subtitle {
  margin: 3px 0 0;
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.25;
}

.title-conn-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.conn-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.conn-live {
  background: #ecfdf5;
  color: #047857;
  border-color: rgba(4, 120, 87, 0.22);
}

.conn-private {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: rgba(29, 78, 216, 0.22);
}

.conn-connecting {
  background: #fffbeb;
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.22);
}

.conn-offline {
  background: var(--surface-sub);
  color: var(--ink-soft);
  border-color: var(--border-ink);
}

.btn-retry {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cobalt);
}

/* Private Sky Banner */
.private-sky-banner {
  margin-bottom: 12px;
  padding: 12px 13px;
  border-radius: var(--radius-md);
  background: #eff6ff;
  border: 1px solid rgba(24, 88, 255, 0.24);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.private-sky-banner.is-expired {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, 0.26);
}

.private-sky-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.private-sky-copy strong {
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--ink);
}

.private-sky-detail {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.private-sky-url {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-ink);
  border-radius: 8px;
  padding: 6px 8px;
  word-break: break-all;
}

.link-quiet {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sky-toast {
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Name input */
.name-field-wrap {
  margin-bottom: 12px;
}

.name-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.name-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.name-input::placeholder {
  color: #6b778d;
  font-weight: 500;
}

.name-input:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(24, 88, 255, 0.14);
  outline: none;
}

.name-dice {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.14s ease, transform 0.14s ease;
}

.name-dice:hover {
  background: var(--surface-sub);
  transform: rotate(10deg);
}

.field-error {
  min-height: 0;
  margin-top: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--vermilion);
}

.field-error:empty {
  display: none;
}

/* Your Kite Studio Card — ZERO TEXT CLIPPING! */
.kit-row {
  width: 100%;
  margin-bottom: 12px;
  padding: 9px 12px 9px 9px;
  border: 1px solid var(--border-ink);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.kit-row:hover {
  border-color: rgba(24, 88, 255, 0.42);
  background: #fafcff;
}

.kit-row-art {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 11px;
  background: linear-gradient(145deg, #dce8de 0%, #c8d9cd 100%);
  border: 1px solid rgba(17, 21, 29, 0.10);
  overflow: hidden;
  display: flex;
}

.kit-row-art canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.kit-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kit-row-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.kit-row-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.24;
  white-space: normal;
  word-break: break-word;
}

.kit-row-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.28;
}

.kit-row-flag {
  display: inline-flex;
  align-items: center;
}

.kit-row-flag:empty {
  display: none;
}

.kit-row-flag .flag-img {
  width: 18px;
  height: 13.5px;
  border-radius: 2px;
  object-fit: cover;
  border: 1px solid rgba(17, 21, 29, 0.18);
  display: block;
}

.kit-row-go {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding: 5px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-sub);
  color: var(--cobalt);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
}

.kit-row-go .icon-svg {
  width: 14px;
  height: 14px;
}

/* Kite Class Cards */
.kite-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.kite-card {
  padding: 10px 8px 9px;
  border: 1.5px solid var(--border-ink);
  border-radius: var(--radius-md);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.kite-card:hover {
  border-color: var(--border-strong);
  background: #fbfcfe;
}

.kite-card.is-selected {
  border-color: var(--cobalt);
  background: #f4f8ff;
  box-shadow: 0 0 0 2px rgba(24, 88, 255, 0.14);
}

.kite-icon-box {
  width: 38px;
  height: 38px;
}

.kite-icon-box svg {
  width: 100%;
  height: 100%;
}

.kite-name {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
}

.kite-tagline {
  font-size: 0.69rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: 1px;
}

.kite-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.stat-row > span:first-child {
  width: 34px;
  text-align: left;
  flex-shrink: 0;
}

.stat-track {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
  display: block;
}

.stat-track i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--ink);
}

.kite-card.is-selected .stat-track i {
  background: var(--cobalt);
}

.privacy-note {
  margin: 10px 0 12px;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--ink-soft);
  text-align: center;
}

.privacy-link {
  color: var(--cobalt);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.title-social-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Private-sky rule switches get their own full-width line under Invite. */
.sky-rule-row {
  order: 3;
  flex: 1 1 100%;
  display: flex;
  gap: 8px;
}

.sky-rule-row:not(:has(> .sky-rule-opt:not(.is-hidden))) {
  display: none;
}

.sky-rule-row .sky-rule-opt {
  flex: 1 1 0;
  min-width: 0;
}

.btn-invite {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  padding: 8px 11px;
}

.title-util-icons {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* =========================================================
   Kite Workshop Studio (inspora.design-inspired)
   ========================================================= */

.workshop-card {
  max-width: 1060px;
  height: min(760px, calc(100dvh - 28px - var(--sat) - var(--sab)));
  padding: 16px 20px 14px;
  display: flex;
  flex-direction: column;
}

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

.ws-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.ws-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-compare-toggle.is-selected {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.ws-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: 18px;
}

.ws-stage-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.ws-stage {
  position: relative;
  flex: 1;
  min-height: 240px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(17, 21, 29, 0.16);
  background: #56725d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.ws-preview {
  width: 100%;
  height: 100%;
  display: block;
}

/* Interactive Before / After Comparison Handle */
.ws-compare-rail {
  position: absolute;
  inset: 0 0 54px 0;
  cursor: ew-resize;
  touch-action: none;
  z-index: 4;
}

.ws-compare-tag {
  position: absolute;
  top: 12px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: rgba(17, 21, 29, 0.80);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.ws-compare-tag.tag-before { left: 12px; }
.ws-compare-tag.tag-after { right: 12px; background: rgba(24, 88, 255, 0.88); }

.ws-compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 0 1px rgba(17, 21, 29, 0.35), 0 0 14px rgba(17, 21, 29, 0.45);
  pointer-events: none;
}

.ws-compare-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--ink);
  border: 1.5px solid rgba(17, 21, 29, 0.24);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 700;
}

.ws-stage-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.ws-seg {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 21, 29, 0.14);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(10px);
}

.ws-seg button {
  min-height: 29px;
  padding: 4px 11px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  transition: background 0.14s ease, color 0.14s ease;
}

.ws-seg button.is-selected {
  background: var(--ink);
  color: #ffffff;
}

/* Fine-Tick Ruler Dial (Workshop Wind Tunnel & Settings Audio) */
.ws-wind-dial {
  padding: 11px 13px 10px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-ink);
}

.dial-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.dial-value {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--cobalt-deep);
}

.dial-track-wrap {
  position: relative;
  padding-bottom: 9px;
}

.dial-ticks {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 7px;
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(17, 21, 29, 0.24) 0px,
      rgba(17, 21, 29, 0.24) 1px,
      transparent 1px,
      transparent 10px
    );
  pointer-events: none;
}

.studio-dial {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #dbe3ee;
  outline: none;
  cursor: pointer;
}

.studio-dial::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.30);
  transition: transform 0.12s ease, background 0.12s ease;
}

.studio-dial::-webkit-slider-thumb:hover {
  background: var(--cobalt);
  transform: scale(1.08);
}

.studio-dial::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.30);
}

/* Workshop Right Controls Column */
.ws-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.ws-flag-btn {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-ink);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ws-flag-btn:hover {
  border-color: var(--cobalt);
  background: #f8fbff;
}

.ws-flag-chip,
.flag-row-chip {
  width: 44px;
  height: 33px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(17, 21, 29, 0.16);
  background: var(--surface-sub);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flag-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.flag-none {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    #e2e8f0 0 6px,
    #f8fafc 6px 12px
  );
  display: block;
}

.ws-flag-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ws-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
}

.ws-flag-name {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
}

.ws-flag-sub {
  font-size: 0.74rem;
  color: var(--ink-soft);
}

.ws-flag-hint {
  margin: -2px 2px 0;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  border: 1px solid rgba(24, 88, 255, 0.20);
  font-size: 0.74rem;
  line-height: 1.35;
  color: #1e40af;
}

.ws-panel-card {
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-ink);
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  max-width: 100%;
}

.ws-group {
  min-width: 0;
  max-width: 100%;
}

.ws-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.ws-value {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

.swatches {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 6px;
}

.swatch {
  aspect-ratio: 1;
  border-radius: 999px;
  border: 2px solid rgba(17, 21, 29, 0.14);
  background: var(--swatch);
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.swatch:hover {
  transform: scale(1.1);
}

.swatch.is-light {
  border-color: rgba(17, 21, 29, 0.28);
}

.swatch.is-selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 2.5px var(--cobalt);
  transform: scale(1.08);
}

/* Horizontal Visual Pattern & Tail Cards (preview above, details below) */
.kit-tiles {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
}

.kit-tile {
  position: relative;
  flex: 0 0 96px;
  scroll-snap-align: start;
  padding: 8px 6px 7px;
  border: 1.5px solid var(--border-ink);
  border-radius: var(--radius-md);
  background: #fafbfd;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.kit-tile-wide {
  flex: 0 0 110px;
}

.kit-tile:hover {
  border-color: var(--border-strong);
  background: #ffffff;
}

.kit-tile.is-selected {
  border-color: var(--cobalt);
  background: #f2f7ff;
  box-shadow: 0 0 0 2px rgba(24, 88, 255, 0.13);
}

.kit-tile.is-locked {
  opacity: 0.72;
  background: var(--surface-sub);
}

.kit-tile-art {
  width: 100%;
  height: 40px;
  display: block;
}

.kit-tile-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
}

.kit-tile-name {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
}

.kit-tile-sub {
  font-size: 0.64rem;
  color: var(--ink-soft);
  line-height: 1.2;
}

.kit-tile-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-ink);
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kit-tile.is-earned .kit-tile-badge {
  background: var(--gold-bg);
  color: var(--gold);
  border-color: rgba(217, 119, 6, 0.35);
}

/* Flag Studio Picker */
.ws-flag-panel {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: var(--porcelain);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ws-flag-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-flag-back {
  flex-shrink: 0;
  height: 42px;
}

.ws-flag-search {
  height: 42px;
  font-size: 0.92rem;
}

.ws-region-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.region-pill {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-ink);
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.region-pill.is-selected {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.ws-flag-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  align-content: start;
  gap: 6px;
  padding-right: 4px;
}

.flag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1.5px solid var(--border-ink);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.flag-row:hover {
  border-color: var(--border-strong);
  background: #f8fafd;
}

.flag-row.is-selected {
  border-color: var(--cobalt);
  background: #f1f6ff;
}

.flag-row-chip {
  width: 30px;
  height: 22.5px;
  border-radius: 4px;
}

.flag-row-name {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flag-row-code {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.flag-empty {
  grid-column: 1 / -1;
  padding: 24px 8px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.ws-footer {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-ink);
}

.ws-done {
  min-width: 112px;
  min-height: 46px;
}

.ws-fly {
  flex: 1;
  width: auto;
}

.workshop-card.is-picking-flag .ws-stage-col,
.workshop-card.is-picking-flag .ws-options {
  visibility: hidden;
}

/* =========================================================
   Shared Studio Modals: Settings, Festival & Help
   ========================================================= */

.studio-modal {
  max-width: 780px;
  max-height: calc(100dvh - 24px - var(--sat) - var(--sab));
  padding: 18px 22px 16px;
  display: flex;
  flex-direction: column;
}

.festival-card {
  max-width: 820px;
}

.studio-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-ink);
  margin-bottom: 11px;
}

.studio-modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.studio-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.studio-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--border-ink);
}

.studio-done-btn {
  width: auto;
  min-width: 144px;
  min-height: 42px;
}

.studio-section {
  padding: 11px 14px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-ink);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.studio-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.studio-section-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ink);
}

.studio-badge-mono {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--surface-sub);
  border: 1px solid var(--border-ink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.studio-sub-note {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

/* Settings Segmented Wide Pill */
.studio-seg-wide {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--surface-sub);
  border: 1px solid var(--border-ink);
}

.studio-seg-wide button {
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.studio-seg-wide button strong {
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
}

.studio-seg-wide button span {
  font-size: 0.69rem;
  color: var(--ink-soft);
}

.studio-seg-wide button.is-selected {
  background: var(--surface);
  border-color: rgba(24, 88, 255, 0.35);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.studio-seg-wide button.is-selected strong {
  color: var(--cobalt);
}

/* Settings Audio Dials */
.dial-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.studio-chip-toggle {
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(13, 148, 96, 0.30);
  background: #ecfdf5;
  color: #047857;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.studio-chip-toggle.is-muted {
  border-color: rgba(220, 38, 38, 0.30);
  background: #fef2f2;
  color: var(--vermilion);
}

/* Settings Tactile Radio / Switch Rows with Right-Aligned Values */
.studio-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.studio-row-btn,
.studio-row-static {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-ink);
  background: #fafbfd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.studio-row-btn:hover {
  border-color: var(--border-strong);
  background: #ffffff;
}

.studio-row-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.studio-row-copy strong {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.studio-row-copy span {
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.studio-row-val {
  flex-shrink: 0;
  min-width: 52px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--surface-sub);
  border: 1px solid var(--border-ink);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.studio-row-btn.is-on .studio-row-val {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #ffffff;
}

.studio-seg-inline {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-sub);
  border: 1px solid var(--border-ink);
  flex-shrink: 0;
}

.studio-seg-inline button {
  padding: 4px 10px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.studio-seg-inline button.is-selected {
  background: var(--ink);
  color: #ffffff;
}

.keycap-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.keycap-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: #fafbfd;
  border: 1px solid var(--border-ink);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.77rem;
  color: var(--ink-soft);
}

kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: #ffffff;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.71rem;
  font-weight: 700;
}

/* =========================================================
   Festival & Unlocks Studio (Hero Metrics + Dot-Matrix Bars)
   ========================================================= */

.hero-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.hero-metric-card {
  padding: 14px 14px 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-metric-num {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.8vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.hero-metric-num.is-text-val {
  font-size: clamp(1.1rem, 1.8vw, 1.38rem);
  letter-spacing: -0.01em;
  line-height: 1.25;
  padding-top: 6px;
}

.hero-metric-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.fest-days-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.fest-day-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: #fafbfd;
  border: 1px solid var(--border-ink);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.fest-day-card.is-active {
  border-color: rgba(24, 88, 255, 0.36);
  background: #f5f9ff;
}

.fest-day-card.is-done {
  border-color: rgba(13, 148, 96, 0.36);
  background: #f2fdf8;
}

.fest-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.fest-day-top strong {
  font-family: var(--font-display);
  font-size: 0.84rem;
  color: var(--ink);
}

.fest-day-status {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.fest-day-card.is-done .fest-day-status { color: var(--emerald); }
.fest-day-card.is-active .fest-day-status { color: var(--cobalt); }

.fest-day-goal {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--ink-soft);
  flex: 1;
}

/* Segmented Dot-Matrix Progress Bar */
.dot-matrix {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dot-cell {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #dde4ee;
}

.dot-cell.is-filled {
  background: var(--cobalt);
}

.fest-day-card.is-done .dot-cell.is-filled {
  background: var(--emerald);
}

.fest-unlocks-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.fest-unlock-card {
  padding: 10px 11px;
  border-radius: var(--radius-md);
  background: #fafbfd;
  border: 1px solid var(--border-ink);
  display: flex;
  align-items: center;
  gap: 10px;
}

.fest-unlock-card.is-equipped {
  border-color: var(--cobalt);
  background: #f4f8ff;
}

.fest-unlock-thumb {
  width: 52px;
  height: 46px;
  border-radius: 9px;
  background: linear-gradient(145deg, #dce8de 0%, #c8d9cd 100%);
  border: 1px solid rgba(17, 21, 29, 0.10);
  flex-shrink: 0;
  overflow: hidden;
}

.fest-unlock-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.fest-unlock-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fest-unlock-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fest-unlock-name-row strong {
  font-family: var(--font-display);
  font-size: 0.86rem;
  color: var(--ink);
}

.fest-unlock-kind {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--surface-sub);
  color: var(--ink-muted);
}

.fest-unlock-hint {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

/* =========================================================
   Help Modal Grid
   ========================================================= */

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.help-item {
  padding: 13px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-ink);
}

.help-item-wide {
  grid-column: 1 / -1;
}

.help-item h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--ink);
}

.help-item p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.48;
  color: var(--ink-soft);
}

.guide-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--border-ink);
  font-size: 0.8rem;
  color: var(--ink);
}

.help-privacy-note {
  margin: 0;
  text-align: left;
}

/* =========================================================
   Game Over Debrief Card
   ========================================================= */

.death-card {
  max-width: 472px;
  max-height: calc(100dvh - 28px - var(--sat) - var(--sab));
  overflow-y: auto;
  padding: 20px 22px 16px;
  text-align: center;
}

.death-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.death-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  background: #fef2f2;
  border: 1px solid rgba(220, 38, 38, 0.28);
  color: var(--vermilion-deep);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.death-badge[data-streak] {
  background: var(--gold-bg);
  border-color: rgba(217, 119, 6, 0.40);
  color: var(--gold-ink);
}

.death-killer {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--ink);
}

.death-reason {
  margin: 0 0 14px;
  font-size: 0.83rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* Highlight Clip Preview (no browser playback control bar) */
.clip-preview-wrap {
  position: relative;
  margin: 0 auto 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #0f172a;
}

.clip-preview-wrap.is-square {
  max-width: 280px;
}

.clip-preview-meta {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}

.clip-label-badge,
.clip-duration-badge {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(17, 21, 29, 0.82);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
}

.clip-preview-video {
  width: 100%;
  max-height: 230px;
  display: block;
  object-fit: cover;
  cursor: pointer;
}

.clip-preview-video:not([controls])::-webkit-media-controls,
.clip-preview-video:not([controls])::-webkit-media-controls-enclosure,
.clip-preview-video:not([controls])::-webkit-media-controls-panel,
.clip-preview-video::-webkit-media-controls-start-playback-button {
  display: none !important;
  -webkit-appearance: none;
}

/* Fullscreen button on the recap clip (shown only when a playable clip exists) */
.clip-fs-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 3;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-pill);
  background: rgba(17, 21, 29, 0.84);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.clip-fs-btn .icon-svg {
  width: 18px;
  height: 18px;
}

.clip-fs-btn:hover {
  background: rgba(17, 21, 29, 0.95);
}

.clip-fs-btn:focus-visible,
.clip-fs-close:focus-visible {
  outline: 3px solid #fde047;
  outline-offset: 2px;
}

.clip-fs-btn.is-hidden {
  display: none;
}

/* Player dialog: element-fullscreen target, or the viewport-filling fallback */
.clip-fs-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, var(--sat)) max(8px, var(--sar)) max(8px, var(--sab)) max(8px, var(--sal));
  background: #05070b;
}

.clip-fs-dialog.is-hidden {
  display: none;
}

.clip-fs-dialog:fullscreen {
  width: 100%;
  height: 100%;
}

.clip-fs-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

/* Never crop: original aspect (landscape or square phone footage), letterboxed */
.clip-fs-stage .clip-preview-video {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  cursor: auto;
  background: #05070b;
}

.clip-fs-close {
  position: absolute;
  top: max(12px, var(--sat));
  right: max(12px, var(--sar));
  z-index: 2;
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--radius-pill);
  background: rgba(17, 21, 29, 0.88);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.clip-fs-close .icon-svg {
  width: 18px;
  height: 18px;
}

html.clip-fs-open,
html.clip-fs-open body {
  overflow: hidden;
}

.death-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.death-stat {
  padding: 11px 6px 10px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.death-stat-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.death-stat-val {
  font-family: var(--font-display);
  font-size: 1.24rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.pb-badge {
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--cobalt-soft);
  color: var(--cobalt);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
}

.death-festival-row,
.death-daily-row {
  margin-bottom: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.death-festival-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.death-pb-summary {
  font-family: var(--font-display);
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--ink);
}

.death-unlock-note {
  font-size: 0.74rem;
  color: var(--cobalt-deep);
  font-weight: 600;
}

.death-festival-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.death-daily-row {
  background: #fffbeb;
  border-color: rgba(217, 119, 6, 0.28);
}

.death-daily-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold-ink);
}

.death-main-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-fly-again {
  flex: 1;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.btn-fly-again:hover {
  background: #1e2636;
}

.share-feedback {
  margin-bottom: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  color: #1e40af;
  font-size: 0.78rem;
  font-weight: 600;
}

.death-kite-row {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-sub);
  border: 1px solid var(--border-ink);
  margin-bottom: 11px;
}

.kite-pill {
  padding: 6px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
}

.kite-pill.is-selected {
  background: var(--surface);
  color: var(--cobalt);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.death-minor-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.death-footer {
  margin-top: 10px;
  font-size: 0.74rem;
}

/* =========================================================
   In-Flight HUD (Adaptive Day Ceramic / Night Obsidian)
   ========================================================= */

.hud {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.hud[data-sky="night"] {
  --hud-bg: rgba(15, 21, 34, 0.86);
  --hud-bg-strong: rgba(15, 21, 34, 0.94);
  --hud-ink: #f8fafc;
  --hud-ink-soft: #9fb0c8;
  --hud-border: rgba(248, 250, 252, 0.16);
}

.hud-top-left {
  position: fixed;
  top: max(14px, var(--sat));
  left: max(14px, var(--sal));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  max-width: min(296px, calc(100vw - 180px));
}

.hud-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.mode-pill,
.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: var(--hud-bg-strong);
  border: 1px solid var(--hud-border);
  color: var(--hud-ink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: var(--shadow-hud);
}

.mode-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.mode-private .mode-dot { background: #3b82f6; }
.mode-offline .mode-dot { background: #94a3b8; }

.hud-invite-pill {
  pointer-events: auto;
  color: var(--cobalt);
}

.hud[data-sky="night"] .hud-invite-pill {
  color: #93c5fd;
}

.hud-stats-card {
  width: 242px;
  max-width: 100%;
  padding: 9px 11px;
  border-radius: 14px;
  background: var(--hud-bg-strong);
  border: 1px solid var(--hud-border);
  color: var(--hud-ink);
  box-shadow: var(--shadow-hud);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hud-stats-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.hud-rank-badge {
  font-family: var(--font-display);
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--cobalt);
}

.hud[data-sky="night"] .hud-rank-badge {
  color: #60a5fa;
}

.hud-stats-text {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--hud-ink);
  font-variant-numeric: tabular-nums;
}

.hud-meter-pair {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-dive-wrap {
  flex: 1;
}

.hud-dive-track {
  height: 6px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.28);
  overflow: hidden;
}

.hud-dive-fill {
  height: 100%;
  width: 55%;
  border-radius: 99px;
  background: linear-gradient(90deg, #1858ff 0%, #38bdf8 100%);
  transition: width 0.08s linear;
}

.hud-snap-pill {
  position: relative;
  min-width: 60px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: rgba(148, 163, 184, 0.22);
  border: 1px solid var(--hud-border);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hud-snap-track {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hud-snap-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: rgba(24, 88, 255, 0.22);
  transition: width 0.08s linear;
}

.hud-snap-pill.is-ready {
  border-color: rgba(24, 88, 255, 0.45);
}

.hud-snap-pill.is-ready .hud-snap-fill {
  background: var(--cobalt);
}

.hud-snap-pill.is-active .hud-snap-fill {
  background: #0284c7;
}

.hud-snap-text {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--hud-ink);
}

.hud-snap-pill.is-ready .hud-snap-text,
.hud-snap-pill.is-active .hud-snap-text {
  color: #ffffff;
}

.hud-brace-pill.is-ready {
  border-color: rgba(14, 116, 144, 0.55);
}

.hud-brace-pill.is-ready .hud-snap-fill {
  background: #0e7490;
}

.hud-brace-pill.is-active .hud-snap-fill {
  background: #22d3ee;
}

.hud-brace-pill.is-active .hud-snap-text {
  color: #083344;
}

.hud-snap-pill.is-open {
  border-style: dashed;
  border-color: #64748b;
}

.hud-status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.hud-status-tag {
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow-hud);
}

.tag-gust {
  background: rgba(2, 132, 199, 0.92);
  color: #ffffff;
}

.tag-surge {
  background: linear-gradient(90deg, #eab308 0%, #f59e0b 100%);
  color: #11151d;
}

.hud-festival-goal {
  width: 242px;
  max-width: 100%;
  padding: 8px 11px;
  border-radius: 13px;
  background: var(--hud-bg-strong);
  border: 1px solid var(--hud-border);
  color: var(--hud-ink);
  box-shadow: var(--shadow-hud);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
}

.hud-festival-goal.is-cup {
  border-color: rgba(234, 179, 8, 0.65);
}

.hud-festival-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-festival-badge {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--ink);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
}

.hud[data-sky="night"] .hud-festival-badge {
  background: #eab308;
  color: #11151d;
}

.hud-festival-goal-text {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--hud-ink);
}

.hud-festival-detail {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--hud-ink-soft);
}

.hud-festival-track {
  height: 4px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.28);
  overflow: hidden;
  margin-top: 2px;
}

.hud-festival-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--cobalt);
  transition: width 0.2s ease;
}

.hud-festival-goal.is-cup .hud-festival-fill {
  background: #eab308;
}

/* Line Fray Danger Bar (Vermilion strictly for danger!) */
.hud-fray-bar {
  width: 242px;
  max-width: 100%;
  padding: 8px 11px;
  border-radius: 13px;
  background: rgba(254, 242, 242, 0.95);
  border: 1.5px solid rgba(220, 38, 38, 0.55);
  color: #991b1b;
  box-shadow: var(--shadow-hud);
}

.hud-fray-bar.is-rookie {
  background: rgba(240, 249, 255, 0.95);
  border-color: rgba(2, 132, 199, 0.48);
  color: #075985;
}

.hud-fray-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.hud-fray-track {
  position: relative;
  height: 7px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.hud-fray-fill {
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #f97316 0%, #f59e0b 100%);
}

/* Line integrity (fill = what is left). Low integrity adds text and a hatch, not only colour. */
.hud-fray-bar.is-low .hud-fray-fill {
  background: repeating-linear-gradient(135deg, #dc2626 0 6px, #991b1b 6px 9px);
}

.hud-fray-bar.is-low {
  border-width: 2.5px;
  border-color: #dc2626;
}

.hud-fray-trend {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hud-fray-trend:empty { display: none; }

.hud-fray-bar.is-rookie .hud-fray-fill {
  background: linear-gradient(90deg, #38bdf8 0%, #0284c7 100%);
}

.hud-fray-cap {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #0369a1;
}

.hud-fray-bar.is-rookie .hud-fray-cap { display: block; }
.hud-rookie-note { display: none; margin-top: 4px; font-size: 0.69rem; font-weight: 600; }
.hud-fray-bar.is-rookie .hud-rookie-note { display: block; }

/* Top-Center Feed & Banners */
.hud-top-center {
  position: fixed;
  top: max(14px, var(--sat));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: min(420px, calc(100vw - 240px));
}

.sunset-banner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(17, 21, 29, 0.90);
  color: #fef3c7;
  border: 1px solid rgba(234, 179, 8, 0.55);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: var(--shadow-hud);
}

.sunset-share-btn {
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  border: 0;
  background: #eab308;
  color: #11151d;
  font-size: 0.72rem;
  font-weight: 700;
}

.sky-streak-line {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(17, 21, 29, 0.88);
  color: #fde047;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
}

.kill-feed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.kill-row {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  color: var(--hud-ink);
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: var(--shadow-hud);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kill-row.is-self {
  background: rgba(24, 88, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.30);
  color: #ffffff;
}

/* Self multi-kill streak banner (issue #17): kite-string tension → snap → name hit → notches.
   Tier numbers mirror shared/streak-fx.js so the clip burn-in matches. Tiers differ without
   colour: strand count, notch count, plate ends (flat / swallowtail / chevron / kite tips), size. */
.streak-banner {
  --fx-accent: #1858ff;
  --fx-scale: 1;
  --fx-tension: 150ms;
  --fx-snap: 280ms;
  --fx-step: 95ms;
  --fx-hold: 1350ms;
  --fx-hit: 1.16;
  --fx-cap: 12px;
  --fx-shape: inset(0 round 9px);
  --fx-shape-in: inset(0 round 7px);
  position: fixed;
  top: calc(112px + var(--sat));
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100vw - 16px));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-align: center;
  pointer-events: none;
  /* Above the leaderboard and stats cards (it sits before them in the HUD) for its ~2 s */
  z-index: 3;
  animation: streakFxOut 260ms ease-in var(--fx-hold) both;
}

.streak-banner[data-level="3"] {
  --fx-accent: #0284c7;
  --fx-scale: 1.1;
  --fx-tension: 170ms;
  --fx-snap: 310ms;
  --fx-step: 85ms;
  --fx-hold: 1500ms;
  --fx-hit: 1.2;
  --fx-cap: 14px;
  --fx-shape: polygon(0 0, 100% 0, calc(100% - var(--fx-cap)) 50%, 100% 100%, 0 100%, var(--fx-cap) 50%);
  --fx-shape-in: var(--fx-shape);
}

.streak-banner[data-level="4"],
.streak-banner[data-level="5"] {
  --fx-accent: #dc2626;
  --fx-scale: 1.2;
  --fx-tension: 190ms;
  --fx-snap: 340ms;
  --fx-step: 75ms;
  --fx-hold: 1650ms;
  --fx-hit: 1.24;
  --fx-cap: 16px;
  --fx-shape: polygon(var(--fx-cap) 0, calc(100% - var(--fx-cap)) 0, 100% 50%, calc(100% - var(--fx-cap)) 100%, var(--fx-cap) 100%, 0 50%);
  --fx-shape-in: var(--fx-shape);
}

.streak-banner[data-level="5"] {
  --fx-accent: #eab308;
  --fx-scale: 1.32;
  --fx-tension: 210ms;
  --fx-snap: 380ms;
  --fx-step: 65ms;
  --fx-hold: 1850ms;
  --fx-hit: 1.28;
  --fx-cap: 18px;
}

.streak-banner[data-upgrade="true"] {
  --fx-tension: 70ms;
}

.streak-fx-plate {
  position: relative;
  flex: 0 0 auto;
  isolation: isolate;
  padding: 7px calc(var(--fx-cap) + 14px) 8px;
  animation:
    streakFxPlateIn var(--fx-tension) cubic-bezier(0.55, 0, 1, 0.45) both,
    streakFxHit 190ms var(--ease-studio) var(--fx-tension) both;
}

.streak-banner[data-upgrade="true"] .streak-fx-plate {
  animation: streakFxHit 190ms var(--ease-studio) var(--fx-tension) both;
}

.streak-fx-plate::before,
.streak-fx-plate::after {
  content: '';
  position: absolute;
  z-index: -1;
}

.streak-fx-plate::before {
  inset: 0;
  background: var(--fx-accent);
  clip-path: var(--fx-shape);
}

.streak-fx-plate::after {
  inset: 3px 3.5px;
  background: rgba(17, 21, 29, 0.95);
  clip-path: var(--fx-shape-in);
}

/* PENTA only: kite tips beyond both chevron ends */
.streak-fx-tip {
  display: none;
  position: absolute;
  top: 50%;
  width: 11px;
  height: 16px;
  margin-top: -8px;
  background: var(--fx-accent);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.streak-fx-tip-l { left: -15px; }
.streak-fx-tip-r { right: -15px; }
.streak-banner[data-level="5"] .streak-fx-tip { display: block; }

.streak-banner-title {
  font-family: var(--font-display);
  font-size: calc(1.3rem * var(--fx-scale));
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: #ffffff;
  animation: streakFxShow 1ms linear var(--fx-tension) both;
}

.streak-fx-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 3px;
  animation: streakFxShow 1ms linear var(--fx-tension) both;
}

.streak-fx-notches {
  display: inline-flex;
  gap: 5px;
}

.streak-fx-notches i {
  display: block;
  width: 9px;
  height: 13px;
  background: var(--fx-accent);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  animation: streakFxNotch 160ms var(--ease-studio) calc(var(--fx-tension) + var(--fx-step) * var(--n, 0)) both;
}

.streak-fx-notches i:nth-child(2) { --n: 1; }
.streak-fx-notches i:nth-child(3) { --n: 2; }
.streak-fx-notches i:nth-child(4) { --n: 3; }
.streak-fx-notches i:nth-child(5) { --n: 4; }

.streak-banner-sub {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: #e2e8f0;
  white-space: nowrap;
}

/* Kite strands: taut lines from the screen side to the plate, each with a break point */
.streak-fx-strands {
  flex: 1 1 0;
  min-width: 14px;
  height: calc(2.6rem * var(--fx-scale));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  animation: streakFxFade calc(var(--fx-hold) * 0.3) linear calc(var(--fx-hold) * 0.6) both;
}

.streak-fx-strands i {
  position: relative;
  display: block;
  height: 2.5px;
  transform-origin: left center;
  animation: streakFxPull var(--fx-tension) cubic-bezier(0.55, 0, 1, 0.45) both;
}

.streak-fx-strands-r i { transform-origin: right center; }

.streak-fx-strands i::before,
.streak-fx-strands i::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 2px;
  background: var(--fx-accent);
  box-shadow: 0 0 0 1px rgba(255, 253, 248, 0.55);
}

/* outer half recoils to the screen side, inner stub shrinks into the plate */
.streak-fx-strands-l i::before { left: 0; width: 46%; transform-origin: left center; --curl: 4deg; }
.streak-fx-strands-l i::after { right: 0; width: 46%; transform-origin: right center; }
.streak-fx-strands-r i::before { right: 0; width: 46%; transform-origin: right center; --curl: -4deg; }
.streak-fx-strands-r i::after { left: 0; width: 46%; transform-origin: left center; }
.streak-fx-strands i:nth-child(even)::before { --curl: -4deg; }
.streak-fx-strands-r i:nth-child(even)::before { --curl: 4deg; }

.streak-fx-strands i::before {
  animation: streakFxRecoil var(--fx-snap) cubic-bezier(0.22, 1, 0.36, 1) var(--fx-tension) both;
}

.streak-fx-strands i::after {
  animation: streakFxRetract var(--fx-snap) cubic-bezier(0.22, 1, 0.36, 1) var(--fx-tension) both;
}

/* Tier counts: 2/3/4/5 strands per side and 2/3/4/5 notches */
.streak-banner[data-level="2"] .streak-fx-strands i:nth-child(n + 3),
.streak-banner[data-level="2"] .streak-fx-notches i:nth-child(n + 3),
.streak-banner[data-level="3"] .streak-fx-strands i:nth-child(n + 4),
.streak-banner[data-level="3"] .streak-fx-notches i:nth-child(n + 4),
.streak-banner[data-level="4"] .streak-fx-strands i:nth-child(n + 5),
.streak-banner[data-level="4"] .streak-fx-notches i:nth-child(n + 5) {
  display: none;
}

@keyframes streakFxPull {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes streakFxRecoil {
  from { transform: scaleX(1.09) rotate(0deg); }
  to { transform: scaleX(0.62) rotate(var(--curl, 4deg)); }
}

@keyframes streakFxRetract {
  from { transform: scaleX(1.09); }
  to { transform: scaleX(0.3); }
}

@keyframes streakFxPlateIn {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

@keyframes streakFxHit {
  from { transform: scale(var(--fx-hit)); }
  to { transform: scale(1); }
}

@keyframes streakFxShow {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes streakFxNotch {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

@keyframes streakFxFade {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes streakFxOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Reduced motion (OS or Settings): static plate, taut strands with a fixed break, all
   notches; no pull, snap, hit or fade. The banner simply hides when its time is up. */
@media (prefers-reduced-motion: reduce) {
  html:not([data-reduced-motion="false"]) .streak-banner,
  html:not([data-reduced-motion="false"]) .streak-banner *,
  html:not([data-reduced-motion="false"]) .streak-banner *::before,
  html:not([data-reduced-motion="false"]) .streak-banner *::after {
    animation: none !important;
  }
}

html[data-reduced-motion="true"] .streak-banner,
html[data-reduced-motion="true"] .streak-banner *,
html[data-reduced-motion="true"] .streak-banner *::before,
html[data-reduced-motion="true"] .streak-banner *::after {
  animation: none !important;
}

/* Top-Right Leaderboard */
.leaderboard {
  position: fixed;
  top: max(14px, var(--sat));
  right: max(14px, var(--sar));
  width: 212px;
  border-radius: 14px;
  background: var(--hud-bg-strong);
  border: 1px solid var(--hud-border);
  color: var(--hud-ink);
  box-shadow: var(--shadow-hud);
  overflow: hidden;
  pointer-events: auto;
}

.leaderboard-head {
  width: 100%;
  padding: 8px 11px 6px;
  border: 0;
  border-bottom: 1px solid var(--hud-border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--hud-ink-soft);
}

.lb-head-right {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.lb-chevron { display: none; }

.leaderboard-list {
  margin: 0;
  padding: 5px 8px 7px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.leaderboard-self {
  padding: 5px 8px 7px;
  border-top: 1px solid var(--hud-border);
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 7px;
  font-size: 0.77rem;
  font-weight: 600;
}

.leaderboard-row.is-self {
  background: var(--cobalt);
  color: #ffffff;
}

.lb-rank {
  width: 22px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--hud-ink-soft);
}

.leaderboard-row.is-self .lb-rank { color: rgba(255, 255, 255, 0.85); }

.lb-crown {
  width: 14px;
  height: 14px;
  display: block;
}

.lb-bot-cog {
  width: 12px;
  height: 12px;
  opacity: 0.68;
  flex-shrink: 0;
}

.lb-name {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

.lb-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-len {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cobalt);
}

.hud[data-sky="night"] .lb-len { color: #93c5fd; }
.leaderboard-row.is-self .lb-len { color: #ffffff; }

/* Bottom-Center Toast & Action Hints */
.hud-bottom-center {
  position: fixed;
  bottom: max(18px, var(--sab));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: min(460px, calc(100vw - 32px));
}

.hud-toast,
.first-hint {
  padding: 8px 15px;
  border-radius: var(--radius-pill);
  background: rgba(17, 21, 29, 0.90);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.24);
}

.hud-toast {
  background: var(--cobalt);
  border-color: rgba(255, 255, 255, 0.24);
}

/* Bottom-Right Signal Bar & Utility Icons */
.hud-bottom-right {
  position: fixed;
  right: max(14px, var(--sar));
  bottom: max(14px, var(--sab));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
}

.signal-bar {
  display: flex;
  gap: 5px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--hud-bg-strong);
  border: 1px solid var(--hud-border);
  box-shadow: var(--shadow-hud);
}

.signal-btn {
  height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--hud-ink);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.signal-btn:hover {
  background: rgba(24, 88, 255, 0.14);
}

.sig-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
}

.hud-util-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* =========================================================
   Mobile / Touch Controls (Joystick + SNAP + DIVE)
   ========================================================= */

.mobile-controls {
  display: none;
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.hud.is-touch .mobile-controls {
  display: block;
}

.touch-joystick-zone {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 52vw;
  height: 48vh;
  pointer-events: auto;
  touch-action: none;
}

.touch-joystick-base {
  position: fixed;
  top: 0;
  left: 0;
  width: 112px;
  height: 112px;
  margin-left: -56px;
  margin-top: -56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
  border: 2px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.22);
  pointer-events: none;
  opacity: 0.72;
}

.touch-joystick-base.is-active {
  opacity: 1;
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.30);
}

.touch-joystick-tick {
  position: absolute;
  width: 6px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.65);
}

.tick-n { top: 8px; left: 50%; transform: translateX(-50%) rotate(90deg); }
.tick-s { bottom: 8px; left: 50%; transform: translateX(-50%) rotate(90deg); }
.tick-e { right: 8px; top: 50%; transform: translateY(-50%); }
.tick-w { left: 8px; top: 50%; transform: translateY(-50%); }

.touch-joystick-dir {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.touch-joystick-dir::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-top: 2.5px solid #ffffff;
  border-right: 2.5px solid #ffffff;
  transform: rotate(45deg);
}

.touch-joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  margin-left: -23px;
  margin-top: -23px;
  border-radius: 50%;
  background: rgba(17, 21, 29, 0.88);
  border: 2.5px solid #ffffff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.32);
}

.mobile-right-cluster {
  position: fixed;
  right: max(16px, var(--sar));
  bottom: max(18px, var(--sab));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
}

.mobile-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.touch-signal-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.72);
  background: rgba(17, 21, 29, 0.76);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28);
}

.touch-snap-btn {
  height: 46px;
  min-width: 68px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(2, 132, 199, 0.90);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.36);
  touch-action: none;
}

.touch-snap-btn.is-cooling {
  opacity: 0.52;
  background: rgba(17, 21, 29, 0.72);
}

.touch-snap-btn.is-pressed {
  transform: scale(0.94);
}

.touch-brace-btn {
  height: 46px;
  min-width: 92px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(14, 116, 144, 0.92);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 8px 20px rgba(14, 116, 144, 0.34);
  touch-action: none;
}

.touch-brace-btn.is-cooling {
  opacity: 0.52;
  background: rgba(17, 21, 29, 0.72);
}

.touch-brace-btn.is-pressed {
  transform: scale(0.94);
}

.touch-dive-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.92);
  background: linear-gradient(180deg, #2764ff 0%, #1448dc 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 10px 26px rgba(24, 88, 255, 0.38);
  touch-action: none;
}

.touch-dive-btn.is-active {
  transform: scale(0.94);
  background: #0f36ad;
}

/* =========================================================
   Responsive Phone Layout (390x844 and narrow viewports)
   ========================================================= */

@media (pointer: coarse) {
  .mobile-controls { display: block; }
  .hud .hud-bottom-right .signal-bar { display: none; }
  .hud.has-signals-open .hud-bottom-right .signal-bar {
    display: flex;
    flex-direction: column;
    position: fixed;
    right: max(16px, var(--sar));
    bottom: calc(168px + var(--sab));
    border-radius: 14px;
  }
  .hud-bottom-right {
    top: max(14px, var(--sat));
    bottom: auto;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
  }
}

@media (max-width: 780px) {
  .workshop-card {
    height: calc(100dvh - 16px - var(--sat) - var(--sab));
    padding: 13px 13px 11px;
    overflow-x: hidden;
  }

  .ws-header {
    margin-bottom: 9px;
    gap: 6px;
  }

  .ws-header h2 {
    font-size: 1.02rem;
    white-space: nowrap;
  }

  .ws-header-actions {
    gap: 5px;
    flex-shrink: 0;
  }

  .ws-header-actions .btn-pill,
  .ws-header-actions .btn-outline-pill {
    padding: 5px 8px;
    font-size: 0.7rem;
    white-space: nowrap;
  }

  .ws-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .ws-body > * {
    min-width: 0;
    max-width: 100%;
  }

  .ws-stage {
    min-height: 204px;
    height: 204px;
    flex: none;
    width: 100%;
  }

  .ws-wind-dial {
    width: 100%;
    min-width: 0;
  }

  .ws-options {
    overflow: visible;
    padding-right: 0;
    width: 100%;
  }

  .swatches {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
  }

  .swatch {
    width: 100%;
    max-width: 38px;
    margin: 0 auto;
  }

  .studio-seg-wide,
  .dial-stack,
  .keycap-grid,
  .hero-metrics-grid,
  .fest-days-list,
  .fest-unlocks-grid,
  .help-grid {
    grid-template-columns: 1fr;
  }

  .hero-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .studio-seg-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .studio-row-static {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .overlay-backdrop {
    padding: max(10px, var(--sat)) max(10px, var(--sar)) max(10px, var(--sab)) max(10px, var(--sal));
  }

  .title-card {
    padding: 15px 14px 14px;
  }

  .title-heading-group h1 {
    font-size: 1.32rem;
  }

  .title-subtitle {
    font-size: 0.72rem;
  }

  .kit-row {
    padding: 8px 10px 8px 8px;
    gap: 9px;
  }

  .kit-row-art {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
  }

  .kit-row-go-label {
    display: none;
  }

  .kite-cards {
    gap: 6px;
  }

  .kite-card {
    padding: 8px 5px;
  }

  .title-social-row {
    flex-wrap: wrap;
  }

  .btn-invite {
    flex: 1 1 100%;
  }

  .title-util-icons {
    width: 100%;
    justify-content: space-between;
  }

  .title-util-icons .btn-icon-pill {
    flex: 1;
    width: auto;
  }

  .hud-top-left {
    top: max(10px, var(--sat));
    left: max(10px, var(--sal));
    gap: 5px;
    max-width: 196px;
  }

  .mode-pill,
  .hud-pill {
    padding: 3px 7px;
    font-size: 0.64rem;
  }

  .hud-stats-card,
  .hud-festival-goal,
  .hud-fray-bar {
    width: 194px;
    padding: 6px 9px;
  }

  .hud-festival-goal-text {
    font-size: 0.72rem;
  }

  .leaderboard {
    top: max(10px, var(--sat));
    right: max(10px, var(--sar));
    width: 158px;
  }

  .leaderboard-head {
    padding: 6px 8px 5px;
    font-size: 0.6rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
    gap: 4px;
  }

  .leaderboard-list {
    padding: 4px 6px 6px;
  }

  .leaderboard-self {
    padding: 4px 6px 6px;
  }

  .leaderboard-row {
    padding: 2.5px 5px;
    font-size: 0.72rem;
    gap: 4px;
  }

  .lb-chevron { display: inline; }

  .leaderboard:not(.is-expanded) .leaderboard-list li:nth-child(n + 4) {
    display: none;
  }

  /* Keep feed & streak badges below leaderboard on narrow phones — zero overlap with top-left HUD */
  .hud-top-center {
    top: calc(168px + var(--sat));
    left: auto;
    right: max(10px, var(--sar));
    transform: none;
    align-items: flex-end;
    max-width: 174px;
  }

  .sky-streak-line,
  .sunset-banner {
    font-size: 0.66rem;
    padding: 4px 9px;
    max-width: 174px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .kill-feed {
    align-items: flex-end;
  }

  .kill-feed .kill-row:not(.is-self) {
    display: none;
  }

  .kill-row {
    padding: 3px 8px;
    font-size: 0.68rem;
  }

  .hud-bottom-right {
    bottom: max(10px, var(--sab));
    right: max(10px, var(--sar));
  }

  .hud-bottom-right .signal-bar {
    display: none;
  }

  .hud.is-touch .hud-bottom-right {
    top: auto;
    left: max(10px, var(--sal));
    right: auto;
    bottom: calc(146px + var(--sab));
    transform: none;
  }

  .death-card {
    padding: 16px 14px 14px;
  }

  .death-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ws-stage-bar {
    left: 6px;
    right: 6px;
    bottom: 6px;
    gap: 4px;
    flex-wrap: nowrap;
  }

  .ws-seg {
    padding: 2px;
  }

  .ws-seg button {
    min-height: 24px;
    padding: 3px 6px;
    font-size: 0.66rem;
    white-space: nowrap;
  }

  .ws-flag-list {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Strict Reduced Motion Support (OS preference OR Setting)
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  html:not([data-reduced-motion="false"]) *,
  html:not([data-reduced-motion="false"]) *::before,
  html:not([data-reduced-motion="false"]) *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

html[data-reduced-motion="true"] *,
html[data-reduced-motion="true"] *::before,
html[data-reduced-motion="true"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* =========================================================
   Friends & rivalries (issue #17): roster, sky rules, recap
   comparison, spectate bar
   ========================================================= */

.private-sky-roster {
  font-size: 0.78rem;
  color: var(--ink);
  line-height: 1.35;
}

.private-sky-roster strong {
  font-weight: 700;
}

.sky-variant-chip {
  align-self: flex-start;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  border: 1px dashed rgba(17, 21, 29, 0.4);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.sky-rule-opt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  min-height: 36px;
  padding: 4px 10px 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-ink);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.sky-rule-opt:hover {
  background: var(--surface-hover);
}

.sky-rule-opt:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}

.sky-rule-box {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.6px solid var(--ink);
  background: var(--surface);
  flex-shrink: 0;
  position: relative;
}

.sky-rule-opt.is-on .sky-rule-box {
  background: var(--ink);
}

.sky-rule-opt.is-on .sky-rule-box::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.sky-rule-copy {
  display: flex;
  flex-direction: column;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.1;
}

.sky-rule-copy small {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.death-compare {
  margin-bottom: 11px;
  padding: 8px 11px 9px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-ink);
  text-align: left;
}

.death-compare.is-new-best {
  border-color: rgba(24, 88, 255, 0.45);
  background: #f5f8ff;
}

.death-compare-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.death-compare-mode {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.death-compare-note {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}

.death-compare-grid {
  display: grid;
  gap: 2px;
}

.death-compare-r {
  display: grid;
  grid-template-columns: 64px repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: baseline;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.death-compare-r > span:first-child,
.death-compare-r [role='columnheader'] {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.death-compare-r.is-best > span:not(:first-child) {
  font-weight: 700;
}

.death-compare-r em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
}

.death-compare-r em.is-up { color: var(--emerald); }
.death-compare-r em.is-down { color: var(--vermilion-deep); }
.death-compare-r em.is-even { color: var(--ink-muted); }

.btn-fly-again {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.fly-again-where {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  opacity: 0.78;
}

.btn-watch-friend {
  width: 100%;
  margin: -2px 0 10px;
  min-height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
}

.btn-watch-friend:hover {
  background: var(--surface-hover);
}

.spectate-bar {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--sab));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 20px - var(--sal) - var(--sar));
  padding: 8px 8px 8px 12px;
  border-radius: var(--radius-lg);
  background: var(--hud-bg-strong);
  border: 1px solid var(--hud-border);
  box-shadow: var(--shadow-hud);
  color: var(--hud-ink);
}

.spectate-eye {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}

.spectate-copy {
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.btn-fly-compact {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.86rem;
}

@media (max-width: 640px) {
  .sky-rule-opt {
    flex: 1 1 100%;
  }

  .spectate-bar {
    left: calc(10px + var(--sal));
    right: calc(10px + var(--sar));
    transform: none;
    max-width: none;
  }
}

/* Solo combat training entry (issue #17): one quiet row under the rule switches */
.btn-train-solo {
  order: 4;
  flex: 1 1 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-train-solo:hover {
  background: var(--surface-hover);
}

.btn-train-solo:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}
