/* web/css/style.css — 나에게 어울리는 자동차 (MyCar) UI/UX Stylesheet */
/* Mobile-first zero horizontal overflow (390x844 safe), BAD (0~499) vs GOOD (500~1000) aura */

/* ==========================================================================
   1. CSS Variables & Reset
   ========================================================================== */
:root {
  /* Core Typography */
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
  --font-serif: 'Noto Serif KR', serif;

  /* Theme Canvas — Bright, Warm, Modern Light Palette */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-glass: rgba(255, 255, 255, 0.9);

  /* Text Colors */
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --text-gold: #b45309;

  /* Accent BAD Zone: 0 ~ 499 (폭망 탈것 — Crimson / Hazard Amber / Rust) */
  --bad-primary: #dc2626;
  --bad-secondary: #ea580c;
  --bad-border: #fecaca;
  --bad-glow: rgba(239, 68, 68, 0.12);
  --bad-surface: #fff5f5;
  --bad-stamp: #dc2626;

  /* Accent GOOD Zone: 500 ~ 1,000 (대박 탈것 — Celestial Gold / Emerald / Royal Violet) */
  --good-primary: #d97706;
  --good-secondary: #059669;
  --good-border: #fde68a;
  --good-glow: rgba(234, 179, 8, 0.15);
  --good-surface: #fefce8;
  --good-stamp: #b45309;

  /* Reality Badges */
  --real-color: #0284c7;
  --real-bg: rgba(2, 132, 199, 0.08);
  --real-border: rgba(2, 132, 199, 0.25);
  --fiction-color: #9333ea;
  --fiction-bg: rgba(147, 51, 234, 0.08);
  --fiction-border: rgba(147, 51, 234, 0.25);

  /* Layout Constants */
  --max-content-width: 560px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  --transition-fast: 0.18s ease;
  --transition-normal: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  max-width: 100%;
}

body {
  min-height: 100vh;
  background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 45%, #ffffff 100%);
  background-attachment: fixed;
  line-height: 1.6;
  padding-bottom: 32px;
  overflow-x: clip;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
  transition: transform var(--transition-fast), filter var(--transition-fast), background-color var(--transition-fast);
}

button:active {
  transform: scale(0.97);
}

input {
  font-family: inherit;
  border: none;
  outline: none;
  color: inherit;
}

/* ==========================================================================
   2. Layout Container
   ========================================================================== */
.app-layout {
  width: 100%;
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 0 14px;
  overflow-x: clip;
}

/* ==========================================================================
   2.1 Top Family Navigation Bar (.family-site-nav / .family-top-nav)
   ========================================================================== */
.family-site-nav,
.family-top-nav {
  width: 100%;
  max-width: 100%;
  padding: 10px 0 6px;
  margin-bottom: 2px;
}

.family-nav-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
}

.family-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(203, 213, 225, 0.85);
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
  white-space: nowrap;
  max-width: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  text-decoration: none;
}

.family-nav-link:hover {
  color: #1e293b;
  background: #ffffff;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.family-nav-link.active {
  color: #1e40af;
  background: rgba(239, 246, 255, 0.98);
  border-color: #60a5fa;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.14);
}

.family-nav-icon {
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
}

.family-nav-label {
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 440px) {
  .app-layout {
    padding: 0 10px;
  }
  .family-site-nav,
  .family-top-nav {
    padding: 6px 0 4px;
  }
  .family-nav-inner {
    gap: 5px;
  }
  .family-nav-link {
    padding: 4px 8px;
    font-size: 0.71rem;
  }
}

/* ==========================================================================
   3. Header & Sticky Search Bar
   ========================================================================== */
.app-header {
  padding: 8px 0 6px;
  text-align: center;
  width: 100%;
  max-width: 100%;
}

.top-util-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 100%;
  margin: 0 auto 8px;
  padding: 0 2px;
  gap: 6px;
}

.top-util-links {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.photodiary-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-pill);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.photodiary-link:hover {
  color: #2563eb;
  border-color: #cbd5e1;
  background: #ffffff;
}

.lang-compact-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.lang-compact-wrapper .lang-icon {
  font-size: 0.85rem;
}

