/* =========================================================
   TATAWIKI SPATIAL GLASS STUDIO 3.0
   Soft Minimalism × Apple VisionOS Liquid Glassmorphism
   ========================================================= */
:root {
  --bg-canvas: #F4F6FB;
  --surface-secondary: #FFFFFF;
  --surface-subtle: #F1F5F9;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #64748B;
  --text-disabled: #94A3B8;
  --border-subtle: #E2E8F0;

  --accent-primary: #4F46E5;
  --accent-hover: #4338CA;
  --accent-active: #3730A3;
  --accent-soft: #EEF2FF;

  --semantic-success: #16A34A;
  --semantic-warning: #D97706;
  --semantic-error: #DC2626;
  --semantic-info: #0284C7;

  --ease-spatial: cubic-bezier(0.16, 1, 0.3, 1);
}

body {
  font-family: "Be Vietnam Pro", "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

button,
a,
input,
select,
summary,
[role="button"],
.nav-pill,
.sub-pill,
.mob-nav-btn,
.tactile-item {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.6;
}

h1, h2, h3, h4 {
  letter-spacing: -0.02em;
  line-height: 1.25;
}

/* =========================================================
   AMBIENT PASTEL MESH ATMOSPHERE
   ========================================================= */
.ambient-orb-static {
  position: absolute;
  border-radius: 9999px;
  pointer-events: none;
}

.orb-sky {
  top: -140px;
  left: -60px;
  width: 880px;
  height: 800px;
  background: radial-gradient(circle, rgba(147, 197, 253, 0.56) 0%, rgba(224, 242, 254, 0) 68%);
}

.orb-lavender {
  top: -80px;
  right: -120px;
  width: 840px;
  height: 820px;
  background: radial-gradient(circle, rgba(196, 181, 253, 0.58) 0%, rgba(243, 232, 255, 0) 68%);
}

.orb-peach {
  bottom: -200px;
  left: 28%;
  width: 820px;
  height: 760px;
  background: radial-gradient(circle, rgba(253, 224, 195, 0.68) 0%, rgba(255, 237, 213, 0) 70%);
}

.orb-mint {
  top: 42%;
  left: 8%;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, rgba(167, 243, 208, 0.36) 0%, rgba(167, 243, 208, 0) 70%);
}

/* =========================================================
   SPATIAL LIQUID GLASS SHELL (SIDEBAR DOCK + COMMAND HEADER)
   ========================================================= */
.spatial-dock {
  border-radius: 28px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.56) 0%, rgba(255, 255, 255, 0.28) 100%);
  backdrop-filter: blur(22px) saturate(210%);
  -webkit-backdrop-filter: blur(22px) saturate(210%);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    0 20px 48px -12px rgba(15, 23, 42, 0.09),
    0 4px 16px -2px rgba(79, 70, 229, 0.06),
    inset 0 1.5px 1.5px rgba(255, 255, 255, 0.95),
    inset 0 -1px 1.5px rgba(148, 163, 184, 0.18);
}

.spatial-topbar,
.glass-pill {
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.18) 100%);
  backdrop-filter: blur(18px) saturate(210%);
  -webkit-backdrop-filter: blur(18px) saturate(210%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow:
    0 12px 32px -8px rgba(15, 23, 42, 0.08),
    0 2px 10px -2px rgba(79, 70, 229, 0.06),
    inset 0 1.5px 1px rgba(255, 255, 255, 0.92);
}

.mobile-glass-dock {
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.68) 100%);
  backdrop-filter: blur(20px) saturate(200%);
  -webkit-backdrop-filter: blur(20px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 16px 38px -6px rgba(15, 23, 42, 0.16),
    inset 0 1px 1px rgba(255, 255, 255, 0.95);
}

header .soft-input {
  background: rgba(255, 255, 255, 0.56);
  border-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
header .soft-input:focus-visible {
  background: rgba(255, 255, 255, 0.92);
}

/* Liquid Glass Navigation & Segmented Bars */
.liquid-bar {
  position: relative;
}

.liquid-thumb {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
  border-radius: 14px;
  transition:
    transform 380ms cubic-bezier(0.32, 1.12, 0.46, 1),
    width 340ms cubic-bezier(0.32, 1.08, 0.46, 1),
    height 320ms cubic-bezier(0.32, 1.08, 0.46, 1),
    opacity 200ms ease;
  will-change: transform, width, height;
}

.liquid-thumb--primary {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.94) 0%, rgba(99, 102, 241, 0.86) 100%);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow:
    0 8px 20px -4px rgba(79, 70, 229, 0.42),
    inset 0 1px 1.5px rgba(255, 255, 255, 0.55);
}

.liquid-thumb--glass {
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.84) 100%);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 4px 14px -2px rgba(15, 23, 42, 0.08),
    0 1px 3px rgba(79, 70, 229, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 1);
}

