@font-face { font-family: Montserrat; font-weight: 500; font-display: swap; src: url(/fonts/montserrat-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Montserrat; font-weight: 700; font-display: swap; src: url(/fonts/montserrat-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Montserrat; font-weight: 800; font-display: swap; src: url(/fonts/montserrat-latin-800-normal.woff2) format("woff2"); }

:root {
  --bg: #191b1d;
  --surface: #232527;
  --raised: #2f3236;
  --line: #3b3e43;
  --text: #ffffff;
  --muted: #a7abb1;
  --blue: #335fff; --blue-d: #1d3fc4;
  --green: #00b06f; --green-d: #007a4d;
  --red: #e5372c; --red-d: #a41f17;
  --gold: #ffc21a; --silver: #c9ced6; --bronze: #d98a4e;
  --pop: cubic-bezier(.3, 1.6, .5, 1);
  --r: 10px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 500 16px/1.45 Montserrat, system-ui, sans-serif; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; border-radius: 6px; }
main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 64px; }
h1 { font-size: 1.6rem; font-weight: 800; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 800; margin: 36px 0 12px; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: #111214; border-bottom: 1px solid #000; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.topbar-in { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; text-decoration: none; letter-spacing: -.02em; }
.logo.big { font-size: 1.7rem; margin-bottom: 6px; gap: 10px; }
.logo img { display: block; }
.tools { display: flex; align-items: center; gap: 8px; }
.tools form { margin: 0; }

/* app switcher */
.switch { display: flex; background: var(--surface); border-radius: 10px; padding: 3px; margin-right: auto; margin-left: 18px; }
.switch a { padding: 6px 14px; border-radius: 7px; font-weight: 700; font-size: .9rem; text-decoration: none; color: var(--muted); }
.switch a:hover { color: var(--text); }
.switch a.on { background: var(--raised); color: var(--text); box-shadow: 0 2px 0 #0b0c0d; }

/* account menu */
.menu { position: relative; }
.menu summary { list-style: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: linear-gradient(160deg, #7b4dff, #335fff); font-weight: 800; box-shadow: 0 2px 0 #1d3fc4; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--raised); border-radius: 10px; padding: 6px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .5); animation: drop .2s var(--pop); z-index: 20; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 7px; background: none; font-weight: 700; text-decoration: none; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--line); }
.menu-pop form { margin: 0; }
.menu-mail { margin: 0; padding: 8px 12px 10px; color: var(--muted); font-size: .8rem; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-wrap: anywhere; }

/* ---------- Buttons ---------- */
[hidden] { display: none !important; } /* .btn, .banner etc. set display and would beat the attribute */
.btn {
  --b: var(--raised); --bd: #1c1e21;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 700; font-size: .95rem; text-decoration: none;
  background: var(--b); box-shadow: 0 3px 0 var(--bd);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--bd); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { --b: var(--blue); --bd: var(--blue-d); }
.btn.green { --b: var(--green); --bd: var(--green-d); }
.btn.red { --b: var(--red); --bd: var(--red-d); }
.btn.ghost { --b: transparent; --bd: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--raised); filter: none; }
.btn.big { width: 100%; padding: 13px 18px; font-size: 1.05rem; }
.linkish { border: 0; background: none; padding: 0; margin-top: 14px; color: var(--muted); font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--text); }

/* ---------- Wall ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs { display: flex; background: var(--surface); border-radius: 10px; padding: 4px; }
.tab { padding: 7px 18px; border-radius: 7px; text-decoration: none; font-weight: 700; color: var(--muted); }
.tab:hover { color: var(--text); }
.tab.on { background: var(--raised); color: var(--text); box-shadow: 0 2px 0 #15171a; }
.toast { background: var(--green); color: #fff; font-weight: 700; padding: 10px 16px; border-radius: var(--r); margin: 0 0 18px; animation: drop .35s var(--pop); }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.tile {
  background: var(--surface); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column;
  transition: transform .18s var(--pop), box-shadow .18s;
  animation: tile-in .4s var(--pop) backwards; animation-delay: calc(var(--i, 0) * 35ms);
}
.tile:hover, .tile:focus-within { transform: translateY(-5px); box-shadow: 0 12px 24px rgba(0, 0, 0, .45); }
@keyframes tile-in { from { opacity: 0; transform: scale(.92) translateY(8px); } }

.thumb {
  --c: var(--blue);
  position: relative; min-height: 190px; padding: 22px 18px; display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, .16), transparent 55%), var(--c);
}
.thumb::before { /* big quote glyph watermark */
  content: "”"; position: absolute; right: 12px; bottom: -58px; font: 800 7rem/1 Georgia, serif; color: rgba(0, 0, 0, .14); pointer-events: none;
}
.blue { --c: #335fff; } .purple { --c: #7b4dff; } .green { --c: #00a866; }
.orange { --c: #f0711a; } .pink { --c: #e13f7d; } .teal { --c: #0b9aa8; }
.quote { position: relative; margin: 0; font-weight: 800; font-size: 1.12rem; line-height: 1.3; text-align: center; text-wrap: balance; overflow-wrap: anywhere; text-shadow: 0 2px 0 rgba(0, 0, 0, .18); }

.badge {
  position: absolute; top: 10px; left: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 999px; font-weight: 800; font-size: .85rem; color: #1a1a1a; background: var(--m);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .3);
}
.badge svg { width: 15px; height: 15px; fill: currentColor; }
.rank-1 { --m: var(--gold); } .rank-2 { --m: var(--silver); } .rank-3 { --m: var(--bronze); }
.rank-1 { box-shadow: 0 0 0 2px var(--gold); }
.rank-1 .badge { animation: shine 2.4s ease-in-out 1s 2; }
@keyframes shine { 50% { transform: scale(1.12) rotate(-4deg); } }

.meta { padding: 12px 14px 12px; display: flex; flex-direction: column; flex: 1; }
.who { margin: 0; font-weight: 700; }
.ctx { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
.actions { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; }
.actions form { margin: 0; }
.like {
  position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 36px;
  border: 0; border-radius: 8px; padding: 6px 12px; background: var(--raised); color: var(--muted); font-weight: 800;
  box-shadow: 0 2px 0 #15171a; transition: background .15s, color .15s;
}
.like svg { width: 18px; height: 18px; fill: currentColor; }
.like:hover { color: var(--text); }
.like.on { background: var(--green); color: #fff; box-shadow: 0 2px 0 var(--green-d); }
.like.pop svg { animation: pop .45s var(--pop); }
@keyframes pop { 40% { transform: scale(1.45) rotate(-14deg); } }
.plus-one { position: absolute; left: 50%; top: -4px; font-weight: 800; color: var(--green); pointer-events: none; animation: float-up .7s ease-out forwards; }
@keyframes float-up { to { transform: translate(-50%, -26px); opacity: 0; } from { transform: translate(-50%, 0); } }
.icon-btn { border: 0; background: none; color: var(--muted); width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; opacity: .7; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--raised); color: var(--text); opacity: 1; }

/* ---------- Panels & forms ---------- */
.panel { background: var(--surface); border-radius: 12px; padding: 24px; }
.solo { max-width: 440px; margin: 40px auto; text-align: center; }
.solo p { margin: 0 0 14px; font-weight: 700; }
.form { max-width: 560px; margin: 8px auto; }
.form h1 { margin-bottom: 6px; }
.stack label { display: block; margin: 16px 0 6px; font-weight: 700; font-size: .92rem; }
.opt { color: var(--muted); font-weight: 500; }
.field {
  display: block; width: 100%; padding: 11px 13px; border-radius: 8px; font: inherit; color: var(--text);
  background: #121315; border: 2px solid var(--line); transition: border-color .15s;
}
.field:focus { outline: none; border-color: var(--blue); }
.field::placeholder { color: #6c7178; }
textarea.field { resize: vertical; }
.field.code { font-size: 1.8rem; font-weight: 800; letter-spacing: .4em; text-align: center; }
.stack .btn.big { margin-top: 20px; }
.fine { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
.sub { color: var(--muted); margin: 4px 0 0; }
.alert { background: rgba(229, 55, 44, .15); color: #ff8a82; border: 1px solid rgba(229, 55, 44, .5); padding: 10px 12px; border-radius: 8px; font-weight: 700; margin: 14px 0 0; animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- Login ---------- */
.login { min-height: calc(100vh - 88px); display: grid; grid-template-columns: 1fr minmax(320px, 420px); gap: 48px; align-items: center; max-width: 980px; margin: 0 auto; }
.login-box { animation: tile-in .45s var(--pop) backwards; }
.login-art { position: relative; height: 360px; }
.login-art .t {
  position: absolute; width: 230px; padding: 26px 20px; border-radius: 12px; font-weight: 800; font-size: 1.1rem; line-height: 1.3; text-align: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, .16), transparent 55%), var(--c);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .45); animation: bob 6s ease-in-out infinite;
}
.login-art .t:nth-child(1) { left: 0; top: 10px; transform: rotate(-7deg); }
.login-art .t:nth-child(2) { left: 210px; top: 90px; transform: rotate(5deg); animation-delay: -2s; }
.login-art .t:nth-child(3) { left: 50px; top: 220px; transform: rotate(-2deg); animation-delay: -4s; }
@keyframes bob { 50% { translate: 0 -10px; } }

/* ---------- Admin ---------- */
.admin { max-width: 820px; margin: 0 auto; }
.num { display: inline-block; min-width: 26px; padding: 1px 8px; margin-left: 6px; border-radius: 999px; background: var(--raised); font-size: .85rem; text-align: center; }
.admin-q { margin-bottom: 14px; padding: 16px; }
.admin-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.admin-head .fine { margin: 0; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 800; background: var(--raised); }
.pill.pending { background: var(--gold); color: #1a1a1a; }
.pill.approved { background: var(--green); }
.pill.rejected { background: var(--raised); color: var(--muted); }
.pill.warn { background: var(--red); }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.row .field { flex: 1 1 200px; width: auto; }
.users { list-style: none; margin: 0; padding: 6px 16px; }
.users li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; overflow-wrap: anywhere; }
.users li:last-child { border-bottom: 0; }

@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; gap: 24px; min-height: 0; padding-top: 8px; }
  .login-art { height: 120px; overflow: hidden; margin: 0 -20px; }
  .login-art .t { width: 190px; padding: 16px 14px; font-size: .9rem; }
  .login-art .t:nth-child(1) { left: 4%; top: 18px; }
  .login-art .t:nth-child(2) { left: 52%; top: 8px; }
  .login-art .t:nth-child(3) { display: none; }
}
@media (max-width: 520px) {
  main { padding: 16px 16px 48px; }
  .topbar-in { padding: 8px 16px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .thumb { min-height: 150px; padding: 18px 10px; }
  .quote { font-size: .95rem; }
  .meta { padding: 10px; }
  h1 { font-size: 1.3rem; }
  .panel { padding: 18px; }
}
@media (max-width: 600px) { .logo-text { display: none; } .switch { margin-left: 10px; } }
@media (max-width: 380px) { .tools .lbl { display: none; } .switch a { padding: 6px 10px; } }
@media (max-width: 340px) { .grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================= Schach ================= */
.cm-chessboard.deinstein .board .square.white { fill: #ebecd0; }
.cm-chessboard.deinstein .board .square.black { fill: #739552; }
.cm-chessboard.deinstein.border-type-none .board .border { fill: #739552; stroke-width: 0; }
.cm-chessboard.deinstein .coordinates { pointer-events: none; user-select: none; }
.cm-chessboard.deinstein .coordinates .coordinate { font-size: 7px; font-weight: 700; }
.cm-chessboard.deinstein .coordinates .coordinate.black { fill: #ebecd0; }
.cm-chessboard.deinstein .coordinates .coordinate.white { fill: #739552; }
.cm-chessboard .markers .marker.marker-square { fill: #f5f682; opacity: .5; }
.cm-chessboard .markers .marker.marker-frame-danger { stroke: var(--red); stroke-width: 3px; opacity: .9; }
.cm-chessboard .markers .marker.marker-dot, .cm-chessboard .markers .marker.marker-bevel { fill: #191b1d; opacity: .28; }

/* lobby */
.chess-lobby { max-width: 1000px; margin: 0 auto; }
.hero-card { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center;
  background: linear-gradient(135deg, rgba(123, 77, 255, .35), transparent 60%), var(--surface); }
.hero-icon { width: 72px; height: 72px; border-radius: 16px; display: grid; place-items: center; background: #7b4dff; box-shadow: 0 4px 0 #4b2bb0; rotate: -6deg; }
.hero-icon svg { width: 46px; height: 46px; fill: #fff; }
.new-game { display: grid; gap: 10px; min-width: min(240px, 100%); }
.new-game .btn.big { margin: 0; }
.lobby-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.games, .ranking { list-style: none; margin: 0; padding: 6px 16px; }
.game-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.game-row:last-child { border-bottom: 0; }
.game-row a { font-weight: 700; text-decoration: none; }
.game-row a:hover { text-decoration: underline; }
.game-row form { margin: 0; }
.vs { color: var(--muted); font-weight: 500; margin: 0 4px; }
.ranking li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ranking li:last-child { border-bottom: 0; }
.ranking li.me .nm::after { content: " (du)"; color: var(--muted); font-weight: 500; }
.pos { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; background: var(--raised); font-size: .85rem; }
.pos.p1 { background: var(--gold); color: #1a1a1a; } .pos.p2 { background: var(--silver); color: #1a1a1a; } .pos.p3 { background: var(--bronze); color: #1a1a1a; }
.nm { flex: 1; font-weight: 700; }
.elo { font-weight: 800; color: var(--muted); }

/* game */
.chess-game { display: grid; grid-template-columns: minmax(0, 920px) minmax(260px, 340px); gap: 20px; justify-content: center; align-items: start; margin-top: -12px; }
.board-col { display: grid; gap: 4px; width: 100%; max-width: max(320px, calc(100vh - 160px)); justify-self: end; }
.analyse .board-col { max-width: max(320px, calc(100vh - 150px)); }
.board-wrap { position: relative; border-radius: 10px; overflow: hidden; box-shadow: 0 6px 0 #0e0f10, 0 16px 30px rgba(0, 0, 0, .45); }
.board { width: 100%; aspect-ratio: 1; }
.player { display: flex; align-items: center; gap: 10px; padding: 2px; min-height: 40px; font-weight: 700; }
.player .av { width: 36px; height: 36px; }
.player .dot { width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .35); }
.player .dot.w { background: #f4f4f4; } .player .dot.b { background: #1b1b1b; box-shadow: inset 0 0 0 2px #555; }
.player .p-elo { color: var(--muted); font-weight: 500; }
.player .you { margin-left: auto; font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--blue); }
.player.turn .av { box-shadow: 0 0 0 2px var(--green); }
.player.turn::after { content: "am Zug"; margin-left: auto; color: var(--green); font-size: .8rem; font-weight: 800; }
.player.turn .you { margin-left: 8px; order: 2; }
.side { position: sticky; top: 76px; display: grid; gap: 14px; max-height: calc(100vh - 96px); overflow-y: auto; }
.side .moves { max-height: none; }
.status { margin: 0; font-weight: 800; font-size: 1.15rem; }
.status.alert-check { color: #ff8a82; animation: shake .35s; }
.copy { display: flex; gap: 8px; }
.copy .field { font-size: .8rem; padding: 8px 10px; }
.moves { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; font-weight: 700; font-size: .92rem; border-radius: 8px; background: #1e1f22; }
.moves li { display: grid; grid-template-columns: 2.6em 1fr 1fr; align-items: center; gap: 4px; padding: 3px 8px; }
.moves li:nth-child(even) { background: #25262a; }
.moves .mn { color: var(--muted); font-weight: 600; }
.moves:not(.clickable) li:last-child span:not(.mn):last-child:not(:empty),
.moves:not(.clickable) li:last-child:has(span:last-child:empty) span:nth-child(2) { color: #fff; background: var(--raised); border-radius: 4px; }
.moves:not(.clickable) li span:not(.mn) { padding: 1px 6px; }
.side-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.side-actions form { margin: 0; }
.banner { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 4px; text-align: center; background: rgba(17, 18, 20, .72); backdrop-filter: blur(2px); animation: drop .4s var(--pop); }
.banner[hidden] { display: none; }
.banner b { font-size: clamp(1.8rem, 6vw, 3rem); font-weight: 800; letter-spacing: -.02em; animation: tile-in .5s var(--pop) backwards .1s; }
.banner span { color: var(--muted); font-weight: 700; }
.banner.win b { color: var(--gold); }
.confetti { position: absolute; top: -10px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; pointer-events: none; }
@keyframes fall { to { transform: translateY(700px) rotate(720deg); opacity: .2; } }

@media (max-width: 900px) {
  .chess-game { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .lobby-cols { grid-template-columns: 1fr; }
  .hero-card { grid-template-columns: auto 1fr; }
  .new-game { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .chess-game { margin: 0 -8px; }
  .moves { max-height: 180px; }
  .hero-icon { width: 56px; height: 56px; } .hero-icon svg, .hero-icon img { width: 36px; height: 36px; }
}

/* ---------- Analyse ---------- */
.btn.alt { --b: #7b4dff; --bd: #4b2bb0; }
.banner .btn { margin-top: 10px; }
.board-row { display: grid; grid-template-columns: 22px 1fr; gap: 8px; }
.evalbar { position: relative; border-radius: 6px; overflow: hidden; background: #2a2c30; box-shadow: inset 0 0 0 2px #0e0f10; display: flex; flex-direction: column-reverse; }
.evalbar.flip { flex-direction: column; }
.evalbar-w { background: #f1f1f1; height: 50%; transition: height .35s var(--pop); }
.evalbar span { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: .62rem; font-weight: 800; color: #191b1d; writing-mode: vertical-rl; transform: rotate(180deg); }
.evalbar.flip span { bottom: auto; top: 6px; }
.nav { display: grid; grid-template-columns: 1fr 1fr 1.4fr 1fr 1fr; gap: 8px; }
.nav .btn { font-size: 1rem; }
.engine-box { display: grid; gap: 10px; }
.engine-box .btn.big { margin: 0; }
.progress { height: 8px; border-radius: 999px; background: #121315; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), #7b4dff); transition: width .2s; }
.dot.w { background: #f4f4f4; } .dot.b { background: #1b1b1b; box-shadow: inset 0 0 0 2px #555; }
.graph { width: 100%; height: 90px; border-radius: 8px; cursor: pointer; display: block; }
.g-bg { fill: #2a2c30; } .g-area { fill: #f1f1f1; } .g-line { fill: none; stroke: #fff; stroke-width: .6; vector-effect: non-scaling-stroke; }
.g-mid { stroke: var(--muted); stroke-width: .3; stroke-dasharray: 1 1; vector-effect: non-scaling-stroke; }
.g-cur { stroke: var(--blue); stroke-width: 2; vector-effect: non-scaling-stroke; }
.hint-line { margin: 0; font-weight: 700; min-height: 1.5em; }
.moves.clickable li { padding: 1px 8px; }
.moves.clickable .mv { text-align: left; border: 0; background: none; border-radius: 6px; padding: 3px 6px; font-weight: 700; color: var(--text); }
.moves.clickable .mv:hover { background: var(--raised); }
.moves.clickable .mv.on { background: var(--blue); color: #fff; }
.cm-chessboard .arrow-success { opacity: .85; }

/* bot, draw offers, game history */
.bot-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; }
.bot-card h2 { margin: 0 0 4px; }
.bot-card .fine { margin: 0; }
.bot-levels { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.bot-levels { align-items: center; gap: 14px; }
.bot-elo { display: grid; gap: 6px; font-weight: 800; min-width: min(260px, 100%); }
.bot-elo output { color: var(--gold); font-size: 1.3rem; }
.bot-elo input[type=range] { width: 100%; accent-color: var(--blue); height: 28px; }
.draw-box { padding: 12px; border-radius: 12px; background: var(--raised); border: 2px solid var(--gold); animation: drop .3s var(--pop); }
.draw-box p { margin: 0 0 8px; }
.history .game-row a { flex: 1; }
.history .meta { color: var(--muted); font-size: .85rem; font-weight: 600; }
@media (max-width: 600px) { .history .meta { display: none; } }
.hint-line .cmp { display: grid; gap: 4px; margin-top: 8px; font-weight: 600; font-size: .92rem; }
.hint-line .cmp > span { padding: 6px 10px; border-radius: 8px; background: var(--raised); border-left: 4px solid; }
.hint-line .played { border-color: #ff9b42; color: var(--text); }
.hint-line .better { border-color: #3ddc97; color: var(--text); }

/* Microsoft school login */
.btn.ms { --b: #fff; --bd: #c9ccd3; color: #1a1a1a; width: 100%; gap: 10px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; font-weight: 700; margin: 18px 0 4px; }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: var(--line); }

/* ---------- Börse ---------- */
.boerse { max-width: 1100px; margin: 0 auto; display: grid; gap: 18px; }
.boerse h2 { margin: 0 0 6px; }
.wallet { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px;
  background: linear-gradient(135deg, rgba(255, 194, 26, .22), transparent 60%), var(--surface); }
.wallet > div { display: grid; }
.wallet b { font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 800; font-variant-numeric: tabular-nums; }
.wallet b.small { font-size: .95rem; line-height: 1.3; }
.wallet form { margin-left: auto; }
.btn.gold { --b: var(--gold); --bd: #b07d00; color: #1a1a1a; }
.alert.ok { background: rgba(0, 176, 111, .18); border-color: var(--green); color: var(--text); }
.up { color: #3ddc97; } .down { color: #ff5c52; }
.flash-up { animation: flash-up .8s; } .flash-down { animation: flash-down .8s; }
@keyframes flash-up { from { background: rgba(0, 176, 111, .45); } }
@keyframes flash-down { from { background: rgba(229, 55, 44, .45); } }
.spark polyline { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark.up polyline { stroke: #3ddc97; } .spark.down polyline { stroke: #ff5c52; }
.menu-coins { margin: 0 0 6px; font-weight: 800; color: var(--gold); }

/* ---------- Kampagnen ---------- */
.kampagnen .stack { max-width: 560px; }
.campaign { display: grid; gap: 10px; }
.campaign-img { width: 100%; height: auto; max-height: 240px; object-fit: contain; border-radius: 10px; background: var(--raised); display: block; }
.campaign-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.campaign-head h3 { margin: 0; }
.campaign .fine { margin: 0; overflow-wrap: anywhere; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.kpis div { display: grid; padding: 10px; border-radius: 10px; background: var(--raised); }
.kpis b { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpis span { color: var(--muted); font-size: .8rem; font-weight: 700; }
.days summary { cursor: pointer; font-weight: 700; }
.days table { width: 100%; border-collapse: collapse; font-size: .88rem; margin-top: 8px; }
.days th, .days td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.days .n { text-align: right; font-variant-numeric: tabular-nums; }

/* campaign slot under the topbar */
.spot { max-width: 760px; margin: 0 auto 18px; }
.spot-link { display: block; text-decoration: none; color: var(--text); border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: 0 4px 0 #111214; }
.spot-link img { width: 100%; height: auto; aspect-ratio: 4 / 1; object-fit: cover; display: block; }
.spot-link.f-leiste img { aspect-ratio: 8 / 1; }
.spot-link.f-quadrat, .spot-link.f-breit { display: grid; grid-template-columns: auto 1fr; align-items: center; }
.spot-link.f-quadrat img { width: 120px; aspect-ratio: 1; }
.spot-link.f-breit img { width: 213px; aspect-ratio: 16 / 9; }
.spot-link.f-quadrat .spot-meta, .spot-link.f-breit .spot-meta { flex-direction: column; align-items: flex-start; padding: 10px 14px; }
.spot-link.f-quadrat .spot-by, .spot-link.f-breit .spot-by { margin-left: 0; }
@media (max-width: 560px) { .spot-link.f-quadrat img { width: 88px; } .spot-link.f-breit img { width: 140px; } }
.spot-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 8px 12px; font-size: .88rem; }
.spot-by { margin-left: auto; color: var(--muted); font-size: .78rem; font-weight: 700; }
.spot-link:hover .spot-meta b { text-decoration: underline; }
.alert.ok { animation: none; margin: 0; }
.campaign .campaign-img, #img-preview { max-width: 480px; }
.boerse > *, .boerse .lobby-cols > * { min-width: 0; } /* let wide tables scroll inside .table-wrap instead of widening the page */
@media (max-width: 420px) { .tools .lbl { display: none; } .switch a { padding-left: 9px; padding-right: 9px; } }

/* ---------- Icons (Free Icon Pack) ---------- */
.ico { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.fine .ico, .menu-coins .ico { width: 18px; height: 18px; margin-right: 5px; }
.btn .ico { width: 18px; height: 18px; }
.badge .ico { width: 17px; height: 17px; }
.hero-icon img { width: 46px; height: 46px; }
.like .ico { width: 22px; height: 22px; filter: grayscale(1) brightness(.85); transition: filter .15s; }
.like:hover .ico { filter: grayscale(.4); }
.like.on { background: var(--raised); color: var(--text); box-shadow: 0 2px 0 #15171a, inset 0 0 0 2px #e8456a; }
.like.on .ico { filter: none; }
.like.pop .ico { animation: pop .45s var(--pop); }
.icon-btn .ico { filter: grayscale(1); transition: filter .15s; }
.icon-btn:hover .ico { filter: none; }
#news .ico { width: 16px; height: 16px; margin-right: 3px; vertical-align: -3px; }
.parts { display: flex; flex-wrap: wrap; gap: 2px 14px; }

/* ---------- buy likes on the wall ---------- */
.buy { position: relative; }
.buy > summary { list-style: none; cursor: pointer; }
.buy > summary::-webkit-details-marker { display: none; }
.buy[open] > summary { background: var(--raised); opacity: 1; }
.buy[open] > summary .ico { filter: none; }
.buy-form {
  position: absolute; bottom: calc(100% + 8px); left: 50%; translate: -50% 0; z-index: 5; width: 190px;
  display: grid; gap: 8px; padding: 10px; border-radius: 12px; background: var(--raised); box-shadow: 0 10px 24px rgba(0, 0, 0, .5);
  animation: pop-in .15s var(--pop);
}
@keyframes pop-in { from { transform: scale(.9); opacity: 0; } }
.buy-n { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.buy-n input { position: absolute; opacity: 0; pointer-events: none; }
.buy-n span { display: block; text-align: center; padding: 7px 0; border-radius: 8px; font-weight: 800; background: var(--bg); cursor: pointer; }
.buy-n input:checked + span { background: var(--gold); color: #1a1a1a; }
.buy-n input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }
.buy-form .btn { width: 100%; gap: 6px; }
.buy-err { margin: 0; font-size: .85rem; color: var(--red); text-align: center; }

/* ---------- Börse: cards, ticker, depot, detail ---------- */
.wallet-total b { font-size: clamp(1.9rem, 6vw, 2.8rem); color: var(--gold); }
.wallet .fine .ico { margin-right: 4px; }
.ticker { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ticker li { padding: 9px 14px; border-radius: var(--r); background: var(--surface); font-weight: 600; box-shadow: 0 3px 0 #111214; }
.ticker li > span { display: inline-flex; align-items: center; gap: 4px; min-width: 84px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ticker:empty { display: none; }
.stocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.stock {
  display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none;
  box-shadow: 0 4px 0 #111214; transition: transform .12s var(--pop), box-shadow .12s;
}
.stock:hover { transform: translateY(-3px); box-shadow: 0 7px 0 #111214; }
.stock:active { transform: translateY(2px); box-shadow: 0 1px 0 #111214; }
.stock:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.stock-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.stock-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sym { color: var(--muted); font-size: .78rem; font-weight: 700; }
.stock-px { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.stock-px .px { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; border-radius: 6px; padding: 0 4px; margin-left: -4px; }
.chg { font-weight: 800; font-size: .85rem; font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .06); }
.stock .spark { width: 100%; height: 34px; }
.stock-held { display: flex; align-items: center; gap: 5px; font-size: .82rem; font-weight: 700; color: var(--gold); }
.stock-held .ico { width: 16px; height: 16px; }
.depot { list-style: none; margin: 0; padding: 4px 0; }
.depot li + li { border-top: 1px solid var(--line); }
.depot a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; color: var(--text); text-decoration: none; }
.depot a:hover { background: var(--raised); }
.depot .nm { display: grid; min-width: 0; font-weight: 700; }
.depot .val { display: grid; justify-items: end; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 800; }
.depot .val .sym { display: flex; align-items: center; gap: 4px; }
.depot .val .ico { width: 15px; height: 15px; }
.quotes .nm { flex: 1; }
.quotes .spark { flex: none; width: 120px; height: 30px; }
.quotes .val { grid-auto-flow: row; gap: 2px; }
@media (max-width: 560px) { .quotes .spark { display: none; } }
.quotes .nm { font-weight: 600; }
p.panel.fine { margin: 0; padding: 14px 16px; }

.back { justify-self: start; color: var(--muted); font-weight: 700; text-decoration: none; }
.back::before { content: "‹ "; }
.back:hover { color: var(--text); }
.aktie-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; }
.aktie-head h1 { margin: 0; font-size: clamp(1.3rem, 4vw, 2rem); overflow-wrap: anywhere; }
.aktie-px { display: grid; justify-items: end; gap: 4px; }
.aktie-px .px { font-size: clamp(2rem, 7vw, 3rem); font-weight: 800; font-variant-numeric: tabular-nums; border-radius: 8px; padding: 0 6px; }
.aktie-px .sym { display: flex; align-items: center; gap: 4px; font-size: .95rem; }
.chart { grid-column: 1 / -1; width: 100%; height: 180px; }
.chart polyline { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart.up polyline { stroke: #3ddc97; } .chart.down polyline { stroke: #ff5c52; }
.chart.up polygon { fill: rgba(61, 220, 151, .14); } .chart.down polygon { fill: rgba(255, 92, 82, .14); }
.deal { display: grid; gap: 10px; }
.qty-row { display: grid; grid-template-columns: 1fr repeat(3, auto); gap: 6px; }
.qty-row .btn { padding: 8px 12px; background: var(--raised); box-shadow: 0 3px 0 #15171a; }
.deal-sum { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 1.1rem; }
.deal-sum b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.deal-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
@media (max-width: 600px) { .aktie-head { grid-template-columns: 1fr; } .aktie-px { justify-items: start; } .chart { height: 130px; } }
.trade { display: flex; gap: 6px; align-items: center; margin: 0; }
.trade .qty { width: 90px; padding: 7px 8px; }
.trade .btn { padding: 7px 10px; font-size: .85rem; }
.kpis b span { font-size: inherit; color: inherit; } .kpis b .up { color: #3ddc97; } .kpis b .down { color: #ff5c52; }

/* ---------- Moderation ---------- */
.mod-tabs { display: flex; gap: 4px; background: var(--surface); border-radius: 12px; padding: 4px; margin-bottom: 14px; width: fit-content; max-width: 100%; overflow-x: auto; }
.mod-tabs a { padding: 8px 16px; border-radius: 9px; font-weight: 800; color: var(--muted); text-decoration: none; white-space: nowrap; }
.mod-tabs a:hover { color: var(--text); }
.mod-tabs a.on { background: var(--raised); color: var(--text); box-shadow: 0 2px 0 #15171a; }
.mod-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips a { padding: 6px 12px; border-radius: 999px; background: var(--surface); color: var(--muted); font-weight: 700; text-decoration: none; font-size: .9rem; }
.chips a:hover { color: var(--text); }
.chips a.on { background: var(--blue); color: #fff; }
.chips .num, .mod-tabs .num, .menu-mod .num { margin-left: 2px; }
.search { margin: 0; flex: 0 1 260px; }
.search .field { padding: 8px 12px; }
.aq { display: grid; gap: 8px; margin-bottom: 12px; padding: 14px 16px; }
.aq blockquote { margin: 0; font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.aq .parts .ico { width: 15px; height: 15px; margin-right: 3px; }
.aq-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.aq-actions .btn, .users .btn { padding: 7px 12px; font-size: .88rem; }
.aq-edit summary { cursor: pointer; color: var(--muted); font-weight: 700; font-size: .88rem; width: fit-content; }
.aq-edit summary:hover { color: var(--text); }
.aq-edit[open] summary { margin-bottom: 8px; }
.u-main { display: grid; gap: 4px; min-width: 0; }
.u-main .parts .ico { width: 15px; height: 15px; margin-right: 3px; }
.menu summary { position: relative; }
.dot-alert { position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--bg); }
.menu-mod { display: flex; align-items: center; justify-content: space-between; }

/* ---------- Kampagnen-Manager: collapsible sections, compact rows ---------- */
.new-campaign > summary, .over > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.new-campaign > summary::-webkit-details-marker, .over > summary::-webkit-details-marker { display: none; }
.new-campaign > summary h2, .over > summary h2 { margin: 0; }
.new-campaign > summary::before, .over > summary::before { content: "+"; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--raised); font-weight: 800; }
.new-campaign[open] > summary::before, .over[open] > summary::before { content: "−"; }
.new-campaign[open] > summary { margin-bottom: 12px; }
.over[open] > summary { margin-bottom: 10px; }
.crows { list-style: none; margin: 0; padding: 4px 0; }
.crow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; flex-wrap: wrap; }
.crow + .crow { border-top: 1px solid var(--line); }
.crow > img { width: 96px; height: 24px; object-fit: cover; border-radius: 6px; background: var(--raised); flex: none; }
.crow-main { display: grid; gap: 4px; flex: 1; min-width: 160px; overflow-wrap: anywhere; }
.crow-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.crow-actions form { margin: 0; }
.crow-actions .btn { padding: 7px 12px; font-size: .88rem; }
.kampagnen .mod-tabs { margin-top: 10px; }

/* ---------- Nutzer: add address, roles ---------- */
.add-user { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-bottom: 14px; padding: 12px; }
.u-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.u-actions form { margin: 0; }
.role-form { display: flex; gap: 4px; }
.role-form .field { padding: 6px 8px; width: auto; font-size: .88rem; }
@media (max-width: 600px) { .add-user { grid-template-columns: 1fr; } }

/* chess: last move */
.cm-chessboard .markers .marker.marker-last { fill: #f5f682; opacity: .5; }
.cm-chessboard .markers .marker.marker-opp { fill: none; stroke: #f5f682; stroke-width: 5px; opacity: .95; animation: opp-pulse .9s ease-out 2; }
@keyframes opp-pulse { 50% { stroke-width: 10px; opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .cm-chessboard .markers .marker.marker-opp { animation: none; } }

/* ---------- Partieanalyse: move classes (chess.com names, own icons) ---------- */
.k-brilliant { --k: #26c2a3; } .k-great { --k: #749bbf; } .k-best { --k: #81b64c; } .k-excellent { --k: #96bc4b; } .k-good { --k: #95af8a; }
.k-book { --k: #a88764; } .k-inaccuracy { --k: #f7c045; } .k-mistake { --k: #ffa459; } .k-miss { --k: #ff7769; } .k-blunder { --k: #fa412d; }
.cls { display: inline-grid; place-items: center; flex: none; width: 1.35em; height: 1.35em; border-radius: 50%; background: var(--k); color: #fff;
  font-size: .78em; font-weight: 900; letter-spacing: -.06em; line-height: 1; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); vertical-align: -.25em; }
.cls svg { width: 64%; height: 64%; fill: currentColor; }
.cls-brilliant { --k: #26c2a3; } .cls-great { --k: #749bbf; } .cls-best { --k: #81b64c; } .cls-excellent { --k: #96bc4b; } .cls-good { --k: #95af8a; }
.cls-book { --k: #a88764; } .cls-inaccuracy { --k: #f7c045; } .cls-mistake { --k: #ffa459; } .cls-miss { --k: #ff7769; } .cls-blunder { --k: #fa412d; }
.board-badge { position: absolute; z-index: 3; width: 7%; aspect-ratio: 1; transform: translate(-70%, -30%); pointer-events: none; font-size: clamp(14px, 3.4vw, 26px); }
.board-badge .cls { width: 100%; height: 100%; font-size: .9em; animation: pop-in .25s var(--pop); }
.summary { display: grid; gap: 2px; background: var(--raised); border-radius: 12px; padding: 12px; animation: tile-in .4s var(--pop); }
.rep-head, .rep-acc, .rep-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.rep-head { grid-template-columns: 1fr 1fr; font-weight: 800; font-size: .88rem; margin-bottom: 6px; }
.rep-head > span:first-child { display: none; }
.rep-player { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-player:last-child { justify-content: flex-end; }
.rep-player .dot { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.rep-acc { margin-bottom: 8px; }
.rep-acc span { grid-column: 2; grid-row: 1; color: var(--muted); font-size: .78rem; font-weight: 700; }
.rep-acc b { grid-row: 1; font-size: 1.5rem; font-weight: 800; text-align: center; background: #f1f1f1; color: #191b1d; border-radius: 8px; padding: 2px 0; }
.rep-acc b:first-of-type { grid-column: 1; } .rep-acc b.dark { grid-column: 3; background: #191b1d; color: #fff; box-shadow: inset 0 0 0 2px #3b3e43; }
.rep-row { font-size: .88rem; font-weight: 700; padding: 1px 0; }
.rep-label { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.rep-label .cls { font-size: .95rem; }
.kind-jump { all: unset; cursor: pointer; text-align: center; border-radius: 6px; padding: 2px 0; font-weight: 800; color: var(--k); font-variant-numeric: tabular-nums; }
.kind-jump:hover:not(:disabled), .kind-jump:focus-visible { background: var(--surface); }
.kind-jump:focus-visible { outline: 2px solid var(--blue); }
.kind-jump:disabled { cursor: default; color: var(--muted); opacity: .4; }
.moves.clickable .mv { display: flex; align-items: center; gap: 6px; min-width: 0; }
.moves.clickable .mv .cls { width: 18px; height: 18px; font-size: 10px; vertical-align: 0; box-shadow: none; }
.moves.clickable .mv .cls svg { width: 12px; height: 12px; }
.moves.clickable .mv.on .cls { box-shadow: 0 0 0 1.5px #fff; }
.hint-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hint-line > .cls { font-size: 1.2rem; }
.hint-line .cmp { flex-basis: 100%; }
.hint-line .better .cls { font-size: .9rem; margin-right: 6px; }
.g-brilliant { fill: #26c2a3; } .g-great { fill: #749bbf; } .g-mistake { fill: #ffa459; } .g-miss { fill: #ff7769; } .g-blunder { fill: #fa412d; }

/* chess clock */
.player .clock { margin-left: auto; order: 3; min-width: 4.2em; text-align: center; padding: 4px 10px; border-radius: 8px; background: #111214; color: var(--muted); font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.player .clock.on { background: #f4f4f4; color: #1b1b1b; }
.player .clock.low { color: #ff5c52; }
.player .clock.on.low { background: #ff5c52; color: #fff; }
.player:has(.clock).turn::after { display: none; }
.player:has(.clock) .you { margin-left: 8px; }
.clock-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.clock-pick input { position: absolute; opacity: 0; pointer-events: none; }
.clock-pick span { display: block; padding: 6px 12px; border-radius: 999px; background: var(--raised); font-weight: 800; font-size: .88rem; cursor: pointer; }
.clock-pick input:checked + span { background: var(--blue); color: #fff; }
.clock-pick input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }
.clock-pill { margin-left: auto; }
.clock-pill + form, .clock-pill + .pill { margin-left: 8px; }

/* Handels-Bots */
.bots h1 { margin: 8px 0 16px; }
.bot-new { display: grid; gap: 8px; margin-top: 16px; }
.bot-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 12px; }
.bot-title { font-size: 1.3rem; font-weight: 800; max-width: 420px; }
.bot-editor { height: min(62vh, 620px); min-height: 380px; border-radius: 12px; overflow: hidden; background: #1b1c1f; }
.bot-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 18px; }
.bot-bar form { margin: 0; }
.bot-bar #save-status { margin-right: auto; }
.bot-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .9rem; max-height: 320px; overflow: auto; }
.bot-log time { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 10px; font-size: .8rem; }
.blocklyToolboxCategoryLabel { font-family: Montserrat, system-ui, sans-serif; font-weight: 700; }
.blocklyTreeRow, .blocklyToolboxCategory { padding: 4px 6px; }
@media (max-width: 560px) {
  .blocklyToolboxCategoryLabel { font-size: .78rem; }
  .blocklyTreeRow, .blocklyToolboxCategory { padding: 2px 0; }
  .bot-editor { min-height: 440px; }
}

.bot-tabs { display: inline-flex; margin-bottom: 10px; }
.bot-tabs .tab { border: 0; background: none; font: inherit; cursor: pointer; }
.bot-code textarea { width: 100%; min-height: 380px; height: min(62vh, 620px); resize: vertical; font: 500 .92rem/1.55 ui-monospace, "Cascadia Code", Consolas, monospace; tab-size: 4; white-space: pre; overflow: auto; }
.bot-help { margin-top: 10px; padding: 14px 18px; }
.bot-help summary { cursor: pointer; font-weight: 800; }
.bot-help dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0 8px; }
.bot-help dt { font-weight: 800; }
.bot-help dd { margin: 0; line-height: 1.8; }
.bot-help code { background: var(--raised); padding: 1px 6px; border-radius: 5px; font-size: .85rem; }
@media (max-width: 560px) { .bot-help dl { grid-template-columns: 1fr; } }

/* chess.com-like lobby: preview board left, bot picker right */
.av { width: 40px; height: 40px; flex: none; border-radius: 6px; object-fit: contain; background: #3a3b3f; padding: 3px; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; }
.av-w { background: #f4f4f4; color: #1b1b1b; } .av-b { background: #1b1b1b; color: #f4f4f4; box-shadow: inset 0 0 0 2px #444; }
.rep-player .av { width: 22px; height: 22px; font-size: .75rem; padding: 1px; border-radius: 4px; }
.play { display: grid; grid-template-columns: minmax(0, 600px) minmax(280px, 380px); gap: 24px; justify-content: center; align-items: start; margin-bottom: 32px; }
.play-board { display: grid; gap: 8px; }
.pbar { display: flex; align-items: center; gap: 10px; font-weight: 700; min-height: 44px; }
.pbar .p-elo { color: var(--muted); font-weight: 500; }
.preview-board { display: grid; grid-template: repeat(8, minmax(0, 1fr)) / repeat(8, minmax(0, 1fr)); aspect-ratio: 1; border-radius: 6px; overflow: hidden; box-shadow: 0 6px 0 #0e0f10, 0 16px 30px rgba(0, 0, 0, .45); }
.preview-board span { position: relative; display: grid; place-items: center; min-height: 0; }
.preview-board .lt { background: #ebecd0; color: #739552; } .preview-board .dk { background: #739552; color: #ebecd0; }
.preview-board svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.preview-board i { position: absolute; font-style: normal; font-weight: 700; font-size: clamp(8px, 1.6vw, 13px); line-height: 1; }
.preview-board .rk { top: 3px; left: 3px; } .preview-board .fl { bottom: 3px; right: 4px; }
.play-panel { padding: 0; overflow: hidden; display: grid; }
.pp-tabs { display: grid; grid-template-columns: 1fr 1fr; background: #1e1f22; }
.pp-tabs button { all: unset; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 8px; font-weight: 800; color: var(--muted); border-bottom: 3px solid transparent; }
.pp-tabs button.on { color: var(--text); border-bottom-color: var(--green); background: var(--surface); }
.pp-tabs button:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.pp-body { display: grid; gap: 14px; padding: 18px; margin: 0; }
.pp-body[hidden] { display: none; }
.pp-body h3 { margin: 8px 0 0; font-size: 1rem; }
.bot-hero { display: flex; align-items: center; gap: 14px; }
.bot-hero img { width: 96px; height: 96px; flex: none; border-radius: 10px; background: #3a3b3f; padding: 8px; }
.bubble { position: relative; margin: 0; padding: 10px 14px; border-radius: 12px; background: #f4f4f4; color: #1b1b1b; font-weight: 700; font-size: .92rem; line-height: 1.35; }
.bubble::before { content: ""; position: absolute; left: -7px; top: 50%; translate: 0 -50%; border: 7px solid transparent; border-left: 0; border-right-color: #f4f4f4; }
.bot-id { margin: 0; display: flex; align-items: baseline; gap: 8px; font-size: 1.25rem; }
.bot-id .p-elo { color: var(--muted); font-size: 1rem; font-weight: 600; }
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
.bot-grid label { position: relative; display: grid; justify-items: center; gap: 2px; padding: 4px; border-radius: 8px; cursor: pointer; font-size: .72rem; font-weight: 800; color: var(--muted); }
.bot-grid input { position: absolute; opacity: 0; pointer-events: none; }
.bot-grid img { width: 100%; max-width: 56px; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: #3a3b3f; padding: 5px; }
.bot-grid label:hover img { background: #46474c; }
.bot-grid label:has(input:checked) img { box-shadow: 0 0 0 3px var(--green); }
.bot-grid label:has(input:checked) { color: var(--text); }
.bot-grid label:has(input:focus-visible) img { outline: 2px solid #fff; outline-offset: 3px; }
.bot-elo { display: grid; gap: 6px; font-weight: 800; }
.bot-elo[hidden] { display: none; }
.play-btn { --b: #81b64c; --bd: #45753c; font-size: 1.35rem; padding: 16px; width: 100%; margin: 0; }
.bot-say { display: flex; align-items: center; gap: 12px; }
.bot-say[hidden] { display: none; }
.bot-say img { width: 56px; height: 56px; flex: none; border-radius: 8px; background: #3a3b3f; padding: 4px; }
@media (max-width: 900px) {
  .play { grid-template-columns: 1fr; }
  .play-board { max-width: 520px; width: 100%; justify-self: center; }
}
@media (max-width: 520px) {
  .play-board { display: none; }
  .bot-hero img { width: 72px; height: 72px; }
}

/* ================= Loot ================= */
.r-g { --rc: #8a9bb5; } .r-s { --rc: #4b8bff; } .r-e { --rc: #a065ff; } .r-l { --rc: #ff4fa3; } .r-m { --rc: #ffc21a; }
.hue-red { --hc: #e5484d; } .hue-brown { --hc: #b9773b; } .hue-gold { --hc: #f2b01e; } .hue-purple { --hc: #8e5cff; } .hue-blue { --hc: #3a8dff; }
.loot { max-width: 1040px; margin: 0 auto; }
.loot-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.loot-head h1 { margin: 0; margin-right: auto; }
.loot h1 + .loot-grid, .loot-grid + h1 { margin-top: 0; }
.loot-grid + h1 { margin-top: 32px; margin-bottom: 16px; }
.loot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.loot-card { position: relative; display: grid; justify-items: center; gap: 8px; padding: 18px 16px 16px; border-radius: 16px; text-decoration: none; color: var(--text);
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--hc) 45%, transparent), transparent 70%), var(--surface);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--hc) 35%, transparent), 0 5px 0 #0e0f10; transition: translate .15s var(--pop), box-shadow .15s; }
.loot-card:hover, .loot-card:focus-visible { translate: 0 -4px; box-shadow: inset 0 0 0 2px var(--hc), 0 9px 0 #0e0f10; }
.loot-card b { font-size: 1.15rem; }
.loot-card b .fine { display: block; text-align: center; font-weight: 600; }
.lc-art { height: 132px; display: grid; place-items: center; }
.lc-art > img { width: 120px; height: 120px; filter: drop-shadow(0 8px 0 rgba(0, 0, 0, .35)); transition: rotate .2s var(--pop), scale .2s var(--pop); }
.loot-card:hover .lc-art > img { rotate: -6deg; scale: 1.08; }
.lc-prog { width: 100%; height: 8px; border-radius: 999px; background: #121315; overflow: hidden; }
.lc-prog span { display: block; height: 100%; background: var(--hc, var(--green)); border-radius: inherit; }
.pack-mini { width: 96px; height: 128px; border-radius: 10px; display: grid; place-items: center; rotate: -4deg;
  background: linear-gradient(155deg, color-mix(in srgb, var(--hc) 80%, #fff 20%), var(--hc) 55%, color-mix(in srgb, var(--hc) 60%, #000)); box-shadow: 0 6px 0 rgba(0, 0, 0, .35); }
.pack-mini img { width: 70px; height: 70px; }

/* contents and collection tiles */
.loot-tiles { list-style: none; margin: 0 0 24px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.lt { position: relative; display: grid; justify-items: center; gap: 2px; padding: 12px 8px 10px; border-radius: 12px; text-align: center;
  background: linear-gradient(180deg, var(--surface) 55%, color-mix(in srgb, var(--rc) 28%, var(--surface))); box-shadow: inset 0 -4px 0 var(--rc); }
.lt img { width: 84px; height: 84px; }
.lt-name { font-weight: 800; font-size: .92rem; }
.lt-r { font-size: .75rem; font-weight: 700; color: var(--rc); }
.lt.missing img { filter: brightness(0) opacity(.35); }
.lt.missing .lt-name { color: var(--muted); }
.lt-n { position: absolute; top: 6px; right: 8px; font-size: .75rem; font-weight: 800; color: var(--muted); }
.lt-holo { position: absolute; top: 6px; left: 8px; font-size: .7rem; font-weight: 800; padding: 1px 6px; border-radius: 999px; color: #1b1b1b;
  background: linear-gradient(90deg, #ff9de2, #9de8ff, #c6ff9d, #ffe59d); }
.odds { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: -6px 0 14px; font-size: .85rem; font-weight: 700; }
.odds span { color: var(--rc); }
.coll-total { font-weight: 800; color: var(--muted); }
.coll-head { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 4px 12px; margin: 18px 0 12px; }
.coll-head h2 { margin: 0; }
.coll-head .fine { justify-self: end; font-weight: 800; }
.coll-head .lc-prog { grid-column: 1 / -1; --hc: var(--green); }

/* case reel */
.reel-box { position: relative; margin-bottom: 14px; }
.reel { position: relative; overflow: hidden; border-radius: 14px; background: #121315; box-shadow: inset 0 0 0 2px #2a2c30;
  -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.reel-strip { display: flex; padding: 12px 0; will-change: transform; }
.rt { flex: none; width: 150px; margin: 0 4px; padding: 10px 6px 8px; border-radius: 10px; display: grid; justify-items: center; gap: 4px; box-sizing: border-box;
  background: linear-gradient(180deg, #1e1f22 50%, color-mix(in srgb, var(--rc) 35%, #1e1f22)); box-shadow: inset 0 -4px 0 var(--rc); }
.rt img { width: 96px; height: 96px; }
.rt span { font-size: .8rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.reel-mark { position: absolute; top: -6px; bottom: -6px; left: 50%; width: 4px; translate: -50% 0; border-radius: 4px; background: var(--hc, var(--gold)); box-shadow: 0 0 12px var(--hc, var(--gold)); pointer-events: none; }
.reel-mark::before, .reel-mark::after { content: ""; position: absolute; left: 50%; translate: -50% 0; border: 9px solid transparent; }
.reel-mark::before { top: 0; border-top-color: var(--hc, var(--gold)); }
.reel-mark::after { bottom: 0; border-bottom-color: var(--hc, var(--gold)); }
.drop { display: flex; align-items: center; gap: 18px; padding: 16px 20px; margin-bottom: 14px; border-radius: 14px; font-weight: 700;
  background: radial-gradient(80% 140% at 0% 50%, color-mix(in srgb, var(--rc, #555) 40%, transparent), transparent 70%), var(--surface);
  box-shadow: inset 0 0 0 2px var(--rc, #333); animation: drop .45s var(--pop); }
.drop[hidden] { display: none; }
.drop img { width: 120px; height: 120px; filter: drop-shadow(0 0 18px var(--rc)); }
.drop b { display: block; font-size: 1.6rem; line-height: 1.15; }
.drop-r { color: var(--rc); font-weight: 800; }
.drop .new { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 999px; background: var(--green); color: #fff; font-size: .8rem; }
.drop.r-l img, .drop.r-m img { animation: glow 1.2s ease-in-out infinite alternate; }
@keyframes glow { to { filter: drop-shadow(0 0 34px var(--rc)); scale: 1.06; } }
.open-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin-bottom: 26px; }
.open-btn { --b: var(--hc); --bd: color-mix(in srgb, var(--hc) 55%, #000); font-size: 1.25rem; padding: 14px 34px; color: #fff; }
.open-btn[hidden] { display: none; }
.fast { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); cursor: pointer; }

/* card pack */
.pack-stage { min-height: 330px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 16px; padding: 18px 10px;
  background: radial-gradient(60% 80% at 50% 40%, color-mix(in srgb, var(--hc) 30%, transparent), transparent 75%), #141518; }
.pack { all: unset; cursor: pointer; position: relative; width: 190px; height: 270px; border-radius: 16px; display: grid; place-items: center; align-content: center; gap: 6px; overflow: hidden;
  color: #fff; text-align: center; background: linear-gradient(155deg, color-mix(in srgb, var(--hc) 75%, #fff 25%), var(--hc) 50%, color-mix(in srgb, var(--hc) 55%, #000));
  box-shadow: 0 10px 0 rgba(0, 0, 0, .4), inset 0 0 0 3px rgba(255, 255, 255, .25); animation: bob 2.4s ease-in-out infinite; }
.pack[hidden] { display: none; }
.pack::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .35) 50%, transparent 65%); background-size: 250% 100%; animation: sheen 3s linear infinite; }
.pack b { font-size: 1.5rem; text-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.pack .fine { color: rgba(255, 255, 255, .8); }
.pack img { width: 110px; height: 110px; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .3)); }
.pack-top { position: absolute; top: 0; left: 0; right: 0; height: 26px; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .18) 0 8px, transparent 8px 16px); }
.pack:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.pack.tear { animation: shake .35s 2, tear .3s .55s forwards; }
.pack.tear .pack-top { animation: rip .3s .4s forwards; }
@keyframes bob { 50% { translate: 0 -8px; rotate: 1.5deg; } }
@keyframes sheen { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@keyframes rip { to { translate: 40px -60px; rotate: 18deg; opacity: 0; } }
@keyframes tear { to { scale: 1.25; opacity: 0; } }
.cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.cards:empty { display: none; }
.card { all: unset; cursor: pointer; width: 168px; aspect-ratio: 5 / 7; perspective: 900px; animation: deal .45s var(--pop) backwards var(--d); }
@keyframes deal { from { translate: 0 60px; scale: .6; opacity: 0; } }
.card-in { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s var(--pop); }
.card.up .card-in { transform: rotateY(180deg); }
.card:not(.up):hover .card-in { transform: translateY(-6px) rotateY(8deg); }
.card:focus-visible { outline: 3px solid #fff; outline-offset: 4px; border-radius: 14px; }
.card-back, .card-front { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.card-back { display: grid; place-items: center; box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .15), 0 6px 0 rgba(0, 0, 0, .4);
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .06) 0 10px, transparent 10px 20px), linear-gradient(160deg, #3b3e8f, #1d1f4d); }
.card-back img { opacity: .9; }
.card-front { transform: rotateY(180deg); display: grid; grid-template-rows: auto 1fr auto; padding: 8px; box-sizing: border-box; color: #1b1b1b;
  background: linear-gradient(170deg, #fff, #e9ebf2); box-shadow: inset 0 0 0 5px var(--rc), 0 6px 0 rgba(0, 0, 0, .4); }
.cf-name { font-weight: 800; font-size: .95rem; padding: 4px 6px 0; }
.cf-art { display: grid; place-items: center; margin: 4px 2px; border-radius: 8px; background: radial-gradient(circle, color-mix(in srgb, var(--rc) 55%, #fff), color-mix(in srgb, var(--rc) 85%, #000)); }
.cf-art img { width: 78%; height: auto; filter: drop-shadow(0 5px 0 rgba(0, 0, 0, .25)); }
.cf-foot { display: flex; justify-content: space-between; padding: 0 6px 3px; font-size: .72rem; font-weight: 800; color: color-mix(in srgb, var(--rc) 70%, #000); }
.cf-new { position: absolute; top: 8px; right: 8px; padding: 1px 7px; border-radius: 999px; background: var(--green); color: #fff; font-size: .68rem; font-weight: 800; }
.card.up.r-e .card-front, .card.up.r-l .card-front, .card.up.r-m .card-front { animation: rare 1s .3s; }
@keyframes rare { 40% { box-shadow: inset 0 0 0 5px var(--rc), 0 0 40px 10px var(--rc); } }
.cf-shine { position: absolute; inset: 0; mix-blend-mode: color-dodge; opacity: .55; pointer-events: none;
  background: linear-gradient(115deg, #ff7ad9 0%, #7af0ff 25%, #b6ff7a 45%, #ffe27a 65%, #ff7ad9 100%); background-size: 300% 300%; animation: holo 4s linear infinite; }
@keyframes holo { to { background-position: 300% 300%; } }
@media (max-width: 600px) {
  .rt { width: 112px; } .rt img { width: 72px; height: 72px; }
  .drop img { width: 84px; height: 84px; } .drop b { font-size: 1.25rem; }
  .card { width: calc(50% - 8px); max-width: 168px; }
  .loot-tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .lt img { width: 64px; height: 64px; }
}
@media (prefers-reduced-motion: reduce) { .pack, .pack::after, .cf-shine { animation: none; } }

/* loot: dust, pity, hints */
.dust-pill { padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: .9rem; color: #dfe8ff; background: #23262d; box-shadow: inset 0 0 0 2px #3a3f4a; }
.loot-status { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: -6px 0 14px; font-weight: 700; color: var(--muted); }
.almost { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 800; color: #1b1b1b; background: var(--gold); }
.almost.done { background: var(--green); color: #fff; }
.dust-gain, .cf-dust { color: #9fb6ff; font-weight: 800; font-size: .85rem; display: block; margin-top: 4px; }
.cf-dust { position: absolute; top: 8px; right: 8px; margin: 0; padding: 1px 7px; border-radius: 999px; background: #2b3350; color: #cfdaff; font-size: .68rem; }
.lt-new { position: absolute; top: 6px; right: 8px; font-size: .7rem; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: var(--green); color: #fff; }
.lt .craft { margin-top: 6px; padding: 4px 10px; font-size: .78rem; }
.lt form { margin: 0; }
.lt:target { outline: 3px solid var(--gold); outline-offset: 2px; }

/* loot: honest climb glow on the reel and on cards */
.reel-box[data-glow] .reel { box-shadow: inset 0 0 0 3px var(--gc), 0 0 28px var(--gc); transition: box-shadow .18s; }
.reel-box[data-glow] .reel-mark { background: var(--gc); box-shadow: 0 0 18px var(--gc); }
.reel-box[data-glow] .reel-mark::before { border-top-color: var(--gc); }
.reel-box[data-glow] .reel-mark::after { border-bottom-color: var(--gc); }
[data-glow="s"] { --gc: #4b8bff; } [data-glow="e"] { --gc: #a065ff; } [data-glow="l"] { --gc: #ff4fa3; } [data-glow="m"] { --gc: #ffc21a; }
.card.charging .card-back { box-shadow: inset 0 0 0 4px var(--gc, #fff), 0 0 34px 6px var(--gc, #fff); }
.card.charging .card-in { animation: rumble .12s linear infinite; }
@keyframes rumble { 25% { translate: -2px 1px; } 75% { translate: 2px -1px; } }
.multi { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 14px; }
.multi:empty { display: none; }
.reel-box.small { margin: 0; }
.reel-box.small .reel-strip { padding: 6px 0; }
.reel-box.small .rt { width: 110px; padding: 6px 4px; }
.reel-box.small .rt img { width: 60px; height: 60px; }
.reel-box[hidden] { display: none; }
.multi-drop { display: block; padding: 12px; }
.multi-drop .loot-tiles { margin: 0; grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* loot: flash, shake, particles */
.fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 49; opacity: 0; background: radial-gradient(circle, var(--rc, #fff), transparent 70%); }
.flash.on { animation: flash .6s ease-out; }
@keyframes flash { 10% { opacity: .55; } to { opacity: 0; } }
.loot.shake { animation: shake-big .45s; }
@keyframes shake-big { 15% { translate: -8px 3px; } 30% { translate: 7px -4px; } 45% { translate: -5px 2px; } 60% { translate: 4px -2px; } 80% { translate: -2px 1px; } }
@media (max-width: 600px) {
  .multi-drop .loot-tiles { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .reel-box.small .rt { width: 86px; } .reel-box.small .rt img { width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) { .card.charging .card-in, .loot.shake { animation: none; } }