.lang-select-compact {
  background: transparent;
  border: none;
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

.brand-link {
  max-width: 100%;
}

.brand-title {
  font-size: 1.32rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.brand-sub {
  font-size: 0.98rem;
  font-weight: 700;
  color: #2563eb;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Search Form */
.search-section {
  width: 100%;
  max-width: 100%;
  margin-top: 8px;
}

.search-form {
  width: 100%;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-pill);
  padding: 4px 6px 4px 14px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
  max-width: 100%;
}

.search-input-wrapper:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 4px 16px rgba(15, 23, 42, 0.08);
}

.name-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  border: none;
  outline: none;
  padding: 6px 4px;
}

.name-input::placeholder {
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 400;
}

.search-btn {
  flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  outline: none;
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.search-btn:hover {
  filter: brightness(1.08);
  transform: scale(1.04);
}

.search-btn:active {
  transform: scale(0.96);
}

.search-btn-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Random Dice & Refresh Chips Controls */
.random-dice-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  transition: transform 0.2s ease, filter 0.2s ease;
  user-select: none;
  flex-shrink: 0;
}

.random-dice-btn:hover {
  transform: scale(1.18) rotate(15deg);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.random-dice-btn.rolling {
  animation: diceRoll 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes diceRoll {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.3); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Sample Chips */
.sample-chips-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.sample-chips-container::-webkit-scrollbar {
  display: none;
}

.chips-label-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.chips-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}

.btn-refresh-chips {
  background: transparent;
  border: none;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 1px 3px;
  opacity: 0.75;
  transition: opacity 0.2s ease, transform 0.3s ease;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-refresh-chips:hover {
  opacity: 1;
  transform: rotate(180deg);
}

.sample-chips {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.sample-chip {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-pill);
  color: #475569;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.sample-chip:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0284c7;
}

/* ==========================================================================
   4. Floating Return Banner
   ========================================================================== */
.return-my-house-bar {
  position: sticky;
  top: 10px;
  z-index: 40;
  margin: 10px 0 12px;
  display: flex;
  justify-content: center;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.return-my-house-bar.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.return-house-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  max-width: 100%;
  animation: pulseReturn 2.5s infinite;
}

.return-house-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

@keyframes pulseReturn {
  0%, 100% { box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3); }
  50% { box-shadow: 0 4px 22px rgba(16, 185, 129, 0.5); }
}

/* ==========================================================================
   5. Vehicle Appraisal Certificate Card (#card-root)
   ========================================================================== */
.main-content {
  width: 100%;
  max-width: 100%;
  margin-top: 10px;
}

#card-root {
  width: 100%;
  max-width: 100%;
}

.appraisal-card {
  position: relative;
  border-radius: 18px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

/* BAD Zone Styling (0 ~ 499) */
.appraisal-card.zone-bad {
  background: linear-gradient(180deg, #fff5f5 0%, #ffffff 100%);
  border-color: #fecaca;
  box-shadow: 0 12px 32px rgba(239, 68, 68, 0.10);
}

/* GOOD Zone Styling (500 ~ 1,000) */
.appraisal-card.zone-good {
  background: linear-gradient(180deg, #fefce8 0%, #ffffff 100%);
  border-color: #fde68a;
  box-shadow: 0 12px 32px rgba(234, 179, 8, 0.12);
}

/* Certificate Header */
.card-certificate-header {
  text-align: center;
  border-bottom: 1px dashed #cbd5e1;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.owner-headline-label {
  font-size: 0.96rem;
  font-weight: 800;
  color: #2563eb;
  letter-spacing: -0.02em;
  word-break: keep-all;
}

/* Vehicle Title */
.house-title-container {
  text-align: center;
  margin: 4px 0 12px;
}

.house-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.32;
  color: #0f172a;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* Vehicle Visual Media Frame (1:1) */
.house-media-wrapper {
  margin: 0 auto 12px;
  max-width: 260px;
  width: 100%;
}

.media-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.house-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease, opacity 0.3s ease;
}

.house-image:hover {
  transform: scale(1.02);
}

.house-image.img-fallback {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
}

.image-sub-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-dim);
  padding: 0 4px;
}

