/* SASUKE sitewide visual system. Visual-only overrides; page structure and behavior remain owned by each template. */
:root {
  color-scheme: dark;
  --bg: #05020b;
  --surface: rgba(16, 9, 27, .74);
  --surface-2: rgba(25, 14, 39, .82);
  --border: rgba(192, 132, 252, .16);
  --border-2: rgba(216, 180, 254, .28);
  --text: #f7f2ff;
  --text-muted: #c1b6d2;
  --text-dim: #8d829f;
  --purple: #8b5cf6;
  --purple-2: #c084fc;
  --violet: #7c3aed;
  --cyan: #c084fc;
  --pink: #ec4899;
  --grad-brand: linear-gradient(120deg, #8b5cf6 0%, #c026d3 52%, #ec4899 100%);
}
html { background: #05020b; }
body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse 58% 30% at 50% -12%, rgba(124, 58, 237, .14), transparent 75%),
    radial-gradient(ellipse 38% 28% at 92% 82%, rgba(190, 24, 93, .055), transparent 78%),
    linear-gradient(180deg, #080510 0%, #05020b 58%, #030208 100%) !important;
}
.bg-layer {
  background:
    radial-gradient(ellipse 80% 54% at 50% 0%, rgba(91, 33, 182, .14), transparent 72%),
    radial-gradient(ellipse 48% 42% at 88% 92%, rgba(157, 23, 77, .06), transparent 74%),
    linear-gradient(180deg, #080510 0%, #05020b 58%, #030208 100%) !important;
}
.bg-orb-1 { background: radial-gradient(circle, rgba(139, 92, 246, .16), transparent 70%) !important; }
.bg-orb-2 { background: radial-gradient(circle, rgba(236, 72, 153, .10), transparent 72%) !important; }
.bg-orb-3 { background: radial-gradient(circle, rgba(124, 58, 237, .08), transparent 72%) !important; }
.navbar {
  background: rgba(5, 2, 11, .78) !important;
  border-bottom-color: rgba(192, 132, 252, .14) !important;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .18);
}
.navbar.scrolled { background: rgba(5, 2, 11, .93) !important; }
.nav-logo {
  background: linear-gradient(120deg, #d8b4fe 0%, #c084fc 44%, #f472b6 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
}
.nav-link { color: rgba(232, 222, 247, .72); }
.nav-link:hover,
.nav-link:focus-visible { color: #fff; background: rgba(139, 92, 246, .13); }
.nav-link.active { color: #f7eaff; background: rgba(139, 92, 246, .18); }
.lang-switcher,
.language-switcher,
.language-selector,
.lang-selector {
  background: rgba(13, 8, 22, .78);
  border-color: rgba(192, 132, 252, .18);
}
.lang-btn.active,
.language-btn.active,
.lang-button.active {
  color: #fff;
  background: rgba(139, 92, 246, .24);
  box-shadow: inset 0 0 0 1px rgba(216, 180, 254, .14);
}
.glass-card,
.glass-panel,
.card,
.panel,
.tool-card,
.feature-card,
.result-card,
.quiz-card,
.assessment-card,
.bf-model-card,
.bf-test-shell,
.bf-article,
.bf-trait-detail,
.fs-card {
  color: var(--text);
  background: linear-gradient(145deg, rgba(22, 12, 37, .82), rgba(9, 6, 17, .76));
  border-color: rgba(192, 132, 252, .17);
  box-shadow: 0 20px 64px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .035);
}
main h1,
.page-title,
.main-title,
.page-header h1,
.hero h1,
.bf-hero h1 {
  background-image: linear-gradient(120deg, #fff 0%, #d8b4fe 45%, #f472b6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.btn-primary,
.primary-btn,
.primary-button,
.btn-gradient,
.bf-primary,
.fs-primary,
.submit-btn,
.start-btn,
.action-primary {
  color: #fff;
  background: linear-gradient(120deg, #7c3aed 0%, #c026d3 54%, #db2777 100%);
  border-color: rgba(216, 180, 254, .34);
  box-shadow: 0 10px 30px rgba(124, 58, 237, .19);
  transition: border-color .22s ease, box-shadow .22s ease, filter .22s ease;
}
.btn-primary:hover,
.primary-btn:hover,
.primary-button:hover,
.btn-gradient:hover,
.bf-primary:hover,
.fs-primary:hover,
.submit-btn:hover,
.start-btn:hover,
.action-primary:hover {
  filter: brightness(1.08);
  border-color: rgba(244, 114, 182, .48);
  box-shadow: 0 12px 34px rgba(168, 85, 247, .24);
}
.btn-secondary,
.secondary-btn,
.secondary-button,
.bf-secondary,
.btn-back,
.back-button {
  color: #efe7fa;
  background: rgba(18, 11, 29, .72);
  border-color: rgba(192, 132, 252, .21);
}
input,
select,
textarea { color: var(--text); accent-color: #a855f7; }
:focus-visible { outline: 2px solid rgba(216, 180, 254, .82); outline-offset: 3px; }
::selection { color: #fff; background: rgba(168, 85, 247, .42); }
@media (prefers-reduced-motion: reduce) {
  html, *, *::before, *::after { scroll-behavior: auto !important; }
}

/* ── V2: page-family polish for the existing Sasuke visual system ── */
:root {
  --sasuke-ink: #080510;
  --sasuke-panel: rgba(18, 12, 30, .90);
  --sasuke-panel-raised: rgba(27, 18, 42, .94);
  --sasuke-line: rgba(192, 132, 252, .24);
  --sasuke-line-strong: rgba(216, 180, 254, .40);
  --sasuke-glow: rgba(139, 92, 246, .20);
  --sasuke-pink-glow: rgba(236, 72, 153, .12);
}
body {
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body :is(.psych-hero, .lib-hero, .mbti-hero, .bf-hero, .game-header, .header-section) {
  position: relative;
  isolation: isolate;
}
body :is(.psych-hero, .lib-hero, .mbti-hero, .bf-hero, .game-header, .header-section)::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -2rem 8% auto;
  height: clamp(8rem, 24vw, 17rem);
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, rgba(124, 58, 237, .10), transparent 72%);
}
body :is(.psych-hero-title, .lib-hero-title, .mbti-page-title, .bf-hero h1, .main-title, .game-title) {
  text-wrap: balance;
  line-height: 1.2;
}
body :is(.psych-hero-sub, .lib-hero-sub, .mbti-page-subtitle, .subtitle, .bf-hero p) {
  color: var(--text-muted);
  line-height: 1.75;
  text-wrap: pretty;
}

/* Category cards, article panels, quiz surfaces, and game lobby surfaces */
body :is(
  .test-card, .game-card, .info-card, .lib-card, .lib-illus-card,
  .mbti-glass-card, .mbti-card, .mbti-gallery-card, .mbti-illus-panel,
  .bf-model-card, .bf-article, .bf-trait-detail, .question-card,
  .quiz-glass-card, .feature-info, .main-section-card, .player-card,
  .tool-card, .feature-card, .assessment-card, .result-card,
  .glass-card, .glass-panel, .panel, .card
) {
  min-width: 0;
  color: var(--text);
  border: 1px solid var(--sasuke-line);
  background:
    radial-gradient(ellipse at 100% 0%, rgba(139, 92, 246, .09), transparent 48%),
    linear-gradient(145deg, rgba(25, 17, 40, .94), rgba(10, 8, 18, .92));
  box-shadow: 0 18px 48px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .045);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
body :is(.test-card, .game-card, .info-card, .lib-card, .mbti-gallery-card,
       .bf-model-card, .bf-article, .bf-trait-detail, .main-section-card,
       .feature-card, .tool-card) {
  border-radius: 1.15rem;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease, background-color .22s ease;
}
body :is(.test-card, .game-card, .info-card, .lib-card, .mbti-gallery-card,
       .bf-model-card, .bf-article, .bf-trait-detail, .main-section-card,
       .feature-card, .tool-card):hover,
body :is(.test-card, .game-card, .info-card, .lib-card, .mbti-gallery-card,
       .bf-model-card, .bf-article, .bf-trait-detail, .main-section-card,
       .feature-card, .tool-card):focus-within {
  border-color: var(--sasuke-line-strong);
  box-shadow: 0 22px 54px rgba(0, 0, 0, .30), 0 0 28px var(--sasuke-glow), inset 0 1px 0 rgba(255, 255, 255, .06);
  transform: translateY(-2px);
}
body :is(.test-card-name, .lib-card-header, .mbti-section-title, .section-title, .question-text, .bf-trait-detail h2) {
  color: #f6efff;
  text-wrap: balance;
}
body :is(.test-card-desc, .lib-card p, .info-card p, .game-card p, .feature-info p, .mbti-gallery-sentence) {
  color: var(--text-muted);
  line-height: 1.7;
}
body :is(.test-card-cat, .lib-card-icon-sm, .feature-tag, .mlb-chip) {
  color: #d8b4fe;
}
.test-card-top,
.game-icon-lg,
.lib-hero-icon-wrap,
.feature-icon {
  box-shadow: 0 0 24px rgba(139, 92, 246, .14), inset 0 1px 0 rgba(255, 255, 255, .08);
}
body :is(.psych-section, .lib-related-section, .info-section, .tests-section, .tools-section, .games-section) {
  border-color: rgba(192, 132, 252, .18);
}

/* Shared action hierarchy while preserving each page's own purpose */
body :is(.btn-start-test, .btn-start-purple, .btn-start-cyan, .btn-start-pink,
       .btn-start-amber, .btn-start-orange, .mbti-btn-primary, .bf-primary,
       .quiz-btn-submit, .btn-spam, .btn-primary, .primary-btn, .primary-button,
       .btn-gradient, .start-btn, .action-primary) {
  color: #fff;
  border: 1px solid rgba(216, 180, 254, .34);
  border-radius: .85rem;
  background: linear-gradient(120deg, #7545dc 0%, #a442dc 52%, #d348a0 100%);
  box-shadow: 0 8px 24px rgba(124, 58, 237, .20), inset 0 1px 0 rgba(255, 255, 255, .12);
  font-weight: 650;
  transition: transform .2s ease, filter .2s ease, box-shadow .2s ease, border-color .2s ease;
}
body :is(.btn-start-test, .btn-start-purple, .btn-start-cyan, .btn-start-pink,
       .btn-start-amber, .btn-start-orange, .mbti-btn-primary, .bf-primary,
       .quiz-btn-submit, .btn-spam, .btn-primary, .primary-btn, .primary-button,
       .btn-gradient, .start-btn, .action-primary):hover {
  filter: brightness(1.08);
  border-color: rgba(244, 114, 182, .52);
  box-shadow: 0 12px 30px rgba(168, 85, 247, .25), inset 0 1px 0 rgba(255, 255, 255, .16);
  transform: translateY(-1px);
}
body :is(.btn-learn-more, .mbti-btn-secondary, .bf-secondary, .btn-secondary,
       .secondary-btn, .secondary-button, .btn-glass, .btn-back, .back-button,
       .btn-copy, .quiz-back-btn, .quiz-lang-button) {
  color: #efe7fa;
  border-color: rgba(192, 132, 252, .28);
  background: linear-gradient(145deg, rgba(27, 18, 42, .84), rgba(12, 9, 21, .82));
}
body :is(.filter-btn, .size-btn, .option-btn, .quiz-lang-button, .lang-btn) {
  border-color: rgba(192, 132, 252, .24);
  transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
body :is(.filter-btn, .size-btn, .option-btn, .quiz-lang-button, .lang-btn).active,
body :is(.filter-btn, .size-btn, .option-btn, .quiz-lang-button, .lang-btn)[aria-pressed="true"] {
  color: #fff;
  border-color: rgba(216, 180, 254, .48);
  background: rgba(139, 92, 246, .27);
  box-shadow: 0 0 20px rgba(139, 92, 246, .14), inset 0 1px 0 rgba(255, 255, 255, .08);
}
body :is(button, [role="button"], a.btn, input[type="submit"], input[type="button"]):focus-visible {
  outline: 2px solid rgba(216, 180, 254, .92);
  outline-offset: 3px;
}

/* Forms and assessment controls: readable at rest, clear on focus */
body :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea,
       .form-control, .field-select, .glass-input, .psych-search-input) {
  max-width: 100%;
  color: #fbf8ff;
  border-color: rgba(192, 132, 252, .24);
  background-color: rgba(18, 13, 29, .86);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .20);
}
body :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea,
       .form-control, .field-select, .glass-input, .psych-search-input)::placeholder {
  color: #aa9dbb;
  opacity: 1;
}
body :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea,
       .form-control, .field-select, .glass-input, .psych-search-input):focus {
  color: #fff;
  border-color: rgba(192, 132, 252, .62);
  background-color: rgba(21, 15, 34, .96);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .16);
}
body :is(.field-label, .form-label, label, .player-label) { color: #e8def7; }
body :is(.answer-option, .option-label, .option-group, .ar-card) {
  color: #f5efff;
  border-color: rgba(192, 132, 252, .22);
  background-color: rgba(18, 13, 29, .76);
}
body :is(.answer-option, .option-label, .option-group):hover,
body :is(.answer-option, .option-label, .option-group):focus-within {
  border-color: rgba(216, 180, 254, .46);
  background-color: rgba(36, 22, 55, .88);
}
body :is(.progress, .progress-track, .progress-bar) { border-radius: 999px; }
body :is(.progress-fill) { background: linear-gradient(90deg, #8052e8, #d34aa3); }

/* Reading surfaces, results, modal layers, and compact system/error pages */
body :is(.lib-content, .lib-article-body, .bf-main, .mbti-preview-outer) { color: var(--text); }
body :is(.lib-card-alert, .ar-tip-dot) { border-color: rgba(244, 114, 182, .24); }
body :is(.modal-content, .modal-dialog, .psych-modal, .modal, .mbti-preview-outer) {
  color: var(--text);
  border-color: rgba(192, 132, 252, .28);
  background: linear-gradient(145deg, rgba(24, 16, 39, .98), rgba(8, 6, 16, .98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, .55), 0 0 44px rgba(139, 92, 246, .12);
}
.notfound-card,
.container:has(> .social-icons),
body > main:has(#unavailable-title) {
  color: var(--text);
  border: 1px solid var(--sasuke-line);
  border-radius: 1.4rem;
  background: linear-gradient(145deg, rgba(24, 16, 39, .94), rgba(8, 6, 16, .92));
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35), 0 0 40px rgba(139, 92, 246, .12);
}
.container:has(> .social-icons) { max-width: 42rem; padding: clamp(1.5rem, 5vw, 3rem); }
.social-icons { display: flex; flex-wrap: wrap; justify-content: center; gap: .85rem; }
.social-icons .icon { width: 3.25rem; height: 3.25rem; object-fit: contain; border-radius: .9rem; transition: transform .2s ease, filter .2s ease; }
.social-icons a:hover .icon, .social-icons a:focus-visible .icon { transform: translateY(-2px); filter: drop-shadow(0 0 12px rgba(192, 132, 252, .44)); }
body > main:has(#unavailable-title) { width: min(100% - 2rem, 42rem); margin: clamp(4rem, 12vh, 8rem) auto 2rem; padding: clamp(1.5rem, 5vw, 3rem); }
body > main:has(#unavailable-title) a { color: #e9d5ff; text-decoration-color: rgba(216, 180, 254, .5); }

/* Stable small-screen rhythm across tool forms, quizzes, articles, and games */
body :is(.test-card, .game-card, .info-card, .lib-card, .mbti-glass-card,
       .question-card, .quiz-glass-card, .feature-info, .player-card) { overflow-wrap: anywhere; }
body :is(.psych-grid, .info-grid, .games-grid, .tests-grid, .tools-grid,
       .lib-related-grid, .mbti-illustrations, .bf-trait-grid) > * { min-width: 0; }
@media (max-width: 768px) {
  body :is(.psych-hero, .lib-hero, .mbti-hero, .bf-hero, .game-header, .header-section) { padding-inline: 1rem; }
  body :is(.psych-hero-title, .lib-hero-title, .mbti-page-title, .main-title, .game-title) { font-size: clamp(1.75rem, 8vw, 2.65rem); }
  body :is(.psych-grid, .info-grid, .games-grid, .tests-grid, .tools-grid,
         .lib-related-grid, .bf-trait-grid) { grid-template-columns: minmax(0, 1fr); }
  body :is(.mbti-landing-actions, .bf-actions, .button-group, .btn-group) { flex-wrap: wrap; }
  body :is(.mbti-landing-actions, .bf-actions) > * { min-width: min(100%, 13rem); }
  body :is(.test-card, .game-card, .info-card, .lib-card, .question-card, .quiz-glass-card) { border-radius: 1rem; }
  body :is(.container, .lib-content, .bf-main, .mbti-container) { max-width: 100%; }
  body :is(img, video, canvas, iframe) { max-width: 100%; }
  table { display: block; max-width: 100%; overflow-x: auto; }
}
@media (max-width: 480px) {
  body :is(.navbar, .nav-inner) { min-height: 3.8rem; }
  body :is(.nav-logo) { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
  body :is(.lang-switcher, .language-switcher) { gap: .15rem; }
  body :is(.lang-btn, .language-btn, .lang-button) { min-width: 2.35rem; min-height: 2.35rem; padding-inline: .45rem; }
  body :is(.btn-start-test, .btn-learn-more, .quiz-btn-submit, .mbti-btn-primary, .bf-primary) { max-width: 100%; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
