/* ============================================================================
   YAMSEKAI — Neo-Tokyo Prism Design System & 3-Column Social Shell
   Palette: Deep Midnight Indigo (#070914) · Electric Violet (#7c5cff)
            Neon Cyan (#22d3ee) · Sakura Coral (#ff4d8d)
   ============================================================================ */

:root,
html[data-ya-theme="prism"],
body[data-ya-theme="prism"] {
  --ys-bg: #070914;
  --ys-bg-elev: #0d1126;
  --ys-surface: rgba(15, 20, 44, 0.74);
  --ys-surface-solid: #10152e;
  --ys-surface-hover: rgba(24, 32, 68, 0.86);
  --ys-glass: rgba(9, 12, 28, 0.78);
  --ys-border: rgba(148, 163, 255, 0.14);
  --ys-border-strong: rgba(124, 92, 255, 0.42);
  --ys-text: #f1f5ff;
  --ys-text-soft: #b8c2e0;
  --ys-muted: #7f8bb3;
  --ys-violet: #7c5cff;
  --ys-cyan: #22d3ee;
  --ys-sakura: #ff4d8d;
  --ys-grad-prism: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
  --ys-grad-sakura: linear-gradient(135deg, #7c5cff 0%, #ff4d8d 100%);
  --ys-grad-word: linear-gradient(135deg, #22d3ee 0%, #8b5cf6 52%, #ff4d8d 100%);
  --ys-shadow-card: 0 12px 34px rgba(3, 5, 16, 0.48);
  --ys-shadow-glow: 0 8px 26px rgba(124, 92, 255, 0.34);
  --ys-rail-w: 252px;
  --ys-topbar-h: 64px;
  --ys-radius: 18px;
  --ys-radius-lg: 22px;
  --ys-font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ys-font-display: 'Space Grotesk', 'Plus Jakarta Sans', system-ui, sans-serif;

  /* Map legacy CSS variables seamlessly to Neo-Tokyo Prism */
  --bg: #070914;
  --surface: #0f142c;
  --card: rgba(15, 20, 44, 0.78);
  --panel: #10152e;
  --text: #f1f5ff;
  --ink: #f1f5ff;
  --muted: #8b97bf;
  --border: rgba(148, 163, 255, 0.14);
  --line: rgba(148, 163, 255, 0.14);
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --primary: #7c5cff;
  --ya-accent: #7c5cff;
  --ya-accent-2: #22d3ee;
  --ya-bg: #070914;
  --ya-card: rgba(15, 20, 44, 0.78);
}

/* Neo-Tokyo Prism Daylight (Light Theme) */
html[data-ya-theme="prism-light"],
body[data-ya-theme="prism-light"] {
  --ys-bg: #f4f6fc;
  --ys-bg-elev: #ffffff;
  --ys-surface: rgba(255, 255, 255, 0.86);
  --ys-surface-solid: #ffffff;
  --ys-surface-hover: rgba(241, 244, 255, 0.96);
  --ys-glass: rgba(244, 246, 252, 0.84);
  --ys-border: rgba(79, 70, 229, 0.13);
  --ys-border-strong: rgba(109, 74, 255, 0.42);
  --ys-text: #0f1530;
  --ys-text-soft: #334066;
  --ys-muted: #5d688a;
  --ys-violet: #6d4aff;
  --ys-cyan: #0891b2;
  --ys-sakura: #e11d6b;
  --ys-shadow-card: 0 10px 30px rgba(15, 21, 48, 0.08);
  --ys-shadow-glow: 0 8px 22px rgba(109, 74, 255, 0.24);

  --bg: #f4f6fc;
  --surface: #ffffff;
  --card: #ffffff;
  --panel: #ffffff;
  --text: #0f1530;
  --ink: #0f1530;
  --muted: #5d688a;
  --border: rgba(79, 70, 229, 0.13);
  --line: rgba(79, 70, 229, 0.13);
  --accent: #6d4aff;
  --accent-2: #0891b2;
  --primary: #6d4aff;
  --ya-accent: #6d4aff;
  --ya-accent-2: #0891b2;
  --ya-bg: #f4f6fc;
  --ya-card: #ffffff;
}

/* Global Canvas & Ambient Prism Aurora */
html[data-ya-theme="prism"] body.ys-shell-body,
body.ys-shell-body[data-ya-theme="prism"] {
  background-color: var(--ys-bg) !important;
  background-image:
    radial-gradient(ellipse 68% 48% at 14% -8%, rgba(124, 92, 255, 0.22), transparent 62%),
    radial-gradient(ellipse 52% 42% at 88% 6%, rgba(34, 211, 238, 0.15), transparent 60%),
    radial-gradient(ellipse 46% 38% at 72% 96%, rgba(255, 77, 141, 0.12), transparent 64%) !important;
  background-attachment: fixed !important;
  color: var(--ys-text) !important;
}

html[data-ya-theme="prism-light"] body.ys-shell-body,
body.ys-shell-body[data-ya-theme="prism-light"] {
  background-color: var(--ys-bg) !important;
  background-image:
    radial-gradient(ellipse 65% 45% at 15% -5%, rgba(124, 92, 255, 0.12), transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 8%, rgba(34, 211, 238, 0.11), transparent 58%),
    radial-gradient(ellipse 42% 35% at 80% 95%, rgba(255, 77, 141, 0.08), transparent 60%) !important;
  background-attachment: fixed !important;
  color: var(--ys-text) !important;
}

body.ys-shell-body {
  font-family: var(--ys-font-sans) !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body.ys-shell-body h1,
body.ys-shell-body h2,
body.ys-shell-body h3,
.ys-rail-wordmark {
  font-family: var(--ys-font-display) !important;
  letter-spacing: -0.02em;
}

/* ============================================================================
   3-COLUMN SOCIAL APP SHELL
   ============================================================================ */

.ys-app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Admin Console uses its own sidebar */
body.yf-console-page .ys-left-rail {
  display: none !important;
}
body.yf-console-page .ys-app-stage {
  margin-left: 0 !important;
  width: 100% !important;
}

/* Fixed Left Navigation Rail */
.ys-left-rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--ys-rail-w);
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: var(--ys-glass);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-right: 1px solid var(--ys-border);
  padding: 16px 14px 18px;
  box-sizing: border-box;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 92, 255, 0.35) transparent;
}

