/* ==========================================================
   Tic-Tac-Toe – Cartoon-Stil (Standarddesign „Comic“)
   Andere Designs in themes.css überschreiben nur Variablen und Details.
   ========================================================== */

:root {
  --ink: #1d1d3b;
  --paper: #fffaf0;
  --sky-top: #4cc3ff;
  --sky-bottom: #bdeaff;
  --hill1: #7ed957;
  --hill2: #49a84f;
  --yellow: #ffd23f;
  --orange: #ff9f1c;
  --red: #ff5a5f;
  --green: #49a84f;
  --blue: #2591d6;
  --purple: #6d3f8f;
  --grey: #9aa0b5;

  --x: #ff5a5f;            /* Farbe der Kreuze */
  --o: #2591d6;            /* Farbe der Kreise */
  --board: #fffaf0;
  --board-line: var(--ink);
  --cell-hover: #fff1b8;
  --win-bg: #ffe066;
  --mark-width: 13;
  --mark-filter: none;

  --line: 3px;
  --radius: 18px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);

  --font-head: 'Luckiest Guy', 'Comic Sans MS', Impact, sans-serif;
  --font-body: 'Nunito', 'Comic Sans MS', 'Chalkboard SE', system-ui, sans-serif;
  --bounce: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(var(--sky-top), var(--sky-bottom) 75%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 400;
  letter-spacing: .5px;
  margin: 0 0 .5em;
  line-height: 1.1;
}

a { color: inherit; }
button, input { font: inherit; color: inherit; }

/* ---------------- Kulisse ---------------- */

.scenery { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

.sun {
  position: absolute; top: 24px; right: 8%;
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--yellow);
  border: var(--line) solid var(--ink);
  box-shadow: inset -10px -10px 0 #f5b700;
}
.sun-rays {
  position: absolute; inset: -34px; z-index: -1;
  background: repeating-conic-gradient(rgba(255, 210, 63, .55) 0 12deg, transparent 12deg 30deg);
  border-radius: 50%;
  animation: spin 40s linear infinite;
}

.cloud {
  position: absolute; width: 120px; height: 44px;
  background: #fff; border: var(--line) solid var(--ink); border-radius: 40px;
  animation: drift linear infinite;
}
.cloud::before, .cloud::after {
  content: ''; position: absolute; background: #fff;
  border: var(--line) solid var(--ink); border-bottom: none; border-radius: 50% 50% 0 0;
}
.cloud::before { width: 52px; height: 34px; top: -26px; left: 16px; }
.cloud::after  { width: 40px; height: 26px; top: -18px; left: 58px; }
.cloud.c1 { top: 90px;  animation-duration: 70s;  animation-delay: -10s; }
.cloud.c2 { top: 180px; animation-duration: 95s;  animation-delay: -50s; transform: scale(.7); }
.cloud.c3 { top: 40px;  animation-duration: 120s; animation-delay: -80s; transform: scale(.85); }

/* Schwebende Kreuze und Kreise */
.floater { position: absolute; width: 46px; height: 46px; opacity: .5; animation: float 14s ease-in-out infinite; }
.floater.fx::before, .floater.fx::after {
  content: ''; position: absolute; left: 50%; top: 0; width: 12px; height: 100%; margin-left: -6px;
  background: var(--x); border: var(--line) solid var(--ink); border-radius: 8px;
}
.floater.fx::before { transform: rotate(45deg); }
.floater.fx::after { transform: rotate(-45deg); }
.floater.fo { border: 11px solid var(--o); border-radius: 50%; box-shadow: 0 0 0 3px var(--ink), inset 0 0 0 3px var(--ink); }
.floater.f1 { left: 6%;  top: 28%; animation-delay: -2s; }
.floater.f2 { left: 18%; top: 62%; animation-delay: -6s; transform: scale(.7); }
.floater.f3 { left: 84%; top: 40%; animation-delay: -9s; }
.floater.f4 { left: 72%; top: 70%; animation-delay: -4s; }
.floater.f5 { left: 44%; top: 82%; animation-delay: -11s; transform: scale(.6); }
.floater.f6 { left: 92%; top: 16%; animation-delay: -7s; transform: scale(.6); }

