/* Settings — "salon" look (ink navy, ivory, champagne-gold hairlines; gold only for what is selected / switched on).
 * Phone: one calm column of cards. Desktop: a sticky section rail on the left, the same cards on the right, and the board / piece
 * pickers wrap into a full grid instead of a clipped horizontal strip. Loaded last in settings.html; markup and JS keep their ids. */
:root {
  --sl-hair: rgba(226, 200, 132, .16);
  --sl-hair2: rgba(226, 200, 132, .42);
  --sl-gold: #e6c466;
  --sl-gold-grad: linear-gradient(180deg, #f6df94 0%, #e2bd5a 52%, #c89c3c 100%);
  --sl-panel: linear-gradient(180deg, rgba(18, 31, 62, .78), rgba(8, 15, 34, .9));
  --sl-serif: 'Bodoni Moda', 'Playfair Display', Georgia, serif;
  --sl-dim: #9aa6bf;
}
html body { background: radial-gradient(1000px 560px at 50% -10%, rgba(54, 92, 164, .24), transparent 62%), #050a18 !important; }

html .settings-wrap { max-width: 680px !important; margin: 0 auto !important; padding: 0 16px 96px !important; display: block; }
html .ap-top { margin: 0 !important; padding: 22px 0 14px !important; background: none !important; }
html .ap-back { background: rgba(255, 255, 255, .05) !important; border: 1px solid var(--sl-hair) !important; color: #e8e2d2 !important; }
html .ap-back:hover { border-color: var(--sl-hair2) !important; }
html .ap-title { font-family: var(--sl-serif) !important; font-size: 30px !important; font-weight: 700 !important; letter-spacing: -.01em; color: #f4efe4 !important; }

/* cards */
html .settings-wrap .s-section, html .settings-wrap .ap-sec { position: relative; background: var(--sl-panel) !important; border: 1px solid var(--sl-hair) !important; border-radius: 22px !important; padding: 22px 22px 20px !important; margin: 0 0 16px !important; box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 26px 50px -30px #000 !important; scroll-margin-top: 78px; }
html .settings-wrap .s-title, html .settings-wrap .ap-sec-title { font-family: var(--sl-serif); font-size: 19px !important; font-weight: 700 !important; letter-spacing: 0; color: #f4efe4 !important; margin-bottom: 16px !important; }
html .settings-wrap .s-label { font-size: 14.5px !important; font-weight: 600 !important; color: #f1ece0 !important; }
html .settings-wrap .s-sub { font-size: 12.5px !important; color: var(--sl-dim) !important; margin-top: 2px; }
html .settings-wrap .s-row { padding: 14px 0 !important; border-bottom: 1px solid var(--sl-hair) !important; }
html .settings-wrap .s-row:last-child { border-bottom: 0 !important; padding-bottom: 0 !important; }

/* profile */
html .ap-profile { padding: 20px 22px !important; background: linear-gradient(135deg, rgba(230, 196, 102, .13), rgba(14, 24, 48, .85)) !important; border: 1px solid var(--sl-hair2) !important; }
html .ap-pf-name { font-family: var(--sl-serif); font-size: 22px !important; font-weight: 700 !important; color: #f4efe4 !important; }
html .ap-pf-elo b { font-family: var(--sl-serif); font-size: 32px !important; color: var(--sl-gold) !important; }

/* language chips */
html #apLangs { flex-wrap: wrap !important; overflow: visible !important; gap: 8px !important; padding: 0 !important; }
html #apLangs > * { border-radius: 999px !important; background: rgba(255, 255, 255, .05) !important; border: 1px solid var(--sl-hair) !important; color: #d6dcea !important; padding: 9px 15px !important; font-weight: 600 !important; }
html #apLangs > *:hover { border-color: var(--sl-hair2) !important; }
html #apLangs > .on, html #apLangs > .active { background: var(--sl-gold-grad) !important; color: #1c1405 !important; border-color: transparent !important; box-shadow: 0 8px 18px -10px rgba(230, 196, 102, .85) !important; }

/* board: a wrapping grid of themes, preview below */
html .settings-wrap .theme-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)) !important; gap: 12px !important; overflow: visible !important; padding: 4px 2px 6px !important; }
html .settings-wrap .theme-card { width: auto !important; border-radius: 14px !important; border: 1px solid var(--sl-hair) !important; background: rgba(255, 255, 255, .03) !important; transition: transform .18s, border-color .18s, box-shadow .18s !important; }
html .settings-wrap .theme-card:hover { transform: translateY(-2px); border-color: var(--sl-hair2) !important; }
html .settings-wrap .theme-card.active { border-color: var(--sl-gold) !important; box-shadow: 0 0 0 1px var(--sl-gold), 0 14px 26px -14px rgba(230, 196, 102, .7) !important; }
html .settings-wrap .theme-card .tc-name { color: #e8e2d2 !important; font-size: 11.5px !important; }
html .settings-wrap #boardPreview { width: min(260px, 70vw) !important; height: min(260px, 70vw) !important; border: 1px solid var(--sl-hair2) !important; border-radius: 14px !important; box-shadow: 0 0 0 8px rgba(8, 14, 32, .92), 0 0 0 9px var(--sl-hair), 0 30px 60px -26px #000 !important; margin: 18px auto 12px !important; }
html .settings-wrap .piece-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; gap: 10px !important; overflow: visible !important; padding: 4px 2px !important; }
html .settings-wrap .piece-card { border-radius: 14px !important; padding: 10px 14px !important; background: rgba(255, 255, 255, .03) !important; border: 1px solid var(--sl-hair) !important; transition: transform .18s, border-color .18s !important; }
html .settings-wrap .piece-card:hover { transform: translateY(-1px); border-color: var(--sl-hair2) !important; }
html .settings-wrap .piece-card.active { background: rgba(230, 196, 102, .13) !important; border-color: var(--sl-gold) !important; box-shadow: 0 0 0 1px var(--sl-gold) inset !important; }
html .settings-wrap .piece-card.active .piece-card-name { color: var(--sl-gold) !important; }
html .settings-wrap .piece-card-name { color: #e8e2d2 !important; }

/* switches: gold when on */
html body .notif-toggle { width: 48px !important; height: 28px !important; background: rgba(125, 135, 156, .3) !important; border: 1px solid var(--sl-hair) !important; }
html body .notif-toggle.on { background: var(--sl-gold-grad) !important; border-color: transparent !important; }

/* buttons inside rows */
html .sound-config-btn, html .pwa-btn, html .ref-copy-btn { border-radius: 12px !important; background: rgba(255, 255, 255, .06) !important; border: 1px solid var(--sl-hair2) !important; color: var(--sl-gold) !important; font-weight: 700 !important; box-shadow: none !important; }
html .sound-config-btn:hover, html .pwa-btn:hover, html .ref-copy-btn:hover { background: rgba(230, 196, 102, .12) !important; }
html .ref-code-box { background: rgba(255, 255, 255, .04) !important; border: 1px dashed var(--sl-hair2) !important; border-radius: 16px !important; }
html .ref-code { font-family: var(--sl-serif); color: var(--sl-gold) !important; }
html .ref-stat { background: rgba(255, 255, 255, .04) !important; border: 1px solid var(--sl-hair) !important; border-radius: 14px !important; }

/* rail (desktop) */
.sl-rail { display: none; }
@media (min-width: 1000px) {
  html .settings-wrap { max-width: 1060px !important; display: grid !important; grid-template-columns: 250px minmax(0, 1fr); column-gap: 30px; align-items: start; }
  html .settings-wrap > * { grid-column: 2; }
  html .settings-wrap > .ap-top { grid-column: 1 / -1; }
  html .settings-wrap > .sl-rail { grid-column: 1; grid-row: 2 / span 30; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 84px; padding: 10px; border-radius: 22px; background: var(--sl-panel); border: 1px solid var(--sl-hair); box-shadow: 0 26px 50px -30px #000; }
  .sl-rail a { display: block; text-align: left; padding: 11px 14px; border-radius: 14px; color: #cfd6e6; font-size: 14px; font-weight: 600; text-decoration: none; transition: background .16s, color .16s; }
  .sl-rail a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
  .sl-rail a.on { background: rgba(230, 196, 102, .13); color: var(--sl-gold); box-shadow: 0 0 0 1px var(--sl-hair2) inset; }
  .sl-rail a.danger { color: #f0a0a0; }
  html .settings-wrap .theme-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)) !important; }
}
@media (max-width: 520px) { html .ap-title { font-size: 26px !important; } html .settings-wrap .s-section, html .settings-wrap .ap-sec { padding: 18px 16px !important; } }
@media (prefers-reduced-motion: reduce) { html .settings-wrap * { transition: none !important; } }

/* ── Redesign: 44px switch targets, section chips on phones, focus rings ── */
html body .notif-toggle { position: relative; flex-shrink: 0; }
html body .notif-toggle::before { content: ""; position: absolute; inset: -9px -4px; }
.sl-rail a { min-height: 44px; display: flex; align-items: center; }
.sl-rail a:focus-visible, html .settings-wrap button:focus-visible, html .settings-wrap a:focus-visible, html #apLangs > *:focus-visible { outline: 2px solid #d4af37; outline-offset: 2px; }
html #apLangs > * { min-height: 44px; }
html .settings-wrap .s-row { min-height: 56px; }
@media (max-width: 999px) {
  html .settings-wrap > .sl-rail {
    display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; position: sticky; top: 51px; z-index: 30;
    margin: 0 -16px 14px; padding: 8px 16px; background: rgba(5, 10, 24, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--sl-hair);
  }
  .sl-rail::-webkit-scrollbar { display: none; }
  .sl-rail a { flex: 0 0 auto; padding: 0 16px; border-radius: 999px; white-space: nowrap; color: #cfd6e6; font-size: 13.5px; font-weight: 600; text-decoration: none; background: rgba(255,255,255,.05); border: 1px solid var(--sl-hair); }
  .sl-rail a.on { background: var(--sl-gold-grad); color: #1c1405; border-color: transparent; }
  .sl-rail a.danger { color: #f0a0a0; }
  .sl-rail a.danger.on { color: #3a0d0d; }
}