.ys-rail-top {
  padding: 2px 6px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--ys-border);
}

.ys-rail-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ys-text) !important;
  transition: transform 0.18s ease;
}
.ys-rail-brand:hover {
  transform: translateX(2px);
}

.ys-rail-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.32);
}

.ys-rail-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
}

.ys-word-yam {
  color: var(--ys-text);
}

.ys-word-sekai,
.ya-word-kage {
  background: var(--ys-grad-word);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}

.ys-kanji-pill,
.ya-kanji-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 6px;
  margin-left: 5px;
  border-radius: 7px;
  background: rgba(124, 92, 255, 0.18) !important;
  border: 1px solid rgba(34, 211, 238, 0.38) !important;
  color: var(--ys-cyan) !important;
  line-height: 1;
}

/* Rail Navigation Groups */
.ys-rail-nav {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 0;
}

.ys-rail-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ys-rail-heading {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--ys-muted);
  padding: 4px 12px 4px;
}

.ys-rail-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 13px;
  text-decoration: none;
  color: var(--ys-text-soft) !important;
  font-size: 0.93rem;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
}

.ys-rail-link:hover {
  background: rgba(124, 92, 255, 0.12);
  color: var(--ys-text) !important;
  transform: translateX(2px);
}

.ys-rail-link[aria-current="page"] {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.24) 0%, rgba(34, 211, 238, 0.14) 100%);
  color: var(--ys-text) !important;
  border: 1px solid rgba(124, 92, 255, 0.36);
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.18);
}

.ys-rail-link[aria-current="page"]::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 22%;
  bottom: 22%;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: var(--ys-grad-prism);
}