.hills { position: absolute; bottom: 0; left: 0; width: 100%; height: 18vh; min-height: 100px; }
.hill { stroke: var(--ink); stroke-width: 3; vector-effect: non-scaling-stroke; }
.hill.h1 { fill: var(--hill1); }
.hill.h2 { fill: var(--hill2); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { from { left: -180px; } to { left: 110vw; } }
@keyframes float {
  0%, 100% { translate: 0 0; rotate: -8deg; }
  50% { translate: 0 -26px; rotate: 10deg; }
}

/* ---------------- Kopfzeile ---------------- */

.topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px clamp(12px, 3vw, 28px);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-grid { width: 52px; height: 52px; transition: transform .3s var(--bounce); }
.logo:hover .logo-grid { transform: rotate(-10deg) scale(1.08); }
.lg-bg { fill: var(--yellow); stroke: var(--ink); stroke-width: 3.5; }
.lg-lines { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; fill: none; }
.lg-x { stroke: var(--x); stroke-width: 4.5; stroke-linecap: round; }
.lg-o { stroke: var(--o); stroke-width: 4; fill: none; }
.logo-text {
  font-family: var(--font-head); font-size: clamp(24px, 4.5vw, 36px); line-height: .95;
  color: #fff; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--ink);
}
.logo-text span { color: var(--yellow); }

.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff; border: var(--line) solid var(--ink); box-shadow: var(--shadow-sm);
  font-size: 20px; cursor: pointer; transition: transform .15s;
}
.icon-btn:hover { transform: translateY(-2px) rotate(-8deg); }
.icon-btn:active { transform: translate(2px, 2px); box-shadow: none; }

.userchip {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: var(--line) solid var(--ink); border-radius: 999px;
  padding: 4px 4px 4px 14px; box-shadow: var(--shadow-sm);
}
.userchip .name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Grundbausteine ---------------- */

main { position: relative; z-index: 2; max-width: 1100px; margin: 0 auto; padding: 8px clamp(12px, 3vw, 28px) 140px; }

.panel {
  background: var(--paper);
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(14px, 2.5vw, 24px);
  margin-bottom: 20px;
  animation: pop-in .35s var(--bounce);
}
.panel h2 { font-size: 26px; }
@keyframes pop-in { from { transform: scale(.94); opacity: 0; } }

