#champdle { --cd-panel: var(--paper-2); --cd-ok: #2f9e6a; --cd-part: #e6b422; --cd-bad: #d64545; --cd-glow: color-mix(in srgb, var(--highlight) 45%, transparent);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.4; }
:root[data-theme="dark"] #champdle { --cd-part: #c99a16; --cd-bad: #c23a3a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #champdle { --cd-part: #c99a16; --cd-bad: #c23a3a; } }
#champdle h1 { margin: 0 0 .25rem; font-family: var(--font-display); font-weight: 400; font-size: 3rem; letter-spacing: 3px; text-transform: uppercase; text-align: center; }
#champdle h1 span { color: var(--accent); }
#champdle .lede { text-align: center; color: var(--muted); margin: 0 0 .5rem; }
#champdle button, #champdle input { font-family: inherit; }
#champdle .search { position: relative; max-width: 420px; margin: 0 auto 16px; }
#champdle .search input { width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--cd-panel); color: var(--ink); font-size: 16px; }
#champdle .list { position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; max-height: 320px; overflow: auto; z-index: 5; display: none; box-shadow: var(--box-shadow); }
#champdle .list div { display: flex; align-items: center; gap: 10px; padding: 6px 10px; cursor: pointer; }
#champdle .list div.sel, #champdle .list div:hover { background: var(--cd-panel); }
#champdle .list img { width: 36px; height: 36px; object-fit: cover; object-position: top; border-radius: 50%; background: #000; }
#champdle .list small { color: var(--muted); }
#champdle .info { text-align: center; color: var(--muted); margin-bottom: 10px; }
#champdle .done { display: none; text-align: center; margin: 0 auto 14px; padding: 8px 14px; max-width: 420px; border-radius: 8px; background: var(--cd-panel); border: 1px solid var(--cd-ok); animation: cdfade .5s both; }
#champdle .done.lost { border-color: var(--cd-bad); }
#champdle .done button { margin-left: 8px; padding: 3px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--line); color: var(--ink); cursor: pointer; font-size: 13px; }
#champdle .scroll { overflow-x: auto; }
#champdle table { border-collapse: separate; border-spacing: 4px; margin: 0 auto; min-width: 700px; width: auto; font-size: 13px; }
#champdle th { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0 0 4px; border: 0; text-align: center; letter-spacing: 0; }
#champdle td { width: 84px; height: 68px; text-align: center; vertical-align: middle; border: 0; border-radius: 6px; background: var(--cd-panel); font-weight: 600; font-size: 13px; padding: 2px 4px; animation: cdflip .5s both; }
#champdle td.hero { width: 96px; background: none; padding: 0; }
#champdle td.hero img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; object-position: top; display: block; margin: 0 auto; background: #000; }
#champdle td.hero div { font-size: 10px; color: var(--muted); font-weight: 500; line-height: 1.2; }
#champdle td.ok { background: var(--cd-ok); color: #fff; }
#champdle td.part { background: var(--cd-part); color: #1b1b1f; }
#champdle td.bad { background: var(--cd-bad); color: #fff; }
#champdle td small { display: block; font-weight: 500; font-size: 11px; opacity: .9; }
#champdle tr.win td:not(.hero) { animation: cdflip .5s both, cdglow 1.2s .9s 2; }
#champdle .legend { display: flex; gap: 14px; justify-content: center; color: var(--muted); font-size: 12px; margin-top: 18px; flex-wrap: wrap; }
#champdle .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
#champdle .foot { text-align: center; color: var(--muted); font-size: 12px; margin: 28px auto 0; max-width: 640px; }
#champdle #art { display: none; text-align: center; }
#champdle #artFrame { margin: 0 auto 12px; border: 3px solid var(--line); border-radius: 10px; background-color: #000; background-repeat: no-repeat; max-width: 100%; transition: border-color .3s, background-size .7s ease, background-position .7s ease; }
#champdle #artFrame.shake { animation: cdshake .4s; border-color: var(--cd-bad); }
#champdle #artFrame.won { border-color: var(--highlight); box-shadow: 0 0 30px var(--cd-glow); }
#champdle .tries { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
#champdle .tries i { width: 26px; height: 8px; border-radius: 4px; background: var(--line); }
#champdle .tries i.used { background: var(--cd-bad); }
#champdle .tries i.won { background: var(--cd-ok); }
#champdle .wrong { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 620px; margin: 0 auto; }
#champdle .wrong span { background: var(--cd-panel); border: 1px solid var(--cd-bad); border-radius: 999px; padding: 3px 12px; font-size: 13px; }
#champdle #fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; width: 100%; height: 100%; }
#champdle .modal { display: none; position: fixed; inset: 0; background: #000a; align-items: center; justify-content: center; z-index: 50; padding: 12px; }
#champdle .modal.show { display: flex; }
#champdle .modal .box { background: var(--paper); border: 2px solid var(--highlight); border-radius: 14px; padding: 22px; max-width: 440px; width: 100%; text-align: center; animation: cdpop .6s cubic-bezier(.2,1.5,.4,1) both; box-shadow: 0 0 50px var(--cd-glow); max-height: 96vh; overflow: auto; }
#champdle .modal .box.lose { border-color: var(--cd-bad); box-shadow: none; }
#champdle .modal h2 { margin: 0 0 2px; font-size: 30px; text-transform: uppercase; letter-spacing: 1px; color: var(--highlight); text-shadow: 0 0 14px var(--cd-glow); }
#champdle .modal .box.lose h2 { color: var(--cd-bad); text-shadow: none; }
#champdle .modal h3 { margin: 0; font-size: 1.2rem; }
#champdle .modal .sub { color: var(--muted); margin-bottom: 6px; }
#champdle .modal .reveal { height: 190px; width: auto; max-width: 100%; border-radius: 10px; margin: 8px auto; display: block; box-shadow: 0 0 28px var(--cd-glow); animation: cdfloat 3s ease-in-out infinite; }
#champdle .modal .box.lose .reveal { box-shadow: none; }
#champdle .rank { font-size: 20px; margin: 4px 0; }
#champdle .stats { display: flex; justify-content: center; gap: 22px; margin: 8px 0; }
#champdle .stats b { display: block; font-size: 22px; }
#champdle .stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
#champdle .modal pre { background: var(--cd-panel); padding: 10px; border-radius: 8px; text-align: left; font-size: 14px; white-space: pre-wrap; margin: 8px 0; }
#champdle .modal .btn { margin: 3px; }
#champdle .modal .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
@keyframes cdflip { from { transform: rotateX(90deg); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes cdglow { 50% { box-shadow: 0 0 18px 4px var(--highlight); filter: brightness(1.3) } }
@keyframes cdshake { 25% { transform: translateX(-8px) } 75% { transform: translateX(8px) } }
@keyframes cdpop { from { transform: scale(.4) rotate(-6deg); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes cdfloat { 50% { transform: translateY(-6px) rotate(1deg) } }
@keyframes cdfade { from { opacity: 0; transform: translateY(-4px) } to { opacity: 1; transform: none } }

#champdle .next { color: var(--muted); font-size: 13px; margin: 6px 0; }
#champdle .next b { color: var(--ink); font-variant-numeric: tabular-nums; }
#champdle .hintbar { text-align: center; margin: -6px auto 12px; max-width: 520px; font-size: 13px; }
#champdle .hintbar .btn { padding: 4px 12px; font-size: 13px; border-style: dashed; }
#champdle .hintbar .hint { display: inline-block; margin: 3px 4px; padding: 3px 12px; border-radius: 999px; background: var(--cd-panel); border: 1px solid var(--highlight); }
#champdle .bars { text-align: left; margin: 10px 0; }
#champdle .bars div { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-size: 13px; }
#champdle .bars span { width: 34px; text-align: right; color: var(--muted); }
#champdle .bars i { display: block; height: 18px; min-width: 18px; border-radius: 4px; background: var(--line); color: var(--ink); font-style: normal; font-size: 12px; padding: 0 6px; line-height: 18px; text-align: right; }
#champdle .bars i.hi { background: var(--cd-ok); color: #fff; }
#champdle .gamestats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
#champdle .gamestats div { background: var(--cd-panel); border-radius: 8px; padding: 6px; font-size: 12px; color: var(--muted); }
#champdle .gamestats b { display: block; color: var(--ink); font-size: 15px; }
@media (max-width: 640px) {
  #champdle h1 { font-size: 2.4rem; }
  #champdle .scroll { overflow: visible; }
  #champdle table, #champdle tbody { display: block; min-width: 0; width: 100%; }
  #champdle thead { display: none; }
  #champdle tr { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 12px; }
  #champdle td { width: auto; height: auto; min-height: 54px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
  #champdle td[data-label]::before { content: attr(data-label); font-size: 9px; text-transform: uppercase; font-weight: 500; opacity: .85; margin-bottom: 2px; }
  #champdle td.hero { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 0; }
  #champdle td.hero img { margin: 0; width: 44px; height: 44px; }
  #champdle td.hero div { text-align: left; font-size: 14px; color: var(--ink); font-weight: 600; }
  }
#champdle .toast { min-height: 24px; margin: -8px 0 8px; text-align: center; font-weight: 600; opacity: 0; transition: opacity .25s; }
#champdle .toast.show { opacity: 1; }
#champdle .toast.toast_hot { color: var(--cd-bad); }
#champdle .toast.toast_warm { color: #c9810a; }
#champdle .toast.toast_cold { color: var(--accent); }
#champdle .hintbar button#ruledBtn { margin-top: 6px; }

#champdle .aux { background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); padding: 6px 12px; cursor: pointer; font-size: 15px; }
#champdle .aux:hover { color: var(--ink); background: var(--cd-panel); }
#champdle .tools { display: flex; justify-content: flex-end; gap: 6px; }
#champdle .sec { margin: 26px 0 0; }
#champdle .sech { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
#champdle .sech h2 { margin: 0; font-size: 1.25rem; }
#champdle .prog { color: var(--muted); font-size: 13px; }
#champdle .secsub { margin: 2px 0 12px; color: var(--muted); font-size: 13px; }
#champdle .secsub .next { margin-left: 4px; font-size: 13px; }
#champdle .ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
#champdle .gcard { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--cd-panel); color: var(--ink); cursor: pointer; font-family: inherit; transition: transform .12s, border-color .12s; }
#champdle .gcard:hover { transform: translateY(-2px); border-color: var(--accent); }
#champdle .gcard .ge { font-size: 26px; line-height: 1.1; }
#champdle .gcard .gn { font-weight: 700; font-size: 16px; margin-top: 4px; }
#champdle .gcard .gd { color: var(--muted); font-size: 12px; line-height: 1.3; flex: 1; }
#champdle .gcard .gs { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
#champdle .gcard.prog { border-color: var(--highlight); }
#champdle .gcard.won { border-color: var(--cd-ok); }
#champdle .gcard.won .gs { color: var(--cd-ok); }
#champdle .gcard.lost { border-color: var(--cd-bad); }
#champdle .gcard.lost .gs { color: var(--cd-bad); }
#champdle .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
#champdle #playTitle { font-size: 16px; }
#champdle .topbar .btn { padding: 6px 12px; font-size: 14px; }
#champdle .foot { margin-top: 40px; }
@media (max-width: 640px) {
  #champdle .ggrid { grid-template-columns: repeat(2, 1fr); }
  #champdle .gcard { padding: 12px; }
}
#champdle .pill { display: inline-block; margin: 1px; padding: 1px 7px; border-radius: 999px; font-size: 12px; line-height: 1.5; }
#champdle .pill.m { background: var(--cd-ok); color: #fff; box-shadow: 0 0 0 1.5px #fffd; }
#champdle td.ok .pill.m { background: #ffffff33; }

/* ---- button system: one calm look for every button ---- */
#champdle .btn, #champdle .aux, #champdle .done button, #champdle .gcard { -webkit-tap-highlight-color: transparent; }
#champdle .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--cd-panel); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; }
#champdle .btn:hover { border-color: var(--accent); }
#champdle .btn:active { transform: scale(.97); }
#champdle .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
#champdle .btn.primary:hover { filter: brightness(1.1); }
#champdle .btn:focus-visible, #champdle .aux:focus-visible, #champdle .gcard:focus-visible, #champdle .done button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#champdle .aux { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px; padding: 0 12px; border-radius: 999px; background: var(--cd-panel); border: 1px solid var(--line); color: var(--ink); font-size: 16px; cursor: pointer; transition: border-color .15s, background .15s; }
#champdle .aux:hover { border-color: var(--accent); background: var(--cd-panel); }
#champdle .tools { gap: 8px; }
#champdle .topbar .btn { padding: 7px 14px; }
#champdle .topbar .aux { min-width: 34px; height: 34px; padding: 0; }
#champdle .hintbar .btn { border-style: solid; padding: 6px 14px; font-size: 13px; margin: 3px; }
#champdle .hintbar .hint { background: color-mix(in srgb, var(--highlight) 18%, transparent); border: 1px solid color-mix(in srgb, var(--highlight) 60%, transparent); }
#champdle .hintbar #hintBtn { background: color-mix(in srgb, var(--highlight) 30%, var(--cd-panel)); border-color: var(--highlight); }
#champdle .hintbar #ruledBtn { background: transparent; color: var(--muted); font-weight: 500; padding: 3px 12px; }
#champdle .hintbar #ruledBtn[aria-pressed="true"] { color: var(--ink); border-color: var(--cd-ok); background: color-mix(in srgb, var(--cd-ok) 14%, transparent); }
#champdle .done button { border-radius: 999px; padding: 3px 14px; font-weight: 600; background: var(--cd-panel); }
#champdle .modal .btn { margin: 4px; }

/* ---- result / stats / help modals ---- */
#champdle .modal .box { position: relative; }
#champdle .xbtn { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--cd-panel); color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
#champdle .xbtn:hover { color: var(--ink); border-color: var(--accent); }
#champdle .xbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#champdle .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
#champdle .actions .btn { margin: 0; width: 100%; }
#champdle .actions .btn.big { grid-column: 1 / -1; padding: 13px 18px; font-size: 16px; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
#champdle .btn.ghost { background: transparent; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
#champdle .btn.ghost:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: var(--accent); }
#champdle .modal pre { margin-bottom: 4px; }
#champdle .modal .reveal { height: 150px; }
#champdle .modal .actions { position: sticky; bottom: -22px; margin: 12px -22px -22px; padding: 12px 22px 22px; background: linear-gradient(to bottom, transparent, var(--paper) 18px); }

#champdle h1 { font-size: 2.6rem; letter-spacing: 2px; text-wrap: balance; line-height: 1.05; margin-top: .5rem; }
@media (max-width: 640px) { #champdle h1 { font-size: 2rem; } }
