/* 练吉他 v14 — Duolingo-style multi-color visual layer.
 * Loads after option3 base + v13 visual layers; equal/higher specificity wins by order.
 * ponytail: exact existing selectors only; no universal img rules (stage canvas is 1000x700,
 * scaled by JS — stage internals are left untouched); account character/world themes stay
 * local to scene/preview frames via the v13 role-alias block.
 * Palette: green #58CC02 progression, blue #1CB0F6 secondary/navigation, yellow #FFC800
 * rewards, orange #FF9600 streak, purple #CE82FF achievements/characters, red #FF4B4B danger.
 * Canvas white, outline #E5E5E5, body ink #4B4B4B. Cards 20/24px, image insets 12/16px.
 */
@media screen {
  :root {
    --lj-orange: #ff9600;
    --lj-orange-edge: #e07e00;
    --lj-orange-soft: #fff0dd;
    --lj-yellow: #ffc800;
    --lj-yellow-deep: #ae6802;
    --lj-yellow-soft: #fff5d3;
    --lj-purple: #ce82ff;
    --lj-purple-deep: #9069cd;
    --lj-purple-soft: #f1ebfe;
    --lj-red: #ff4b4b;
    --lj-red-deep: #ea2b2b;
    --lj-red-soft: #ffdfe0;
  }

  /* ---------- 1. White canvas: strip remaining page washes/gradients ---------- */
  .view-login.login-page, .view-migration.login-page,
  .view-onboarding.page, .view-onboarding.onboarding-page {
    background: #fff;
  }
  .view-growth.page:before, .view-stats.page:before,
  .view-craft.page:before, .view-shop.page:before {
    background: #f7f7f7;
  }

  /* ---------- 2. Home hero: white card, neutral frame, breathing room ---------- */
  .app-shell main.view-home.home-page .home-layout > .sd-hero.home-practice-card.home-area-hero {
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 24px;
    box-shadow: none;
  }
  .app-shell main.view-home.home-page .home-practice-card:before {
    display: none; /* cream wash overlay over the stage scene */
  }
  .app-shell main.view-home.home-page .home-practice-card > .home-hero-art {
    margin: 0 16px 16px;
    border: 2px solid #e5e5e5;
    border-radius: 14px;
    background: #f7f7f7;
  }
  .app-shell main.view-home.home-page .home-practice-card > .sd-hero-copy {
    padding: 24px;
  }
  .app-shell main.view-home.home-page .home-practice-card .sd-hero-date {
    color: #777;
    font-weight: 700;
  }
  .app-shell main.view-home.home-page .home-practice-card .sd-hero-motto {
    color: #4b4b4b;
  }

  /* ---------- 3. Discovery / entry cards: flat semantic tints + icon chips ---------- */
  .app-shell main.view-home.home-page .p13-story-entry {
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 20px;
    padding: 12px 12px 14px;
    box-shadow: none;
  }
  .app-shell main.view-home.home-page .p13-story-entry .home-discovery-art {
    border-radius: 12px;
  }
  .app-shell main.view-home.home-page .p13-story-entry .home-chapter-row {
    padding: 0 4px;
  }
  .app-shell main.view-home.home-page .home-entry {
    border: 2px solid #e5e5e5;
    box-shadow: none;
    padding: 16px;
  }
  .app-shell main.view-home.home-page .home-entry-rewards {
    background: var(--lj-yellow-soft);
  }
  .app-shell main.view-home.home-page .home-entry-skills {
    background: var(--lj-green-soft);
  }
  .app-shell main.view-home.home-page .home-entry-video {
    background: var(--lj-blue-soft);
  }
  .app-shell main.view-home.home-page .home-entry-poster {
    background: var(--lj-purple-soft);
  }
  .app-shell main.view-home.home-page .home-entry-skills .home-entry-icon {
    background: #d7ffb8;
  }
  .app-shell main.view-home.home-page .home-entry-video .home-entry-icon {
    background: #84d8ff;
  }
  .app-shell main.view-home.home-page .home-entry-poster .home-entry-icon {
    background: #e2cff7;
  }
  .app-shell main.view-home.home-page .home-entry-icon img {
    padding: 10px;
    filter: none;
  }
  .app-shell main.view-home.home-page .home-rewards-art > img {
    padding: 12px;
    filter: none;
  }

  /* ---------- 4. Squad: framed characters with flat multi-color tints ---------- */
  .app-shell main.view-home.home-page .home-squad {
    padding: 20px;
  }
  .app-shell main.view-home.home-page .home-squad-char {
    flex: 1 0 76px;
    gap: 10px;
  }
  .app-shell main.view-home.home-page .home-squad-char img {
    width: 76px;
    height: 76px;
    padding: 8px;
    border-radius: 50%;
    object-fit: contain;
    background: var(--squad-tint, #f7f7f7);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #e5e5e5;
  }
  .app-shell main.view-home.home-page .home-squad-char:nth-child(6n+1) { --squad-tint: var(--lj-purple-soft); }
  .app-shell main.view-home.home-page .home-squad-char:nth-child(6n+2) { --squad-tint: var(--lj-yellow-soft); }
  .app-shell main.view-home.home-page .home-squad-char:nth-child(6n+3) { --squad-tint: var(--lj-blue-soft); }
  .app-shell main.view-home.home-page .home-squad-char:nth-child(6n+4) { --squad-tint: var(--lj-green-soft); }
  .app-shell main.view-home.home-page .home-squad-char:nth-child(6n+5) { --squad-tint: var(--lj-orange-soft); }
  .app-shell main.view-home.home-page .home-squad-char:nth-child(6n+6) { --squad-tint: var(--lj-red-soft); }

  /* ---------- 5. Steps card, streak (orange), week checkin, piece ---------- */
  .app-shell main.view-home.home-page .home-area-steps .p13-steps-card {
    padding: 16px;
    gap: 10px;
  }
  .app-shell main.view-home.home-page .home-area-steps .p13-step {
    grid-template-columns: 28px minmax(0, 1fr) auto;
  }
  .app-shell main.view-home.home-page .home-area-steps .p13-step-mark {
    width: 28px;
    height: 28px;
    border-color: #e5e5e5;
    background: #fff;
    color: #777;
    font-weight: 800;
  }
  .app-shell main.view-home.home-page .home-area-steps .p13-step-mark.is-done {
    background: #58cc02;
    border-color: #58a700;
    color: #fff;
  }
  .app-shell main.view-home.home-page .home-area-steps .p13-steps-done-chip {
    background: var(--lj-green-soft);
    color: var(--lj-green-edge);
    font-weight: 800;
  }
  .app-shell main.view-home.home-page .home-card-pair > * > .p13-streak-panel {
    background: #fff6e9;
    border-color: #ffdcb0;
  }
  .app-shell main.view-home.home-page .p13-streak-panel :is(strong, svg) {
    color: var(--lj-orange-edge);
  }
  .app-shell main.view-home.home-page .home-week {
    background: #fff;
  }
  .app-shell main.view-home.home-page .home-week .checkin-days > div.checked .checkin-dot {
    background: var(--lj-orange);
  }
  .app-shell main.view-home.home-page .home-week .checkin-days > div.checked .checkin-dot:after {
    font-weight: 800;
  }
  .app-shell main.view-home.home-page .home-week-calendar {
    color: #1899d6;
  }
  .app-shell main.view-home.home-page .home-week-continue {
    border: 2px solid #e5e5e5;
    background: #fff;
    box-shadow: none;
  }
  .app-shell main.view-home.home-page .home-week-continue-bar i {
    background: #58cc02;
  }
  .app-shell main.view-home.home-page .home-piece {
    background: #fff;
  }
  .app-shell main.view-home.home-page .home-piece-title {
    color: #4b4b4b;
    font-weight: 800;
  }
  .app-shell main.view-home.home-page .home-piece-title .home-piece-icon {
    border-radius: 14px;
    background: var(--lj-blue-soft);
    padding: 8px;
    filter: none;
  }
  .app-shell main.view-home.home-page .weekly-progress-feedback-link {
    color: #1899d6;
    font-weight: 700;
  }

  /* ---------- 6. Chest & rewards (yellow family) ---------- */
  .app-shell .chest-entry {
    --chest-primary: var(--lj-yellow);
    --chest-primary-b: #e8a700;
    --chest-primary-deep: var(--lj-yellow-deep);
    --chest-primary-soft: var(--lj-yellow-soft);
    --chest-reward: var(--lj-yellow);
    --chest-reward-deep: var(--lj-yellow-deep);
    --chest-reward-soft: var(--lj-yellow-soft);
    --chest-glow: #ffe79c;
    border: 2px solid #e5e5e5;
    border-radius: 20px;
    background: #fff;
    box-shadow: none;
  }
  .app-shell .chest-entry .chest-figure-asset {
    background: var(--lj-yellow-soft);
  }
  .chest-overlay .chest-sheet {
    border: 2px solid #e5e5e5;
    background: #fff;
    box-shadow: none;
  }
  /* Open/exchange is the reward climax: yellow face, dark ink for contrast. */
  .chest-overlay .chest-btn--primary {
    background: var(--lj-yellow);
    color: #7a5300;
    text-shadow: none;
    box-shadow: 0 4px 0 var(--lj-yellow-deep);
  }
  .app-shell main.view-growth.page.growth-page .reward-entry-grid .practice-action-card {
    border: 2px solid #e5e5e5;
  }
  .app-shell main.view-growth.page.growth-page .reward-entry-grid .practice-action-icon {
    background: var(--lj-yellow);
  }
  .app-shell main.view-growth.page.growth-page .reward-entry-grid .practice-action-icon svg {
    color: #7a5300;
  }

  /* ---------- 7. Dialogue (character family: purple-soft) ---------- */
  .app-shell main.view-home.home-page .home-dialogue {
    padding: 20px;
    gap: 14px;
  }
  .app-shell .sd-guide {
    background: var(--lj-purple-soft);
    border-radius: 16px;
  }
  .app-shell main.view-home.home-page .home-dialogue-companion {
    background: #f7f7f7;
  }
  .app-shell main.view-home.home-page .home-dialogue-companion img,
  .app-shell main.view-home.home-page .sd-guide-avatar {
    object-fit: contain;
    padding: 4px;
    background: #fff;
  }

  /* ---------- 8. Character list & edit dialog (purple family, framed art) ---------- */
  .app-shell main.page .txchars-grid {
    gap: 20px;
  }
  .app-shell main.page .txchars-card {
    padding: 16px;
    border: 2px solid #e5e5e5;
    border-radius: 20px;
    box-shadow: none;
  }
  .app-shell main.page .txchars-card-media {
    border-radius: 14px;
    background: #f7f7f7;
  }
  .app-shell main.page .txchars-card-media img {
    padding: 12px;
  }
  .app-shell main.page .txchars-badge {
    background: var(--lj-purple-soft);
    color: var(--lj-purple-deep);
    font-weight: 800;
  }
  .app-shell main.page .txchars-card-create {
    border: 2px dashed #c9b3e8;
  }
  .app-dialog-overlay.txchars-overlay .txchars-dialog {
    border: 2px solid #e5e5e5;
    box-shadow: none;
  }
  .app-shell main.page .txchars-edit-hero,
  .app-dialog-overlay.txchars-overlay .txchars-edit-hero {
    margin: 16px 0;
    padding: 16px;
  }
  .app-shell main.page .txchars-edit-hero img,
  .app-dialog-overlay.txchars-overlay .txchars-edit-hero img {
    padding: 12px;
  }

  /* ---------- 9. Growth: avatar showcase, expedition, daily ---------- */
  .app-shell main.view-growth.page.growth-page {
    --gw-orange: var(--lj-orange);
    --gw-purple: var(--lj-purple);
    --gw-mint: #58cc02;
    --gw-gold: var(--lj-yellow);
    --gw-line: #e5e5e5;
    --gw-shadow: none;
    --gw-shadow-sm: none;
  }
  .app-shell main.view-growth.page.growth-page .avatar-stage-panel {
    padding: 16px;
    border: 2px solid #e5e5e5;
    background: #fff;
  }
  .app-shell main.view-growth.page.growth-page .gw-stage-scene {
    border-radius: 12px;
  }
  .app-shell main.view-growth.page.growth-page .expedition-card {
    background: #fff;
    border: 2px solid #e5e5e5;
    box-shadow: none;
  }

  /* ---------- 10. Shop item art ---------- */
  .app-shell main.view-shop .shp-card {
    padding: 16px;
    border: 2px solid #e5e5e5;
    box-shadow: none;
  }
  .app-shell main.view-shop .shp-card-media {
    border-radius: 12px;
    background: #f7f7f7;
  }
  .app-shell main.view-shop .shp-card-media img {
    padding: 12px;
  }
  .app-shell main.view-shop .shp-equipped-thumb {
    border: 1px solid #e5e5e5;
    background: #f7f7f7;
  }
  .app-shell main.view-shop .shp-equipped-thumb img {
    padding: 6px;
  }
  .app-shell main.view-shop .shp-gift-media {
    background: #f7f7f7;
  }
  .app-shell main.view-shop .shp-gift-media img {
    object-fit: contain;
    padding: 8px;
  }

  /* ---------- 11. Onboarding world / portrait cards ---------- */
  .view-onboarding {
    --ob-orange: var(--ui-accent, #58cc02);
    --ob-orange-deep: var(--ui-accent-strong, #58a700);
    --ob-grad: var(--ui-accent, #58cc02);
    --ob-navy: #4b4b4b;
    --ob-ink: #4b4b4b;
    --ob-muted: #777;
    --ob-line: #e5e5e5;
    --ob-fill: #f7f7f7;
  }
  .view-onboarding .onboarding-pack {
    padding: 12px;
    gap: 10px;
    border: 2px solid #e5e5e5;
    border-radius: 16px;
    background: #fff;
    box-shadow: none;
  }
  .view-onboarding .onboarding-pack:hover {
    border-color: #84d8ff;
    box-shadow: none;
  }
  .view-onboarding .onboarding-scene {
    border-radius: 12px;
    opacity: 1;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .view-onboarding .onboarding-avatar-row img {
    padding: 8px;
    background: #f7f7f7;
    filter: none;
  }
  .view-onboarding .ob-art-frame {
    border-radius: 20px;
  }
  .view-onboarding .ob-art-avatar {
    mix-blend-mode: normal;
    filter: none;
  }
  .view-onboarding .onboarding-card.ob-card {
    border: 2px solid #e5e5e5;
    box-shadow: none;
  }
  .view-onboarding .ob-character-generation-card {
    border: 2px solid #e5e5e5;
    padding: 12px;
  }
  .view-onboarding .ob-character-generation-card > img {
    padding: 6px;
    background: #f7f7f7;
  }

  /* ---------- 12. Login ---------- */
  .view-login .login-role {
    border: 2px solid #e5e5e5;
    border-radius: 16px;
    background: #fff;
  }
  .view-login .login-role:hover {
    background: #f7f7f7;
    border-color: #84d8ff;
  }
  .view-login .login-role img {
    mix-blend-mode: normal;
    padding: 4px;
  }

  /* ---------- 13. Settings: companion grid, profile art ---------- */
  .app-shell main.view-settings .set-companion-grid li {
    padding: 12px;
    border: 2px solid #e5e5e5;
    border-radius: 16px;
    background: #f7f7f7;
  }
  .app-shell main.view-settings .set-companion-grid img {
    border-radius: 10px;
  }
  .app-shell main.view-settings .set-profile-avatar img {
    object-fit: contain;
    padding: 4px;
    background: #f7f7f7;
  }
  .app-shell main.view-settings .set-hero-image img {
    padding: 12px;
  }
  .app-shell .app-topbar-avatar {
    border-color: #e5e5e5;
    background: #f7f7f7;
    box-shadow: none;
  }
  .app-shell :is(.app-topbar-avatar, .home-statusbar-avatar) img {
    object-fit: contain;
    padding: 4px;
  }
  .app-shell .friend-avatar {
    border: 2px solid #e5e5e5;
    background: #f7f7f7;
  }

  /* ---------- 14. Collection page + drawer dialog (rarity families) ---------- */
  .collection-album,
  .app-dialog-overlay.collection-drawer-backdrop {
    --cl-bg: #fff;
    --cl-surface: #fff;
    --cl-ink: #4b4b4b;
    --cl-ink-soft: #4b4b4b;
    --cl-muted: #777;
    --cl-faint: #999;
    --cl-line: #e5e5e5;
    --cl-cta-from: var(--lj-yellow);
    --cl-cta-to: var(--lj-yellow);
    --cl-cta-shadow: none;
    --cl-purple: var(--lj-purple);
    --cl-purple-deep: var(--lj-purple-deep);
    --cl-purple-soft: var(--lj-purple-soft);
    --cl-purple-chip: #e6d5fb;
    --cl-mint: #58cc02;
    --cl-mint-soft: var(--lj-green-soft);
    --cl-mint-text: var(--lj-green-edge);
    --cl-gold: var(--lj-yellow);
    --cl-gold-deep: var(--lj-yellow-deep);
    --cl-gold-soft: var(--lj-yellow-soft);
    --cl-common-bg: #f7f7f7;
    --cl-common-text: #4b4b4b;
    --cl-common-border: #e5e5e5;
    --cl-common-frame: #f7f7f7;
    --cl-rare-bg: var(--lj-blue-soft);
    --cl-rare-text: #1899d6;
    --cl-rare-border: #84d8ff;
    --cl-rare-frame: var(--lj-blue-soft);
    --cl-special-bg: var(--lj-purple-soft);
    --cl-special-text: var(--lj-purple-deep);
    --cl-special-border: #dcc6f7;
    --cl-special-frame: var(--lj-purple-soft);
    --cl-legendary-bg: var(--lj-yellow-soft);
    --cl-legendary-text: var(--lj-yellow-deep);
    --cl-legendary-border: #ffe79c;
    --cl-legendary-frame: var(--lj-yellow-soft);
    --cl-danger: var(--lj-red-deep);
    --cl-shadow-card: none;
    --cl-shadow-lift: none;
  }
  .collection-album .collection-card {
    padding: 12px;
    border: 2px solid #e5e5e5;
    box-shadow: none;
  }
  .collection-album .collection-card-image,
  .app-dialog-overlay.collection-drawer-backdrop .collection-drawer-image {
    border-radius: 12px;
  }
  .app-dialog-overlay.collection-drawer-backdrop .collection-drawer {
    border: 2px solid #e5e5e5;
    box-shadow: none;
  }
  .app-dialog-overlay.collection-drawer-backdrop .collection-drawer-img {
    object-fit: contain;
    padding: 16px;
  }
  .app-dialog-overlay.collection-drawer-backdrop :is(.collection-fav-toggle, .collection-retry-btn, .collection-dup-badge) {
    color: #7a5300;
    text-shadow: none;
  }

  /* ---------- 15. Dialog shells ---------- */
  .growth-stage-dialog {
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 20px;
    box-shadow: none;
  }
  .app-dialog-overlay.collection-drawer-backdrop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(75, 75, 75, .42);
  }

  /* ---------- 16. Icons: coherent weight, per-meaning chip colors, focus ---------- */
  .app-shell .nav-links svg.lucide, .app-shell .tab-bar svg.lucide, .page.teacher-page .teacher-area-tabs svg.lucide {
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .app-shell :is(button, a, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid #84d8ff;
    outline-offset: 2px;
  }
  .app-shell main.view-settings .set-card-icon svg.lucide,
  .app-shell main.view-growth.page.growth-page :is(.avatar-stage-panel, .sd-power-panel) svg.lucide {
    stroke-width: 2.6;
  }

  /* ---------- 17. Typography: strong readable headings ---------- */
  .app-shell .app-main :where(.sd-panel, .set-card, .practice-action-card, .home-squad, .expedition-card) :where(h2, h3) {
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #4b4b4b;
  }

  /* ---------- 18. Breakpoints: 375 / 768 / 1280 / 1920 ---------- */
  @media screen and (min-width: 1024px) {
    .app-shell main.view-home.home-page .home-layout > .sd-hero.home-practice-card.home-area-hero {
      padding: 24px;
    }
    .app-shell main.view-home.home-page .home-layout > .home-area-steps {
      padding: 24px;
    }
  }
  @media screen and (max-width: 767px) {
    .app-shell main.view-home.home-page .home-practice-card > .home-hero-art {
      margin: 0 12px 12px;
    }
    .app-shell main.view-home.home-page .home-practice-card > .sd-hero-copy {
      padding: 16px;
    }
    .app-shell main.view-home.home-page .home-squad {
      padding: 16px;
    }
  }
}