.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.muted { opacity: .7; font-weight: 600; }
.hint { font-size: 14px; opacity: .75; margin: 14px 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 14px;
  border: var(--line) solid var(--ink); box-shadow: var(--shadow-sm);
  background: #fff; color: var(--ink);
  font-family: var(--font-head); font-size: 18px; letter-spacing: .5px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.small { padding: 6px 12px; font-size: 15px; border-radius: 11px; }
.btn.big { padding: 14px 22px; font-size: 22px; }
.btn.green { background: var(--green); color: #fff; }
.btn.red { background: var(--red); color: #fff; }
.btn.blue { background: var(--blue); color: #fff; }
.btn.yellow { background: var(--yellow); }
.btn.white { background: #fff; }
.btn.green, .btn.red, .btn.blue { text-shadow: 1px 1px 0 var(--ink); }
.btn.wiggle:hover { animation: wiggle .4s ease-in-out; }
@keyframes wiggle { 25% { rotate: -2deg; } 75% { rotate: 2deg; } }

.input {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: var(--line) solid var(--ink); background: #fff;
  font-weight: 700; outline: none;
}
.input:focus { box-shadow: 0 0 0 4px var(--yellow); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.error, .form-msg.err { color: #c62828; min-height: 1.2em; margin: 0 0 10px; }
.form-msg.ok { color: #2e7d32; }
.form-msg { margin: 4px 0 10px; min-height: 1em; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; background: #0001; padding: 5px; border-radius: 14px; }
.tabs button {
  flex: 1; padding: 9px; border: none; border-radius: 10px; background: transparent;
  font-family: var(--font-head); font-size: 17px; cursor: pointer;
}
.tabs button.active { background: #fff; border: var(--line) solid var(--ink); box-shadow: var(--shadow-sm); }

.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: var(--line) solid var(--ink); color: #fff;
  font-family: var(--font-head); font-size: 20px; text-shadow: 1px 1px 0 var(--ink);
}

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  border: 2px solid var(--ink); background: #fff; font-size: 13px; white-space: nowrap;
}
.badge.hot { background: var(--red); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
.badge.wait { background: #e8ecf5; }
.badge.won { background: var(--yellow); }
.badge.lost { background: #d9d9e3; }
.badge.draw { background: #c8f0d0; }
.badge.chat { background: var(--blue); color: #fff; }
@keyframes pulse { 50% { transform: scale(1.07); } }

.tag {
  display: inline-block; margin-left: 10px; padding: 2px 10px; border-radius: 999px;
  background: var(--red); color: #fff; font-family: var(--font-body); font-size: 14px;
  vertical-align: middle; border: 2px solid var(--ink);
}

/* Kleines X/O-Symbol (Lobby, Spielerkopf) */
.mini-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  background: var(--board); border: 2px solid var(--ink); border-radius: 8px;
}
.mini-mark .mark { width: 100%; height: 100%; }

/* ---------------- Anmeldung ---------------- */

.auth { max-width: 440px; margin: 10px auto; text-align: center; }
.auth h1 {
  font-size: clamp(30px, 6vw, 46px); color: #fff;
  -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; text-shadow: 4px 4px 0 var(--ink);
}
.auth .panel { text-align: left; }
.auth .ttt-wrap.demo { width: 150px; margin: 0 auto 18px; pointer-events: none; }
.auth-features { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; font-size: 15px; }
.auth-features li { display: flex; gap: 10px; align-items: center; }
.auth-features b { width: 26px; text-align: center; }

/* ---------------- Lobby ---------------- */

.lobby-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.games { display: grid; gap: 10px; }
.game-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: #fff; border: var(--line) solid var(--ink); border-radius: 14px; box-shadow: var(--shadow-sm);
  text-decoration: none; cursor: pointer; transition: transform .15s;
}
.game-card:hover { transform: translateY(-2px) rotate(-.4deg); }
.game-card.your-turn { background: #fff4c2; }
.game-card.finished { opacity: .85; }
.game-card .info { flex: 1; min-width: 0; }
.game-card .opp { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-card .sub { font-size: 13px; opacity: .7; }
.game-card .badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.finished-games { margin-top: 16px; }
.finished-games summary { cursor: pointer; margin-bottom: 10px; }

.empty { text-align: center; padding: 10px; }
.big-emoji { font-size: 54px; animation: float 6s ease-in-out infinite; }

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.list li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: #fff; border: 2px solid var(--ink); border-radius: 12px;
}
.list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: #e8ecf5; border: 2px solid var(--ink); font-size: 14px;
}
.rank.r1 { background: var(--yellow); }
.rank.r2 { background: #d9dde8; }
.rank.r3 { background: #f0b27a; }

.new-game form { display: flex; gap: 8px; }
.new-game form .input { flex: 1; min-width: 0; }
.divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; opacity: .6; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 2px dashed var(--ink); }

.variant-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.variant-opt {
  display: grid; justify-items: center; gap: 4px; padding: 10px 8px;
  background: #fff; border: var(--line) solid var(--ink); border-radius: 14px; cursor: pointer;
  transition: transform .15s;
}
.variant-opt:hover { transform: translateY(-2px); }
.variant-opt.active { background: var(--yellow); box-shadow: var(--shadow-sm); }
.variant-opt b { font-family: var(--font-head); font-weight: 400; font-size: 18px; }
.variant-opt small { font-size: 12px; opacity: .75; text-align: center; }
.vgrid {
  width: 38px; height: 38px; border: 2px solid var(--ink); border-radius: 6px; background-color: #fff;
  background-image:
    linear-gradient(var(--ink) 2px, transparent 2px),
    linear-gradient(90deg, var(--ink) 2px, transparent 2px);
}
.vgrid.n3 { background-size: 12px 12px; background-position: -1px -1px; }
.vgrid.n5 { background-size: 7px 7px; background-position: -1px -1px; }

/* ---------------- Spielansicht ---------------- */

.game-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.versus { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 17px; }
.versus .player { display: flex; align-items: center; gap: 8px; }
.vs {
  font-family: var(--font-head); font-size: 22px; color: var(--red);
  -webkit-text-stroke: 1px var(--ink); paint-order: stroke fill; transform: rotate(-8deg);
}

.status-banner {
  display: grid; gap: 2px; text-align: center; padding: 12px 16px; margin-bottom: 18px;
  border: var(--line) solid var(--ink); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm);
}
.status-banner .sb-title { font-family: var(--font-head); font-size: clamp(20px, 3.5vw, 28px); }
.status-banner .sb-sub { opacity: .75; }
.status-banner.turn { background: var(--yellow); }
.status-banner.wait { background: #e8ecf5; }
.status-banner.win { background: #ffe066; }
.status-banner.lose { background: #d9d9e3; }
.status-banner.draw { background: #c8f0d0; }
.status-banner.flash { animation: flash .6s ease-in-out 3; }
@keyframes flash { 50% { transform: scale(1.03); filter: brightness(1.1); } }

.board-area { display: grid; justify-items: center; gap: 10px; margin-bottom: 18px; }
.rule { margin: 0; text-align: center; font-size: 14px; }

/* Das Spielfeld */
.ttt-wrap { position: relative; width: min(100%, 420px); aspect-ratio: 1; }
.ttt-wrap.wobble { animation: wobble .4s ease-in-out; }
@keyframes wobble { 20% { rotate: -2deg; } 40% { rotate: 2deg; } 60% { rotate: -1deg; } 80% { rotate: 1deg; } }

.ttt {
  display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr);
  gap: var(--gap, 8px); width: 100%; height: 100%; padding: var(--gap, 8px);
  background: var(--board-line); border: var(--line) solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.ttt.size-5 { --gap: 6px; }
.ttt .cell {
  position: relative; padding: 0; min-width: 0; min-height: 0;
  background: var(--board); border: none; border-radius: 10px; cursor: default;
  display: grid; place-items: center;
  transition: background .2s, transform .15s;
}
.ttt.size-5 .cell { border-radius: 7px; }
.ttt.playable .cell.free { cursor: pointer; }
.ttt.playable .cell.free:hover { background: var(--cell-hover); transform: scale(.96); }
.ttt.playable .cell.free:focus-visible { outline: 4px solid var(--yellow); outline-offset: -4px; }

/* Vorschau des eigenen Zeichens beim Darüberfahren (nur mit Maus) */
@media (hover: hover) {
.ttt.playable[data-ghost] .cell.free:hover::after {
  font-family: var(--font-head); font-size: calc(min(100vw, 420px) / var(--n) * .55); opacity: .25; line-height: 1;
}
.ttt.playable[data-ghost="X"] .cell.free:hover::after { content: '✕'; color: var(--x); }
.ttt.playable[data-ghost="O"] .cell.free:hover::after { content: '◯'; color: var(--o); }
}

.cell.last { box-shadow: inset 0 0 0 3px var(--yellow); }
.cell.win { background: var(--win-bg); animation: win-bounce .6s var(--bounce) both; }
.cell.win:nth-child(odd) { animation-delay: .08s; }
@keyframes win-bounce { 40% { transform: scale(1.12) rotate(-4deg); } }
.cell.fresh .mark { animation: mark-pop .45s var(--bounce); }
@keyframes mark-pop { from { transform: scale(.4) rotate(-20deg); } }

/* Zeichen */
.mark { width: 78%; height: 78%; overflow: visible; filter: var(--mark-filter); }
.mark .stroke { fill: none; stroke-width: var(--mark-width); stroke-linecap: round; }
.mark-X .stroke { stroke: var(--x); }
.mark-O .stroke { stroke: var(--o); }
/* Kontur im Comic-Stil: dicke dunkle Linie unter der farbigen */
.mark.draw .stroke { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw-stroke .28s ease-out forwards; }
.mark.draw .s2 { animation-delay: .22s; }
.mark-O.draw .stroke { animation-duration: .45s; }
@keyframes draw-stroke { to { stroke-dashoffset: 0; } }

/* Gewinnlinie */
.win-line { position: absolute; inset: var(--gap, 8px); width: calc(100% - 2 * var(--gap, 8px)); height: calc(100% - 2 * var(--gap, 8px)); pointer-events: none; overflow: visible; }
.ttt-wrap:has(.size-5) .win-line { --gap: 6px; }
.strike { stroke: var(--ink); stroke-width: 16; stroke-linecap: round; opacity: .85; }
.strike.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw-stroke .5s ease-in-out .15s forwards; }

.pop-text {
  position: absolute; left: 50%; top: 40%; z-index: 4; pointer-events: none;
  font-family: var(--font-head); font-size: clamp(24px, 5vw, 38px); white-space: nowrap;
  color: var(--yellow); -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--ink);
  animation: pop-text 1.2s ease-out forwards;
}
@keyframes pop-text {
  0% { transform: translate(-50%, 0) scale(.3) rotate(-10deg); opacity: 0; }
  25% { transform: translate(-50%, -10px) scale(1.15) rotate(-4deg); opacity: 1; }
  100% { transform: translate(-50%, -70px) scale(1) rotate(0); opacity: 0; }
}

/* ---------------- Chat ---------------- */

.chat h3 { font-size: 20px; }
.chat-box { position: relative; }
.chat-list {
  height: 220px; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px;
  background: #fff; border: var(--line) solid var(--ink); border-radius: 14px;
}
.chat-empty { margin: auto; text-align: center; opacity: .6; font-size: 14px; }
.msg { max-width: 80%; display: grid; gap: 2px; }
.msg.mine { align-self: flex-end; justify-items: end; }
.msg.fresh { animation: pop-in .3s var(--bounce); }
.msg .bubble {
  padding: 7px 12px; border-radius: 14px; border: 2px solid var(--ink);
  background: #e8ecf5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.mine .bubble { background: var(--yellow); border-bottom-right-radius: 4px; }
.msg.theirs .bubble { border-bottom-left-radius: 4px; }
.msg .meta { font-size: 11px; opacity: .6; }
.chat-new {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  border: 2px solid var(--ink); border-radius: 999px; background: var(--blue); color: #fff; padding: 4px 12px; cursor: pointer;
}
.chat-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip {
  padding: 4px 10px; border-radius: 999px; border: 2px solid var(--ink); background: #fff;
  font-size: 13px; cursor: pointer;
}
.chip:hover { background: var(--yellow); }
.chat-form { display: flex; gap: 8px; align-items: center; }
.chat-form .input { flex: 1; min-width: 0; }
.chat-count { font-size: 12px; opacity: .6; min-width: 2ch; }

/* ---------------- Overlays, Toasts, Konfetti ---------------- */

.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 20, 50, .55); animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.overlay > .panel { max-width: 440px; width: 100%; text-align: center; }
.overlay .big { font-size: 72px; animation: float 3s ease-in-out infinite; }
.overlay .row { justify-content: center; }
.overlay.win h1 { color: var(--orange); }
.overlay.lose h1 { color: var(--grey); }
.overlay.draw h1 { color: var(--green); }

.settings-overlay { place-items: start center; overflow-y: auto; }
.overlay > .panel.settings { max-width: 640px; text-align: left; }
.settings h3 { margin-top: 18px; font-size: 20px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.theme-card {
  position: relative; display: grid; gap: 4px; padding: 8px; text-align: left;
  background: #fff; border: var(--line) solid var(--ink); border-radius: 14px; cursor: pointer;
}
.theme-card.active { background: var(--yellow); box-shadow: var(--shadow-sm); }
.theme-card .check {
  position: absolute; top: 4px; right: 6px; z-index: 2; width: 24px; height: 24px; border-radius: 50%;
  display: none; place-items: center; background: var(--green); color: #fff; border: 2px solid var(--ink);
}
.theme-card.active .check { display: grid; }
.theme-card .tname { font-family: var(--font-head); font-size: 16px; }
.theme-card .tdesc { font-size: 12px; opacity: .75; }

/* Mini-Vorschau eines Designs */
.tp {
  height: 86px; border-radius: 10px; border: 2px solid var(--ink); display: grid; place-items: center;
  background: linear-gradient(var(--tp-bg1), var(--tp-bg2));
}
.tp-board {
  width: 66px; height: 66px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px;
  background: var(--tp-line); border-radius: 8px;
}
.tp-board i { background: var(--tp-board); border-radius: 3px; display: grid; place-items: center; }
.tp-board .mark { --x: var(--tp-x); --o: var(--tp-o); width: 90%; height: 90%; filter: none; }
.tp-board .mark .stroke { stroke-width: 15; }
.tp-grid .tp-board { gap: 0; padding: 0; background: var(--tp-board); border: 2px solid var(--tp-line); }
.tp-grid .tp-board i { border-radius: 0; border: 1px solid #a9c8e8; }
.tp-glow .tp-board .mark { filter: drop-shadow(0 0 3px var(--tp-x)); }

.account details { margin-bottom: 8px; }
.account summary { cursor: pointer; padding: 6px 0; }
.account-form { padding: 6px 0 4px; }

.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; }
.toggle-row small { display: block; font-size: 12px; opacity: .7; font-weight: 600; }
.switch {
  flex: none; position: relative; width: 54px; height: 30px; border-radius: 999px;
  border: var(--line) solid var(--ink); background: #d9d9e3; cursor: pointer; padding: 0;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2px solid var(--ink); transition: left .2s var(--bounce);
}
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"]::after { left: 26px; }

#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast {
  padding: 10px 16px; border-radius: 12px; border: var(--line) solid var(--ink); background: #fff;
  box-shadow: var(--shadow-sm); animation: pop-in .25s var(--bounce); text-align: center;
}
.toast.ok { background: #c8f0d0; }
.toast.err { background: #ffd0d0; }
.toast.out { opacity: 0; transform: translateY(10px); transition: .3s; }

.confetti {
  position: fixed; top: -20px; z-index: 70; width: 12px; height: 16px; pointer-events: none;
  background: var(--c); border: 2px solid var(--ink);
  animation: fall linear forwards;
}
.confetti.x, .confetti.o { width: 22px; height: 22px; background: none; border: none; }
.confetti.x::before, .confetti.x::after {
  content: ''; position: absolute; left: 8px; top: 0; width: 6px; height: 22px; background: var(--c);
  border: 1.5px solid var(--ink); border-radius: 3px;
}
.confetti.x::before { transform: rotate(45deg); }
.confetti.x::after { transform: rotate(-45deg); }
.confetti.o { border: 5px solid var(--c); border-radius: 50%; box-shadow: 0 0 0 1.5px var(--ink); }
@keyframes fall {
  to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); }
}

.loading { display: grid; justify-items: center; padding: 60px 0; }
.spinner { display: flex; gap: 6px; }
.spinner .mark { width: 50px; height: 50px; animation: bounce-y .8s ease-in-out infinite alternate; }
.spinner .mark-O { animation-delay: .4s; }
@keyframes bounce-y { to { transform: translateY(-14px) rotate(12deg); } }

/* ---------------- Mobil ---------------- */

@media (max-width: 560px) {
  .logo-grid { width: 42px; height: 42px; }
  .userchip .name { display: none; }
  .userchip { padding-left: 4px; }
  .sun { width: 64px; height: 64px; }
  .new-game form { flex-direction: column; }
  .game-card { flex-wrap: wrap; }
  .game-card .badges { width: 100%; justify-content: flex-start; }
}

/* ---------------- Animationen reduzieren ---------------- */

html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .cloud, .sun-rays, .floater, .big-emoji { animation: none; }
}