.nav-pill {
  position: relative;
  z-index: 1;
  min-height: 42px;
  padding: 8px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  transition: color 220ms var(--ease-spatial), transform 260ms cubic-bezier(0.32, 1.18, 0.48, 1), background-color 200ms ease;
}

.nav-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.52);
}

.nav-pill.active {
  color: #FFFFFF;
  background: var(--accent-primary);
  box-shadow: 0 6px 16px -4px rgba(79, 70, 229, 0.4);
}
.liquid-bar.liquid-ready .nav-pill.active {
  background: transparent;
  box-shadow: none;
}
.liquid-bar.liquid-ready .nav-pill.active:hover {
  background: transparent;
  color: #FFFFFF;
}

/* Mobile bottom dock nav button */
.mob-nav-btn {
  flex: 1 1 0%;
  min-width: 0;
  padding: 6px 2px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 200ms var(--ease-spatial);
}
.mob-nav-btn.active {
  color: var(--accent-primary);
  background: rgba(238, 242, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.22);
}

.nav-pill:active,
.sub-pill:active,
.liquid-tap:active,
#elementPillsBar button:active,
#careerPillsBar button:active,
#boardElemPills button:active,
#calcStagePills button:active {
  transform: scale(0.95);
}

#elementPillsBar button,
#careerPillsBar button,
#boardElemPills button,
#calcStagePills button {
  transition: transform 260ms cubic-bezier(0.32, 1.18, 0.48, 1), background-color 200ms ease, color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.nav-pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-primary);
}

/* Level 2: Primary Frosted Glass Panels (24px radius, Pure Soft Glassmorphism) */
.glass-panel {
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.80) 0%, rgba(255, 255, 255, 0.62) 100%);
  backdrop-filter: blur(16px) saturate(175%);
  -webkit-backdrop-filter: blur(16px) saturate(175%);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    0 14px 34px -8px rgba(15, 23, 42, 0.055),
    0 4px 12px -2px rgba(79, 70, 229, 0.025),
    inset 0 1.5px 1px rgba(255, 255, 255, 0.95);
  transition: transform 240ms var(--ease-spatial), border-color 240ms var(--ease-spatial), box-shadow 240ms var(--ease-spatial), background-color 240ms var(--ease-spatial);
}

.glass-card-hover:hover {
  transform: translateY(-3px);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.82) 100%);
  border-color: rgba(255, 255, 255, 1);
  box-shadow:
    0 20px 42px -8px rgba(15, 23, 42, 0.08),
    0 8px 16px -4px rgba(79, 70, 229, 0.05),
    inset 0 1px 1px rgba(255, 255, 255, 1);
}

/* Nested Soft Glass Widgets (16px radius) */
.nested-widget {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(226, 232, 240, 0.88);
  box-shadow:
    0 2px 8px -2px rgba(15, 23, 42, 0.025),
    inset 0 1px 1px rgba(255, 255, 255, 0.92);
  transition: background-color 200ms var(--ease-spatial), border-color 200ms var(--ease-spatial), box-shadow 200ms var(--ease-spatial);
}

/* Segmented Controls — iOS 27 Liquid Glass Well */
.sub-pills {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(241, 245, 249, 0.68);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.045);
}

/* Vertical Chapter Menu for Wiki on Desktop */
@media (min-width: 1024px) {
  .bento-fixed-row {
    height: 452px !important;
    min-height: 452px !important;
    max-height: 452px !important;
  }
  .bento-fixed-cell {
    height: 452px !important;
    min-height: 452px !important;
    max-height: 452px !important;
    overflow: hidden;
  }
  .wiki-sticky-sidebar {
    position: sticky;
    top: 84px;
    align-self: start;
    max-height: calc(100vh - 104px);
    overflow-y: auto;
  }
  .wiki-vertical-pills {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 5px;
    border-radius: 18px;
  }
  .wiki-vertical-pills .sub-pill {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    padding: 8px 11px;
    font-size: 12.5px;
    line-height: 1.35;
  }
}

@media (min-width: 1280px) {
  .wish-fixed-box {
    height: 616px !important;
    min-height: 616px !important;
    max-height: 616px !important;
    overflow: hidden;
  }
}

/* Mobile GPU & Touch Responsiveness Optimization (<1024px) */
@media (max-width: 1023px) {
  .glass-panel {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.86) 100%);
  }
  .sub-pills {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(241, 245, 249, 0.92);
  }
  .spatial-topbar,
  .mobile-glass-dock {
    backdrop-filter: blur(8px) saturate(160%);
    -webkit-backdrop-filter: blur(8px) saturate(160%);
  }
  header .soft-input {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.9);
  }
}

.sub-pill {
  position: relative;
  z-index: 1;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 220ms var(--ease-spatial), transform 260ms cubic-bezier(0.32, 1.18, 0.48, 1), background-color 200ms ease;
}

.sub-pill:hover {
  color: var(--text-primary);
}

.sub-pill.active {
  color: var(--accent-primary);
  background: var(--surface-secondary);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}
.sub-pills.liquid-ready .sub-pill.active {
  background: transparent;
  box-shadow: none;
}