.ys-rail-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.88;
}
.ys-rail-ico svg {
  width: 19px;
  height: 19px;
}
.ys-rail-link[aria-current="page"] .ys-rail-ico {
  color: var(--ys-cyan);
  opacity: 1;
}

.ys-rail-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ys-sakura);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(255, 77, 141, 0.45);
}

/* Rail Primary Broadcast CTA */
.ys-rail-cta {
  padding-top: 14px;
  margin-top: 8px;
  border-top: 1px solid var(--ys-border);
}

.ys-rail-broadcast-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--ys-grad-prism);
  color: #060916 !important;
  font-weight: 800;
  font-size: 0.93rem;
  text-decoration: none;
  box-shadow: var(--ys-shadow-glow);
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
  box-sizing: border-box;
}
.ys-rail-broadcast-btn svg {
  width: 17px;
  height: 17px;
}
.ys-rail-broadcast-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 12px 30px rgba(34, 211, 238, 0.34);
}

/* ============================================================================
   MAIN STAGE & SLIM TOP COMMAND BAR
   ============================================================================ */

.ys-app-stage {
  margin-left: var(--ys-rail-w);
  width: calc(100% - var(--ys-rail-w));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

header.ya-header-anime.ys-topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 80 !important;
  height: var(--ys-topbar-h) !important;
  min-height: var(--ys-topbar-h) !important;
  padding: 0 24px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  background: var(--ys-glass) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid var(--ys-border) !important;
  box-shadow: none !important;
}

.ys-topbar-left {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  flex: 1 1 auto !important;
  max-width: 520px !important;
}

.ys-mobile-brand {
  display: none !important;
}

.ys-command-search {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 460px !important;
  margin: 0 !important;
  background: var(--ys-surface) !important;
  border: 1px solid var(--ys-border) !important;
  border-radius: 999px !important;
  padding: 0 12px 0 14px !important;
  height: 40px !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease !important;
}

.ys-command-search:focus-within {
  border-color: var(--ys-cyan) !important;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16) !important;
  background: var(--ys-surface-solid) !important;
}

.ys-command-search input {
  width: 100% !important;
  background: transparent !important;
  border: 0 !important;
  outline: none !important;
  color: var(--ys-text) !important;
  font-size: 0.9rem !important;
  padding: 0 8px !important;
  height: 100% !important;
  box-shadow: none !important;
}
.ys-command-search input::placeholder {
  color: var(--ys-muted) !important;
}

.ys-search-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  font-family: var(--ys-font-display);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ys-muted);
  background: rgba(148, 163, 255, 0.1);
  border: 1px solid var(--ys-border);
  flex-shrink: 0;
}

.ys-topbar-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
}

/* Topbar Controls */
.ya-theme-trigger-btn,
.ya-radio-btn,
.ya-sound-toggle-btn,
.ya-nav-action-icon {
  background: var(--ys-surface) !important;
  border: 1px solid var(--ys-border) !important;
  color: var(--ys-text) !important;
  border-radius: 12px !important;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.14s ease !important;
}

.ya-theme-trigger-btn:hover,
.ya-radio-btn:hover,
.ya-sound-toggle-btn:hover,
.ya-nav-action-icon:hover {
  border-color: var(--ys-border-strong) !important;
  background: var(--ys-surface-hover) !important;
  transform: translateY(-1px);
}

.ya-nav-join-btn {
  background: var(--ys-grad-prism) !important;
  color: #060916 !important;
  font-weight: 800 !important;
  border: 0 !important;
  border-radius: 12px !important;
  padding: 8px 16px !important;
  box-shadow: var(--ys-shadow-glow) !important;
}

.ya-nav-auth-link {
  color: var(--ys-text) !important;
  border: 1px solid var(--ys-border) !important;
  border-radius: 12px !important;
  padding: 8px 14px !important;
  background: var(--ys-surface) !important;
}

/* ============================================================================
   MAIN CONTENT AREA & 3-COLUMN FEED STREAM
   ============================================================================ */

