/* Kelibatmu System theme: landing-page moss, amber and nostalgic darkness. */
:root[data-theme-preference="system"] {
  color-scheme: dark;
  --color-black: #030706;
  --color-charcoal: #07100d;
  --color-gray-dark: #0b1511;
  --color-gray-mid: #18241d;
  --color-gray-light: #2b3b30;
  --color-text-primary: rgba(246, 248, 239, 0.94);
  --color-text-secondary: rgba(232, 239, 226, 0.68);
  --color-text-muted: rgba(232, 239, 226, 0.44);
  --color-primary: #94d18a;
  --text-primary: rgba(246, 248, 239, 0.94);
  --text-secondary: rgba(232, 239, 226, 0.68);
  --accent-crimson: #7fba77;
  --accent-dusty-rose: #94d18a;
  --accent-wine: #587c52;
  --accent-amber: #c59a52;
  --theme-page-bg: #030706;
  --theme-page-bg-deep: #020504;
  --theme-surface: #0a120f;
  --theme-surface-raised: #101a15;
  --theme-surface-soft: rgba(220, 244, 220, 0.055);
  --theme-border: rgba(220, 244, 220, 0.11);
  --theme-shadow: rgba(0, 0, 0, 0.42);
  --theme-input-bg: rgba(7, 16, 13, 0.88);
  --theme-select-option-bg: #07100d;
  --theme-select-option-text: rgba(246, 248, 239, 0.94);
  --glow-subtle: 0 0 24px rgba(127, 186, 119, 0.1);
  --glow-focus: 0 0 0 3px rgba(148, 209, 138, 0.13);
  --kv2-lyric-active: #f2f1e0;
  --kv2-lyric-fill-start: #94d18a;
  --kv2-lyric-fill-end: #d2aa62;
  --kv2-lyric-inactive: rgba(232, 239, 226, 0.46);
}

:root[data-theme-preference="system"],
:root[data-theme-preference="system"] body,
:root[data-theme-preference="system"] .main-content {
  color-scheme: dark;
  color: var(--color-text-primary);
  background:
    radial-gradient(circle at 72% 8%, rgba(112, 168, 101, 0.09), transparent 30rem),
    radial-gradient(circle at 12% 48%, rgba(58, 118, 86, 0.07), transparent 25rem),
    linear-gradient(180deg, #050908 0%, #020504 54%, #030706 100%);
}

:root[data-theme-preference="system"] :where(
  input, textarea, select, .form-control, .form-field input, .form-field textarea,
  .cinematic-select, .filter-search-label input, .filter-select-label select
) {
  color-scheme: dark;
  color: var(--color-text-primary);
  background: var(--theme-input-bg);
  border-color: var(--theme-border);
}

:root[data-theme-preference="system"] :where(input, textarea, select):focus {
  border-color: rgba(148, 209, 138, 0.42);
  box-shadow: var(--glow-focus);
}

:root[data-theme-preference="system"] :where(
  .navbar, .mobile-top-bar, .kv2-mbn, .global-player,
  .kv2-auth-menu__panel, .auth-dropdown, .mobile-nav-container
) {
  border-color: var(--theme-border);
  background: color-mix(in srgb, var(--theme-surface) 91%, transparent);
  box-shadow: 0 16px 42px var(--theme-shadow);
}

:root[data-theme-preference="system"] :where(
  .nav-link.active, .nav-link:hover, .kv2-auth-menu__item:hover,
  .dropdown-item:hover, .kv2-mbn__item--active .kv2-mbn__label
) { color: var(--color-primary); }

@media (min-width: 769px) {
  :root[data-theme-preference="system"] .kv2-language-select--navbar select {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--color-text-secondary);
  }

  :root[data-theme-preference="system"] .kv2-language-select--navbar select:hover,
  :root[data-theme-preference="system"] .kv2-language-select--navbar select:focus,
  :root[data-theme-preference="system"] .kv2-language-select--navbar select:focus-visible {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--color-primary);
  }
}

:root[data-theme-preference="system"] :where(
  .kv2-mbn__item--active .kv2-mbn__icon,
  .kv2-mbn__item--search.kv2-mbn__item--active .kv2-mbn__icon
) { stroke: var(--color-primary); }

:root[data-theme-preference="system"] .kv2-mbn__item--active .kv2-mbn__avatar {
  border-color: rgba(148, 209, 138, 0.58);
  box-shadow: 0 0 0 1px rgba(148, 209, 138, 0.24);
}

:root[data-theme-preference="system"] :where(
  .notification-badge, .kv2-mbn__badge, .kv2-msg-inbox__unread-badge
) {
  color: #08100c;
  background: var(--accent-amber);
  box-shadow: 0 0 10px rgba(197, 154, 82, 0.24);
}