/* Badge Matrix (Level, Tier, Zone, Reality, Category) */
.badge-matrix {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.matrix-badge {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  padding: 4px 10px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  text-align: center;
  max-width: 100%;
}

.badge-val {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0f172a;
}

.badge-total {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* Zone Badge Accents */
.matrix-badge.badge-zone.zone-bad {
  background: #fef2f2;
  border-color: #fca5a5;
}

.matrix-badge.badge-zone.zone-bad .badge-val {
  color: #b91c1c;
}

.matrix-badge.badge-zone.zone-good {
  background: #fffbeb;
  border-color: #fcd34d;
}

.matrix-badge.badge-zone.zone-good .badge-val {
  color: #b45309;
}

/* Reality Badge Accents */
.matrix-badge.badge-reality.reality-real {
  background: var(--real-bg);
  border-color: var(--real-border);
}

.matrix-badge.badge-reality.reality-real .badge-val {
  color: var(--real-color);
}

.matrix-badge.badge-reality.reality-fiction {
  background: var(--fiction-bg);
  border-color: var(--fiction-border);
}

.matrix-badge.badge-reality.reality-fiction .badge-val {
  color: var(--fiction-color);
}

/* ==========================================================================
   6. 3 Mandatory Appraisal Spec Boxes
   ========================================================================== */
.appraisal-spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.spec-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  min-width: 0;
  transition: border-color var(--transition-fast);
}

.spec-card:hover {
  border-color: #cbd5e1;
}

.spec-card.spec-built-year {
  border-left: 3px solid #0284c7;
}

.spec-card.spec-estimated-value {
  border-left: 3px solid #d97706;
}

.spec-card.spec-special-feature {
  border-left: 3px solid #9333ea;
  grid-column: 1 / -1;
}

.spec-card-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
}

.spec-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.spec-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: #475569;
}

.spec-value {
  font-size: 0.84rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.4;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.spec-value.price-highlight {
  font-size: 0.88rem;
  font-weight: 800;
  color: #b45309;
}

.spec-value.feature-text {
  font-size: 0.82rem;
  color: #334155;
}

/* ==========================================================================
   7. AI Chief Mechanic Verdict Box
   ========================================================================== */
.ai-verdict-section {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  text-align: center;
}

.verdict-label-row {
  font-size: 0.74rem;
  font-weight: 800;
  color: #2563eb;
  margin-bottom: 4px;
}

.verdict-quote {
  font-family: var(--font-sans);
  font-size: 0.96rem;
  font-weight: 800;
  line-height: 1.45;
  color: #0f172a;
  letter-spacing: -0.02em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   7.1 Name Stroke Breakdown Accordion (name_teller integration)
   ========================================================================== */
.stroke-accordion {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}

.stroke-accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.stroke-accordion-summary::-webkit-details-marker {
  display: none;
}

.stroke-accordion-chevron {
  font-size: 0.75rem;
  color: #64748b;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.stroke-accordion[open] .stroke-accordion-chevron {
  transform: rotate(180deg);
}

.stroke-accordion-body {
  border-top: 1px dashed #cbd5e1;
  padding: 10px 12px 12px;
  background: #ffffff;
  text-align: center;
}

.stroke-char-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}

.stroke-char-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e40af;
}

.stroke-char-count {
  font-size: 0.72rem;
  color: #3b82f6;
  font-weight: 800;
}

.stroke-pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.stroke-step-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.stroke-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  font-size: 0.75rem;
  font-weight: 800;
  color: #0f172a;
}

.stroke-step-row.is-final .stroke-step-num {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
}

.stroke-meta-line {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.4;
}

/* ==========================================================================
   8. Action Buttons
   ========================================================================== */
.card-action-bar {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-bottom: 4px;
}