.liquid-tap {
  transition: transform 260ms cubic-bezier(0.32, 1.18, 0.48, 1), background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}

/* =========================================================
   SKILL EVOLUTION DIFF HIGHLIGHTING (T1 -> T2 -> T3 -> T4)
   ========================================================= */
mark.skill-diff-mark {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.18) 0%, rgba(79, 70, 229, 0.16) 100%);
  color: #065F46;
  border-bottom: 2px solid rgba(16, 185, 129, 0.58);
  border-radius: 6px;
  padding: 1px 5px;
  font-weight: 700;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

mark.skill-diff-num {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, #FEF3C7 0%, #FFEDD5 100%);
  color: #B45309;
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 9999px;
  padding: 0 7px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.skill-diff-prev {
  font-weight: 600;
  opacity: 0.72;
  font-size: 0.9em;
}

.skill-meta-new {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.95), rgba(209, 250, 229, 0.85));
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-weight: 700;
}

.skill-meta-up {
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.95), rgba(254, 243, 199, 0.85));
  color: #B45309;
  border: 1px solid rgba(245, 158, 11, 0.45);
  font-weight: 700;
}

/* Buttons & Inputs */
.btn-primary {
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 13px;
  font-size: 13.5px;
  font-weight: 600;
  color: #FFFFFF;
  background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  box-shadow: 0 8px 20px -4px rgba(79, 70, 229, 0.35);
  transition: transform 220ms var(--ease-spatial), filter 220ms ease, box-shadow 220ms var(--ease-spatial);
}
.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -4px rgba(79, 70, 229, 0.45);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.04);
  transition: transform 220ms var(--ease-spatial), background-color 220ms var(--ease-spatial), border-color 220ms var(--ease-spatial);
}
.btn-secondary:hover {
  background: var(--surface-secondary);
  border-color: #CBD5E1;
  transform: translateY(-2px);
}
.btn-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.soft-input,
.soft-select {
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  padding: 0 14px;
  outline: none;
  transition: border-color 200ms var(--ease-spatial), box-shadow 200ms var(--ease-spatial), background-color 200ms var(--ease-spatial);
}
.soft-input:focus-visible,
.soft-select:focus-visible {
  border-color: var(--accent-primary);
  background: var(--surface-secondary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Page Routing & Pure GPU Compositor Transitions */
.page-view { display: none; }
.page-view.active {
  display: block;
  animation: iosPageIn 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes iosPageIn {
  0% {
    opacity: 0;
    transform: translate3d(0, 8px, 0) scale(0.992);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* Interactive Leaderboard Matrix */
.lb-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.lb-table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
}
.lb-th-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 160ms ease, background-color 160ms ease;
}
.lb-th-btn:hover {
  color: var(--accent-primary);
  background: rgba(79, 70, 229, 0.07);
}
.lb-th-btn.is-sorted {
  color: var(--accent-primary);
  background: var(--accent-soft);
}
.lb-row {
  transition: background-color 150ms ease;
}
.lb-row:hover {
  background-color: rgba(238, 242, 255, 0.55);
}
.lb-row.is-selected {
  background-color: rgba(238, 242, 255, 0.9);
}

@keyframes iosSubIn {
  0% { opacity: 0; transform: scale(0.99) translateY(6px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.ios-sub-enter {
  animation: iosSubIn 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes spotlightSwap {
  0% { opacity: 0; transform: translateY(8px) scale(0.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.spotlight-animate {
  animation: spotlightSwap 360ms var(--ease-spatial) both;
}

@keyframes spotlightBar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.spotlight-progress-fill {
  transform-origin: left center;
  animation: spotlightBar 5.5s linear infinite;
}
.spotlight-paused .spotlight-progress-fill {
  animation-play-state: paused;
}

@keyframes disclosureOpen {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.disclosure-body {
  animation: disclosureOpen 200ms var(--ease-spatial) both;
}
.chevron-rot {
  transition: transform 220ms var(--ease-spatial);
}
.is-open .chevron-rot {
  transform: rotate(180deg);
}

.tactile-item {
  transition: transform 180ms var(--ease-spatial), box-shadow 180ms var(--ease-spatial), border-color 180ms var(--ease-spatial), background-color 180ms var(--ease-spatial);
}
.tactile-item:hover {
  transform: translateY(-2px);
}
.tactile-item:active {
  transform: scale(0.985);
}

.soft-tab-badge {
  transition: background-color 180ms var(--ease-spatial), color 180ms var(--ease-spatial), transform 160ms var(--ease-spatial);
}
.soft-tab-badge:active {
  transform: scale(0.96);
}

@keyframes zoomModalPop {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-pop {
  animation: zoomModalPop 220ms var(--ease-spatial) both;
}

.soft-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.soft-scroll::-webkit-scrollbar-track { background: transparent; }
.soft-scroll::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.42); border-radius: 9999px; }
.soft-scroll::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.65); }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  transition-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
}