.ys-app-stage > main#main-content {
  width: 100% !important;
  max-width: 1180px !important;
  margin: 0 auto !important;
  padding: 24px 28px 48px !important;
  flex: 1 1 auto !important;
  box-sizing: border-box !important;
}

/* Desktop left rail replaces redundant top subnav pills */
@media (min-width: 981px) {
  .ya-subnav {
    display: none !important;
  }
}

/* Center Stream + Right Discovery Rail */
.ya-feed-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 336px !important;
  gap: 24px !important;
  align-items: start !important;
}

.ya-feed-sidebar {
  position: sticky !important;
  top: calc(var(--ys-topbar-h) + 20px) !important;
  gap: 16px !important;
}

/* ============================================================================
   NEO-TOKYO PRISM CARDS, COMPOSER, POSTS & BUTTONS
   ============================================================================ */

html[data-ya-theme="prism"] .nx-card,
html[data-ya-theme="prism"] .ya-composer-card,
html[data-ya-theme="prism"] .ya-post-card,
html[data-ya-theme="prism"] .ya-sidebar-card,
html[data-ya-theme="prism"] .ya-anime-card,
html[data-ya-theme="prism"] .ya-group-card,
html[data-ya-theme="prism"] .ya-person-card,
html[data-ya-theme="prism"] .yf-auth,
html[data-ya-theme="prism-light"] .nx-card,
html[data-ya-theme="prism-light"] .ya-composer-card,
html[data-ya-theme="prism-light"] .ya-post-card,
html[data-ya-theme="prism-light"] .ya-sidebar-card,
html[data-ya-theme="prism-light"] .ya-anime-card,
html[data-ya-theme="prism-light"] .ya-group-card,
html[data-ya-theme="prism-light"] .ya-person-card,
html[data-ya-theme="prism-light"] .yf-auth {
  background: var(--ys-surface) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--ys-border) !important;
  border-radius: var(--ys-radius) !important;
  box-shadow: var(--ys-shadow-card) !important;
  color: var(--ys-text) !important;
}

html[data-ya-theme="prism"] .ya-post-card:hover,
html[data-ya-theme="prism"] .ya-anime-card:hover,
html[data-ya-theme="prism"] .ya-group-card:hover,
html[data-ya-theme="prism-light"] .ya-post-card:hover,
html[data-ya-theme="prism-light"] .ya-anime-card:hover,
html[data-ya-theme="prism-light"] .ya-group-card:hover {
  border-color: var(--ys-border-strong) !important;
}

/* Primary Buttons in Prism Themes */
html[data-ya-theme="prism"] .button,
html[data-ya-theme="prism"] button.primary,
html[data-ya-theme="prism"] .ya-btn-primary,
html[data-ya-theme="prism-light"] .button,
html[data-ya-theme="prism-light"] button.primary,
html[data-ya-theme="prism-light"] .ya-btn-primary {
  background: var(--ys-grad-prism) !important;
  color: #060916 !important;
  font-weight: 800 !important;
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: var(--ys-shadow-glow) !important;
  transition: transform 0.16s ease, filter 0.16s ease !important;
}

html[data-ya-theme="prism"] .button:hover,
html[data-ya-theme="prism"] .ya-btn-primary:hover,
html[data-ya-theme="prism-light"] .button:hover,
html[data-ya-theme="prism-light"] .ya-btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.07);
}

/* Feed Tabs */
html[data-ya-theme="prism"] .ya-feed-tabs a,
html[data-ya-theme="prism-light"] .ya-feed-tabs a {
  border-radius: 999px !important;
  padding: 7px 15px !important;
  border: 1px solid var(--ys-border) !important;
  background: var(--ys-surface) !important;
  color: var(--ys-text-soft) !important;
  font-weight: 700 !important;
  transition: all 0.16s ease !important;
}

html[data-ya-theme="prism"] .ya-feed-tabs a.is-active,
html[data-ya-theme="prism-light"] .ya-feed-tabs a.is-active {
  background: var(--ys-grad-prism) !important;
  color: #060916 !important;
  border-color: transparent !important;
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.34) !important;
}