.btn-action {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 10px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-share-modal {
  background: linear-gradient(135deg, #d97706 0%, #db2777 50%, #7c3aed 100%);
  color: #ffffff;
}

.btn-share-modal:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.btn-copy-address {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

.btn-copy-address:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

/* ==========================================================================
   9. 3-Button Step Navigation Dock (#explorer-dock)
   ========================================================================== */
.explorer-dock {
  width: 100%;
  max-width: 100%;
  margin: 14px auto 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.explorer-dock.hidden {
  display: none !important;
}

.dock-container {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.dock-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  transition: all var(--transition-fast);
  min-width: 0;
  text-align: center;
  line-height: 1.25;
}

.dock-btn:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.dock-btn.btn-prev,
#btn-prev-level {
  flex: 1.25;
}

.dock-btn.btn-random,
#btn-random-level {
  flex: 0.9;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-color: #6366f1;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.dock-btn.btn-random:hover,
#btn-random-level:hover {
  filter: brightness(1.1);
  color: #ffffff;
}

.dock-btn.btn-next,
#btn-next-level {
  flex: 1.25;
}

.dock-btn-icon {
  font-size: 0.8rem;
  flex-shrink: 0;
}

.dock-btn-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-keyboard-hint {
  margin: 6px auto 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
}

@media (max-width: 480px) {
  .dock-btn {
    padding: 9px 6px;
    font-size: 0.73rem;
  }
  .dock-keyboard-hint {
    display: none;
  }
}

/* ==========================================================================
   10. System Story & Service Guide Section
   ========================================================================== */
.service-guide-section {
  margin: 28px 0 24px;
}

.guide-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 14px;
  text-align: center;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .guide-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.guide-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.guide-card-header {
  margin-bottom: 8px;
}

.guide-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
}