:root[data-theme-preference="system"] :where(
  .btn-primary, .primary-button, .submit-button, .auth-btn,
  .kv2-settings-save, .kv2-profile-shop__button
) {
  border-color: rgba(148, 209, 138, 0.36);
  color: #071009;
  background: linear-gradient(135deg, #94d18a, #c6a45f);
  box-shadow: 0 12px 28px rgba(94, 163, 91, 0.13);
}

:root[data-theme-preference="system"] :where(
  .btn-secondary, .secondary-button, .kv2-profile-endpoint-nav__link,
  .card-action-btn, .kv2-settings-link
) {
  border-color: var(--theme-border);
  color: var(--color-text-secondary);
  background: var(--theme-surface-soft);
}

:root[data-theme-preference="system"] :where(
  .music-card, .song-card, .blog-card, .placeholder-card,
  .compact-composer, .kv2-settings-card, .profile-card,
  .kv2-profile-panel, .kv2-profile-card
) {
  border-color: var(--theme-border);
  background: color-mix(in srgb, var(--theme-surface) 88%, transparent);
  box-shadow: 0 18px 48px var(--theme-shadow);
}

/* Home keeps its layout; System swaps only ambient and interaction accents. */
:root[data-theme-preference="system"] .homepage .echo-retention-card {
  border-color: var(--theme-border);
  background: rgba(10, 18, 15, 0.82);
}
:root[data-theme-preference="system"] .homepage .echo-retention-card--streak {
  border-color: rgba(148, 209, 138, 0.3);
  background: rgba(127, 186, 119, 0.1);
}
:root[data-theme-preference="system"] .homepage .recent-added-see-all:hover {
  color: var(--color-primary);
  background: rgba(127, 186, 119, 0.08);
}

/* Profile, Status and Memory Wall. */
:root[data-theme-preference="system"] .kv2-profile-shell {
  --kv2-profile-bg: #020504;
  --kv2-profile-ink: var(--color-text-primary);
  --kv2-profile-muted: var(--color-text-secondary);
  --kv2-profile-faint: var(--color-text-muted);
  --kv2-profile-line: var(--theme-border);
  --kv2-profile-surface: rgba(10, 18, 15, 0.82);
  --kv2-profile-surface-strong: rgba(16, 26, 21, 0.94);
  --kv2-profile-crimson: rgba(127, 186, 119, 0.92);
  --kv2-profile-ember: rgba(197, 154, 82, 0.78);
  --kv2-profile-mint: rgba(148, 209, 138, 0.76);
  background:
    radial-gradient(circle at 22% 8%, rgba(112, 168, 101, 0.13), transparent 34%),
    radial-gradient(circle at 78% 18%, rgba(197, 154, 82, 0.055), transparent 26%),
    linear-gradient(180deg, #050908 0%, #020504 46%, #030706 100%);
}
:root[data-theme-preference="system"] .kv2-profile-atmosphere-glow-primary { background: rgba(112, 168, 101, 0.24); }
:root[data-theme-preference="system"] .kv2-profile-atmosphere-glow-secondary { background: rgba(197, 154, 82, 0.1); }
:root[data-theme-preference="system"] :where(.kv2-profile-section, .kv2-profile-identity-panel, .kv2-profile-status-card, .kv2-profile-status__composer) {
  border-color: var(--theme-border);
  background: linear-gradient(180deg, rgba(220, 244, 220, 0.045), rgba(220, 244, 220, 0.018)), rgba(7, 16, 13, 0.78);
}
:root[data-theme-preference="system"] .kv2-profile-status-card {
  background: radial-gradient(circle at 18% 0%, rgba(197, 154, 82, 0.09), transparent 32%), rgba(7, 16, 13, 0.8);
}
:root[data-theme-preference="system"] .kv2-profile-status__mood-option input:checked + span {
  border-color: rgba(148, 209, 138, 0.44);
  color: var(--color-text-primary);
  background: rgba(127, 186, 119, 0.2);
}
:root[data-theme-preference="system"] :where(.kv2-activity-feed, .kv2-achievements) {
  color: var(--color-text-primary);
  background: linear-gradient(180deg, #050908 0%, #020504 100%);
}
:root[data-theme-preference="system"] :where(.kv2-activity-feed__title, .kv2-achievements__title, .kv2-activity-feed__actor, .kv2-profile-status-author__name) { color: var(--color-text-primary); }
:root[data-theme-preference="system"] :where(.kv2-activity-feed__subtitle, .kv2-activity-feed__message, .kv2-activity-feed__time, .kv2-achievements__description) { color: var(--color-text-secondary); }

/* Echo shops retain tier colors while their frame follows Kelibatmu System. */
:root[data-theme-preference="system"] :where(.kv2-gift-hero, .kv2-echo-transfer, .kv2-gift-showcase, .kv2-profile-shop__hero, .kv2-profile-shop__item) {
  border-color: var(--theme-border);
  background: linear-gradient(145deg, rgba(16, 26, 21, 0.96), rgba(3, 7, 6, 0.96));
  box-shadow: 0 24px 70px var(--theme-shadow);
}
:root[data-theme-preference="system"] :where(.kv2-gift-card, .kv2-gift-dialog) {
  border-color: var(--theme-border);
  background: #0a120f;
}
:root[data-theme-preference="system"] :where(.kv2-gift-nav a, .kv2-gift-showcase__actions a, .song-echo-gift-link) { color: var(--color-primary); }
:root[data-theme-preference="system"] :where(.kv2-echo-transfer button, .kv2-gift-send, .kv2-gift-dialog__confirm) {
  color: #071009;
  background: linear-gradient(135deg, #94d18a, #c59a52);
}

/* Settings and authentication. */
:root[data-theme-preference="system"] .kv2-settings-page {
  background: radial-gradient(circle at 20% 0%, rgba(112, 168, 101, 0.11), transparent 34%), linear-gradient(180deg, #050908, #020504);
}
:root[data-theme-preference="system"] .auth-page {
  background: radial-gradient(circle at 50% 8%, rgba(112, 168, 101, 0.1), transparent 26rem);
}
:root[data-theme-preference="system"] .auth-card {
  border-color: var(--theme-border);
  background: linear-gradient(145deg, rgba(16, 26, 21, 0.9), rgba(3, 7, 6, 0.94));
  box-shadow: 0 22px 58px var(--theme-shadow);
}
:root[data-theme-preference="system"] .auth-icon {
  border-color: rgba(148, 209, 138, 0.22);
  background: rgba(127, 186, 119, 0.1);
}
:root[data-theme-preference="system"] .auth-icon svg { stroke: var(--color-primary); }
:root[data-theme-preference="system"] .auth-title {
  background: linear-gradient(135deg, rgba(246, 248, 239, 0.98), rgba(197, 154, 82, 0.82));
  background-clip: text;
  -webkit-background-clip: text;
}
:root[data-theme-preference="system"] .auth-input {
  border-color: var(--theme-border);
  background: rgba(3, 7, 6, 0.62);
}
:root[data-theme-preference="system"] .auth-input:focus { border-color: rgba(148, 209, 138, 0.4); box-shadow: var(--glow-focus); }
:root[data-theme-preference="system"] :where(.auth-link, .auth-form-group:focus-within .auth-label) { color: var(--color-primary); }

/* Music, stories, search and shared badges inherit the moss token. */
:root[data-theme-preference="system"] .filter-select-label select option:checked { color: #071009; background-color: var(--color-primary); }
:root[data-theme-preference="system"] :where(.metadata-chip, .blog-category, .feature-badge, .kv2-profile-status-mood) {
  border-color: rgba(148, 209, 138, 0.2);
  color: var(--color-text-secondary);
  background: rgba(127, 186, 119, 0.07);
}
:root[data-theme-preference="system"] .kv2-search {
  --kv2-search-panel-bg: rgba(10, 18, 15, 0.9);
  --kv2-search-user-bubble: #587c52;
  --kv2-search-assistant-bubble: rgba(16, 26, 21, 0.92);
  --kv2-search-assistant-border: rgba(148, 209, 138, 0.18);
}

/* Inbox/status indicators use moss; destructive controls intentionally stay red. */
:root[data-theme-preference="system"] :where(.kv2-msg-inbox, .kv2-msg-conversation, .kv2-broadcast-detail) {
  color: var(--color-text-primary);
  background: linear-gradient(180deg, #050908 0%, #020504 100%);
}
:root[data-theme-preference="system"] :where(.kv2-msg-inbox__category-row:hover, .kv2-msg-inbox__category-row--unread, .kv2-msg-inbox__conversation-item--unread, .kv2-msg-inbox__broadcasts) {
  border-color: rgba(148, 209, 138, 0.2);
  background: rgba(127, 186, 119, 0.075);
}
:root[data-theme-preference="system"] :where(.kv2-msg-inbox__broadcasts svg, .kv2-msg-inbox__broadcasts-label, .kv2-msg-inbox__conversation-item--unread .kv2-msg-inbox__conversation-name) { color: var(--color-primary); stroke: var(--color-primary); }
:root[data-theme-preference="system"] :where(.kv2-msg-inbox__avatar-img, .kv2-msg-inbox__avatar-initial, .kv2-msg-conversation__avatar-img, .kv2-msg-conversation__avatar-initial) { border-color: rgba(148, 209, 138, 0.3); }
:root[data-theme-preference="system"] :where(.kv2-msg-inbox__avatar-initial, .kv2-msg-conversation__avatar-initial, .kv2-msg-bubble--outgoing) { background: linear-gradient(135deg, rgba(88, 124, 82, 0.9), rgba(127, 186, 119, 0.48)); }
:root[data-theme-preference="system"] :where(.kv2-msg-conversation__composer-container:focus-within, .kv2-msg-conversation__send-btn) { border-color: rgba(148, 209, 138, 0.42); background-color: rgba(127, 186, 119, 0.42); }

@media (prefers-reduced-motion: reduce) {
  :root[data-theme-preference="system"] :where(.auth-card, .kv2-profile-atmosphere-particle) { animation: none; }
}