/* Composer Textarea & Inputs */
html[data-ya-theme="prism"] .ya-composer-card textarea,
html[data-ya-theme="prism"] .ya-composer-card input,
html[data-ya-theme="prism"] .ya-composer-card select,
html[data-ya-theme="prism-light"] .ya-composer-card textarea,
html[data-ya-theme="prism-light"] .ya-composer-card input,
html[data-ya-theme="prism-light"] .ya-composer-card select {
  background: rgba(124, 92, 255, 0.06) !important;
  border: 1px solid var(--ys-border) !important;
  border-radius: 13px !important;
  color: var(--ys-text) !important;
}

html[data-ya-theme="prism"] .ya-composer-card textarea:focus,
html[data-ya-theme="prism-light"] .ya-composer-card textarea:focus {
  border-color: var(--ys-cyan) !important;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15) !important;
  outline: none !important;
}

/* Reaction & Mood Pills */
html[data-ya-theme="prism"] .ya-mood-btn,
html[data-ya-theme="prism-light"] .ya-mood-btn {
  border-radius: 999px !important;
  border: 1px solid var(--ys-border) !important;
  background: rgba(124, 92, 255, 0.08) !important;
  color: var(--ys-text-soft) !important;
}
html[data-ya-theme="prism"] .ya-mood-btn:hover,
html[data-ya-theme="prism-light"] .ya-mood-btn:hover {
  border-color: var(--ys-sakura) !important;
  background: rgba(255, 77, 141, 0.14) !important;
  color: var(--ys-text) !important;
}

/* Sleek Footer inside Stage */
.ys-app-stage > footer.yf-site-footer {
  margin: 12px 28px 28px !important;
  padding: 18px 22px !important;
  border-radius: var(--ys-radius) !important;
  background: var(--ys-surface) !important;
  backdrop-filter: blur(14px);
  border: 1px solid var(--ys-border) !important;
}

/* ============================================================================
   RESPONSIVE BREAKPOINTS (Tablet Icon Rail -> Mobile Bottom Nav)
   ============================================================================ */

/* Compact Icon-Only Rail on Medium Screens */
@media (max-width: 1220px) and (min-width: 981px) {
  :root {
    --ys-rail-w: 76px;
  }
  .ys-left-rail {
    padding: 14px 10px;
    align-items: center;
  }
  .ys-rail-wordmark,
  .ys-rail-heading,
  .ys-rail-text,
  .ys-rail-broadcast-btn span {
    display: none !important;
  }
  .ys-rail-top {
    padding: 2px 0 12px;
  }
  .ys-rail-link {
    justify-content: center;
    padding: 11px;
    width: 48px;
    height: 48px;
  }
  .ys-rail-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    font-size: 0.65rem;
  }
  .ys-rail-broadcast-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 14px;
  }
  .ya-feed-layout {
    grid-template-columns: minmax(0, 1fr) 300px !important;
  }
}

/* Mobile Layout (< 980px): Hide Left Rail, Show Mobile Brand + Bottom Nav */
@media (max-width: 980px) {
  .ys-left-rail {
    display: none !important;
  }
  .ys-app-stage {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .ys-mobile-brand {
    display: inline-flex !important;
    flex-shrink: 0 !important;
  }
  header.ya-header-anime.ys-topbar {
    padding: 0 12px !important;
    gap: 10px !important;
  }
  .ys-search-kbd,
  .ya-theme-curr-name,
  .ya-radio-label {
    display: none !important;
  }
  .ys-app-stage > main#main-content {
    padding: 16px 14px 88px !important;
  }
  .ya-feed-layout {
    grid-template-columns: 1fr !important;
  }
  .ys-app-stage > footer.yf-site-footer {
    margin: 12px 14px 92px !important;
  }
  .cm-mobile-nav {
    background: var(--ys-glass) !important;
    backdrop-filter: blur(20px) !important;
    border-top: 1px solid var(--ys-border) !important;
  }
}