.bad-guide .guide-badge {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.good-guide .guide-badge {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.rule-guide .guide-badge {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.guide-card h3 {
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
}

.guide-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   11. Footer
   ========================================================================== */
.app-footer {
  text-align: center;
  padding: 24px 0 32px;
  border-top: 1px solid #e2e8f0;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.footer-brand {
  color: var(--text-muted);
  margin-bottom: 6px;
}

.footer-links {
  margin-top: 8px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  line-height: 1.6;
}

.footer-links a {
  color: #2563eb;
  text-decoration: underline;
}

.footer-links a:hover {
  color: #1d4ed8;
}

.footer-desc {
  max-width: 500px;
  margin: 0 auto 6px;
  line-height: 1.4;
}

/* ==========================================================================
   12. Loading Overlay & Appraisal Stamp Animation
   ========================================================================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px;
}

.loading-seal-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.seal-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #f59e0b;
  border-bottom-color: #3b82f6;
  animation: spinSeal 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.seal-icon {
  font-size: 2rem;
  animation: pulseIcon 1.2s ease-in-out infinite alternate;
}

@keyframes spinSeal {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulseIcon {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 1; }
}

.loading-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  max-width: 320px;
}

/* ==========================================================================
   13. Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  max-width: 92vw;
}

.toast-item {
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  text-align: center;
}

.toast-item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   14. Google AdSense Responsive Display Units (CLS=0 Guarantee)
   ========================================================================== */
.adsense-slot {
  width: 100%;
  max-width: 100%;
  margin: 10px auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  contain: content;
}

.adsense-slot-top {
  min-height: 68px;
  margin: 6px auto 10px;
}

.adsense-slot-main {
  min-height: 100px;
  margin: 12px auto 14px;
}

.adsense-slot-footer {
  min-height: 100px;
  margin: 14px auto 18px;
}

.adsense-slot-inner {
  width: 100%;
  text-align: center;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.adsense-slot .ad-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #64748b;
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-bottom: 4px;
}

/* ==========================================================================
   15. Editorial Whitepaper Section
   ========================================================================== */
.editorial-whitepaper {
  margin-top: 24px;
  padding: 20px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  text-align: left;
}

.editorial-header {
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.editorial-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.editorial-main-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.38;
  word-break: keep-all;
}

.editorial-articles {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.editorial-article {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.editorial-article h3 {
  font-size: 0.96rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.editorial-article p {
  font-size: 0.85rem;
  line-height: 1.65;
  color: #475569;
  margin-bottom: 6px;
}

.editorial-article p:last-child {
  margin-bottom: 0;
}

.editorial-article a {
  color: #2563eb;
  text-decoration: underline;
}

/* ==========================================================================
   16. Main Page Inline Instagram Story 9:16 Preview Showcase
   ========================================================================== */
.inline-insta-showcase {
  max-width: 560px;
  margin: 0 auto 1.5rem auto;
  padding: 1.25rem 1rem;
  background: linear-gradient(165deg, rgba(30, 15, 45, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(244, 114, 182, 0.35);
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.inline-insta-header {
  margin-bottom: 0.85rem;
}

.inline-insta-badge {
  display: inline-block;
  padding: 0.22rem 0.7rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fde047;
  background: rgba(236, 72, 153, 0.22);
  border: 1px solid rgba(244, 114, 182, 0.45);
  border-radius: 999px;
  margin-bottom: 0.4rem;
}

.inline-insta-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0.2rem 0 0.35rem 0;
  line-height: 1.35;
}

.inline-insta-subtitle {
  font-size: 0.85rem;
  color: #fbcfe8;
  margin: 0;
  line-height: 1.45;
}

.inline-theme-selector {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.inline-theme-pill {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.inline-theme-pill.active {
  color: #ffffff;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border-color: #f472b6;
}

.inline-story-canvas-wrap {
  max-width: 280px;
  width: 100%;
  margin: 0 auto 1rem auto;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.16);
  background: #0f051d;
  aspect-ratio: 9 / 16;
}

.inline-story-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.inline-insta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

/* ==========================================================================
   17. Global Mode Navigation Tabs & Vehicle Ideal Type World Cup
   ========================================================================== */
.app-layout.wc-wide {
  max-width: 920px;
}

.mode-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 10px 0 8px;
  padding: 5px;
  background: #e2e8f0;
  border-radius: var(--radius-pill);
  flex-wrap: wrap;
  max-width: 100%;
}

.mode-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.mode-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.55);
}

.mode-tab-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #0f172a, #334155);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.18);
}

.mode-tab-btn[data-mode="worst-to-best"].active {
  background: linear-gradient(135deg, #dc2626, #ea580c);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
}

.mode-tab-btn[data-mode="best-to-worst"].active {
  background: linear-gradient(135deg, #d97706, #7c3aed);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.worldcup-root {
  width: 100%;
  margin: 8px 0 24px;
}

.worldcup-root.hidden,
#search-section.hidden,
#card-root.hidden,
.service-guide-section.hidden {
  display: none !important;
}

.wc-container {
  width: 100%;
  max-width: 100%;
}

/* Lobby Screen */
.wc-lobby-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 26px 20px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  border: 1px solid #e2e8f0;
  text-align: center;
}

.wc-theme-worst .wc-lobby-card {
  border-top: 5px solid var(--bad-primary);
}

.wc-theme-best .wc-lobby-card {
  border-top: 5px solid var(--good-primary);
}

.wc-lobby-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.wc-theme-worst .wc-lobby-badge {
  background: var(--bad-surface);
  color: var(--bad-primary);
  border: 1px solid var(--bad-border);
}

.wc-theme-best .wc-lobby-badge {
  background: var(--good-surface);
  color: var(--good-primary);
  border: 1px solid var(--good-border);
}

.wc-lobby-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 8px;
  word-break: keep-all;
}

.wc-lobby-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.55;
  word-break: keep-all;
}

.wc-round-selector {
  margin-bottom: 20px;
}

.wc-round-selector-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.wc-round-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.wc-round-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  transition: all var(--transition-fast);
}

.wc-round-btn:hover {
  border-color: #94a3b8;
  background: #ffffff;
}

.wc-round-btn.active {
  border-color: #0f172a;
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.wc-theme-worst .wc-round-btn.active {
  border-color: var(--bad-primary);
  background: var(--bad-primary);
}

.wc-theme-best .wc-round-btn.active {
  border-color: #7c3aed;
  background: #7c3aed;
}

.wc-round-num {
  font-size: 1.05rem;
  font-weight: 800;
}

.wc-round-meta {
  font-size: 0.72rem;
  opacity: 0.85;
  margin-top: 2px;
}

.wc-start-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 1.02rem;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, #0f172a, #334155);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
}

.wc-theme-worst .wc-start-btn {
  background: linear-gradient(135deg, #dc2626, #ea580c);
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.28);
}

.wc-theme-best .wc-start-btn {
  background: linear-gradient(135deg, #d97706, #7c3aed);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.26);
}

.wc-start-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.wc-lobby-hint {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Status Bar */
.wc-status-bar {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  border: 1px solid #e2e8f0;
}

.wc-status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.wc-status-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wc-round-chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 800;
  color: #ffffff;
  background: #0f172a;
}

.wc-theme-worst .wc-round-chip {
  background: var(--bad-primary);
}

.wc-theme-best .wc-round-chip {
  background: #7c3aed;
}

.wc-match-counter {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.wc-status-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.wc-reset-btn {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

.wc-reset-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.wc-progress-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 10px;
}

.wc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: var(--radius-pill);
  transition: width 0.25s ease;
}

.wc-theme-worst .wc-progress-fill {
  background: linear-gradient(90deg, #dc2626, #f59e0b);
}

.wc-theme-best .wc-progress-fill {
  background: linear-gradient(90deg, #d97706, #7c3aed);
}

.wc-question-prompt {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

/* VS Arena: Desktop 2-Column, Mobile Vertical Scrollable Stack */
.wc-arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: stretch;
}

.wc-candidate-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
}

.wc-candidate-card:hover {
  transform: translateY(-3px);
  border-color: #64748b;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

.wc-candidate-card.wc-selected {
  transform: scale(1.02);
  border-color: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.22);
}

.wc-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #0f172a;
  overflow: hidden;
}

.wc-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wc-card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.wc-level-pill {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 800;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(4px);
}

.wc-reality-pill {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.92);
}

.wc-reality-pill.badge-real {
  color: var(--real-color);
}

.wc-reality-pill.badge-fiction {
  color: var(--fiction-color);
}

.wc-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px;
}

.wc-card-tier {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.wc-card-title {
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.38;
  margin-bottom: 12px;
  word-break: keep-all;
}

.wc-card-specs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  flex: 1;
}

.wc-spec-row {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.82rem;
}

.wc-spec-label {
  display: block;
  font-weight: 700;
  color: var(--text-dim);
  font-size: 0.74rem;
  margin-bottom: 2px;
}

.wc-spec-val {
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.4;
  word-break: keep-all;
}

.wc-pick-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  background: #0f172a;
  margin-top: auto;
}

.wc-theme-worst .wc-pick-btn {
  background: linear-gradient(135deg, #dc2626, #ea580c);
}

.wc-theme-best .wc-pick-btn {
  background: linear-gradient(135deg, #d97706, #7c3aed);
}

.wc-vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
}

.wc-vs-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 900;
  color: #ffffff;
  background: linear-gradient(135deg, #0f172a, #475569);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
}

/* Champion Screen */
.wc-champion-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  border: 2px solid #e2e8f0;
}

.wc-champion-header {
  padding: 20px 18px 16px;
  text-align: center;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.wc-champion-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 800;
  color: #ffffff;
  background: #0f172a;
  margin-bottom: 8px;
}

.wc-theme-worst .wc-champion-badge {
  background: var(--bad-primary);
}

.wc-theme-best .wc-champion-badge {
  background: #7c3aed;
}

.wc-champion-title {
  font-family: var(--font-serif);
  font-size: 1.32rem;
  font-weight: 900;
  color: var(--text-main);
  word-break: keep-all;
}

.wc-champion-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #0f172a;
}

