/* M08 screens: Quick Match setup, Custom Cup, Learn, rules reference, achievements, sound panel, cosmetics. */
.crest.orsen { background: #7d9bb8; color: #0f1824; } .crest.graven { background: #b8975a; color: #20180a; }
.crest.nacre { background: #4fb3a9; color: #08201d; } .crest.briar { background: #5f8f3e; color: #f2f7ea; }
.err { color: var(--bad); }
.m8 .m8-title { font-size: 26px; margin: 6px 0; }
.m8-h { font-size: 15px; margin: 14px 0 8px; color: var(--dim); font-weight: 600; letter-spacing: .02em; }
.m8-small { font-size: 13px; }
.m8-tight { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.m8-factions { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.m8-go { width: 100%; min-height: 54px; font-size: 18px; margin-top: 6px; }
.m8-go2 { width: 100%; margin-top: 10px; }
.m8-deckrow { margin-top: 12px; }
.m8-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.m8-links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.linklike { background: none; border: 0; padding: 0; color: var(--gold2); text-decoration: underline; min-height: 0; }
.m8-adv summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.m8-list { padding-left: 20px; margin: 6px 0; } .m8-list li { margin: 4px 0; }
.m8-note { text-align: left; }

/* Achievements and cosmetics */
.m8-achrow { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); opacity: .75; }
.m8-achrow.earned { opacity: 1; } .m8-medal { font-size: 22px; color: var(--gold); text-align: center; }
.m8-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.m8-stats div { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.m8-stats b { display: block; font-size: 22px; } .m8-stats span { color: var(--dim); font-size: 12px; }
.m8-swatch { display: inline-block; width: 22px; height: 30px; border-radius: 4px; margin-right: 8px; vertical-align: middle; border: 1px solid #0006; }
.back-plain { background: #2a3048; } .back-ember { background: linear-gradient(135deg, #7a2a12, #e3793b); }
.back-silver { background: linear-gradient(135deg, #6f7685, #e6e9ef); } .back-rose { background: linear-gradient(135deg, #6d2741, #e79ab4); }
.lamp-amber { background: radial-gradient(circle, #ffd27a, #8a5a12); border-radius: 50%; height: 22px; }
.lamp-jade { background: radial-gradient(circle, #9ff0c8, #1f6b4c); border-radius: 50%; height: 22px; }
.lamp-gold { background: radial-gradient(circle, #fff0b0, #b8860b); border-radius: 50%; height: 22px; }
/* Card back: the deck counters on the table; lamp: the glow over the table. */
body[data-back="ember"] .status .count:nth-of-type(2) { background: linear-gradient(135deg, #7a2a1288, #e3793b55); border-radius: 6px; }
body[data-back="silver"] .status .count:nth-of-type(2) { background: linear-gradient(135deg, #6f768588, #e6e9ef44); border-radius: 6px; }
body[data-back="rose"] .status .count:nth-of-type(2) { background: linear-gradient(135deg, #6d274188, #e79ab455); border-radius: 6px; }
body[data-lamp="jade"] .table { box-shadow: inset 0 0 120px #39c08a2e; }
body[data-lamp="gold"] .table { box-shadow: inset 0 0 120px #f0c24a33; }

/* Custom Cup */
.m8-cuplist { display: grid; gap: 8px; }
.m8-cupbtn { text-align: left; display: flex; flex-direction: column; gap: 2px; }
.m8-cupbtn span { color: var(--dim); font-size: 13px; }
.m8-open { border-style: dashed; opacity: .8; }
.m8-aiadd { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.m8-aiadd select, .m8-search { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-height: 40px; }
.m8-wide { max-width: 980px; }
.m8-bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.m8-round h3 { font-size: 14px; color: var(--dim); margin: 0 0 8px; }
.m8-tie { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; display: grid; gap: 4px; font-size: 14px; }
.m8-tie.mine { border-color: var(--gold); }
.m8-tie .win { font-weight: 700; color: var(--gold2); }
.m8-duel { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--line); margin-left: 4px; }
.m8-duel.W { border-color: var(--good); color: var(--good); } .m8-duel.L { color: var(--bad); border-color: #7a3640; } .m8-duel.live { color: var(--focus); }
.m8-champ { border-color: var(--gold); } .m8-next { border-color: var(--focus); }

/* Learn */
.m8-scen { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.m8-scencard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.m8-scencard p { margin: 0; font-size: 14px; }
.m8-lesson p { font-size: 17px; line-height: 1.5; }
.m8-gems { color: var(--gold); letter-spacing: .1em; }
.m8-ab { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; margin: 2px 2px; font-size: 14px; }
.m8-ill { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.m8-ill > div { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; }
.m8-ill > div span { color: var(--dim); font-size: 13px; }
.m8-ill.rows { grid-template-columns: 1fr; gap: 4px; } .m8-ill.rows > div { padding: 6px 10px; }
.m8-ill .m8-mid { background: none; border: 0; text-align: center; color: var(--dim); font-size: 12px; }

/* Rules reference and sound panel (overlays) */
.m8-sheet { max-height: min(86dvh, 760px); overflow-y: auto; text-align: left; width: min(640px, calc(100vw - 24px)); }
.m8-sheet details { border-top: 1px solid var(--line); padding: 8px 0; }
.m8-sheet summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.m8-search { width: 100%; }
.m8-gloss { display: grid; gap: 6px; margin-top: 8px; }
.m8-gitem { display: grid; grid-template-columns: 26px 1fr; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.m8-gicon { font-size: 18px; text-align: center; }
.m8-range { display: grid; grid-template-columns: 70px 1fr 36px; align-items: center; gap: 8px; margin: 10px 0; }
.m8-range input { width: 100%; min-height: 32px; }
.m8-sheet .check { display: block; margin: 10px 0; }
.voice-cap { position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); max-width: min(90vw, 520px); background: #0d1220e6; border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 12px; font-style: italic; pointer-events: none; opacity: 0; transition: opacity .2s; z-index: 30; }
.voice-cap.on { opacity: 1; }
.voice-cap:empty { display: none; }
@media (max-width: 420px) { .m8-factions { grid-template-columns: 1fr 1fr; } .m8-range { grid-template-columns: 60px 1fr 32px; } }