.wc-champion-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wc-champion-body {
  padding: 20px 18px 24px;
}

.wc-champion-house-name {
  font-family: var(--font-serif);
  font-size: 1.28rem;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 14px;
  line-height: 1.4;
  word-break: keep-all;
}

.wc-champion-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.wc-action-btn {
  padding: 12px 12px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

.wc-btn-primary {
  grid-column: 1 / -1;
  color: #ffffff;
  background: linear-gradient(135deg, #0f172a, #334155);
}

.wc-theme-worst .wc-btn-primary {
  background: linear-gradient(135deg, #dc2626, #ea580c);
}

.wc-theme-best .wc-btn-primary {
  background: linear-gradient(135deg, #d97706, #7c3aed);
}

.wc-btn-secondary {
  grid-column: 1 / -1;
  color: var(--text-main);
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

.wc-btn-outline {
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

.wc-btn-outline:hover,
.wc-btn-secondary:hover {
  background: #f8fafc;
}

/* World Cup Same-Condition Replay & Share URL Styles */
.wc-same-condition-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 8px;
  padding: 6px 10px;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  max-width: 100%;
}

.wc-seed-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: #0f172a;
  color: #ffffff;
  white-space: nowrap;
  flex-shrink: 0;
}

.wc-theme-worst .wc-seed-badge {
  background: #991b1b;
}

.wc-theme-best .wc-seed-badge {
  background: #6d28d9;
}

.wc-share-url-input {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  height: 32px;
  padding: 0 8px;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  color: #334155;
  cursor: pointer;
  text-overflow: ellipsis;
}

.wc-share-url-btn {
  padding: 0 10px;
  height: 32px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #0f172a;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.wc-same-condition-box {
  margin: 16px 0 14px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  text-align: left;
}

.wc-same-condition-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.wc-same-condition-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 10px;
}

.wc-same-condition-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 100%;
}

/* ==========================================================================
   18. Mobile Viewport Optimization (<= 640px & <= 768px)
   ========================================================================== */
@media (max-width: 640px) {
  .adsense-slot-top {
    display: none !important;
  }

  .brand-title {
    font-size: 1.12rem;
    margin: 2px 0 4px;
    gap: 4px;
  }

  .brand-sub {
    font-size: 0.82rem;
  }

  .search-input-wrapper {
    padding: 3px 5px 3px 12px;
    min-height: 40px;
  }

  .name-input {
    font-size: 0.9rem;
    padding: 4px 2px;
  }

  .search-btn {
    width: 34px;
    height: 34px;
  }

  .appraisal-card {
    padding: 12px;
  }

  .house-media-wrapper {
    max-width: 210px;
  }

  .house-title {
    font-size: 1.08rem;
  }

  .card-action-bar {
    flex-direction: column;
  }
}

/* Mobile Vertical Scrollable World Cup Layout (<= 768px) */
@media (max-width: 768px) {
  .mode-tabs {
    gap: 4px;
    padding: 4px;
  }

  .mode-tab-btn {
    padding: 6px 9px;
    font-size: 0.76rem;
  }

  .wc-same-condition-bar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
  }

  .wc-same-condition-bar .wc-share-url-input {
    width: 100%;
    flex: 1 1 100%;
  }

  .wc-same-condition-bar .wc-share-url-btn {
    width: 100%;
  }

  .wc-same-condition-input-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .wc-same-condition-input-row .wc-share-url-btn {
    width: 100%;
    height: 36px;
  }

  .wc-arena {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .wc-vs-divider {
    margin: -4px 0;
  }

  .wc-vs-badge {
    width: 42px;
    height: 42px;
    font-size: 0.88rem;
  }

  .wc-round-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wc-champion-actions {
    grid-template-columns: 1fr;
  }
}

/* Hide fixed bottom dock in favor of inline-step-nav-bar */
.explorer-dock { display: none !important; }


/* Fix Korean heading wrapping in 3-column guide cards */
.guide-card-header h3 {
  word-break: keep-all !important;
  overflow-wrap: break-word !important;
  font-size: 1rem !important;
  line-height: 1.35 !important;
}


/* === TellMyName Unified Clean Header & Mobile Zero-Overflow Polish === */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
.top-util-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.3rem 0.75rem 0;
  min-height: 32px;
}
.mode-tabs {
  flex-wrap: nowrap !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  justify-content: flex-start;
  max-width: 100%;
  padding-bottom: 2px;
}
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tab-btn {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  border-radius: 999px !important;
}
@media (min-width: 640px) {
  .mode-tabs { justify-content: center; }
}
.sample-chips {
  -webkit-mask-image: linear-gradient(to right, #000 88%, transparent 100%);
  mask-image: linear-gradient(to right, #000 88%, transparent 100%);
  padding-right: 20px;
}


/* Prevent button orphan character wrap & tighten mobile mode tabs */
.btn-share-primary,
.share-btn-primary,
#btn-open-share-modal,
.card-action-btn {
  white-space: nowrap !important;
}
@media (max-width: 480px) {
  .mode-tabs {
    gap: 0.3rem !important;
    padding: 0.25rem 0.25rem !important;
  }
  .mode-tab-btn {
    font-size: 0.70rem !important;
    padding: 0.35rem 0.45rem !important;
    gap: 0.25rem !important;
  }
}
