/* Casino-Portal: Anmeldung, Startseite, Admin – im Candy-Stil der Spiele. */
:root {
  --pink: #ff3d8b;
  --pink-dark: #c2185b;
  --pink-soft: #fff3f9;
  --yellow: #ffd23f;
  --purple: #7b2ff7;
  --green: #18a548;
  --red: #d92d4a;
  --ink: #4a1037;
  --muted: #8a4a72;
  --line: #f1d6e4;
  --panel: rgba(255, 255, 255, 0.92);
  --shadow: 0 5px 0 rgba(150, 30, 90, 0.22), 0 14px 40px rgba(120, 30, 120, 0.16);
  --font-ui: 'Fredoka', 'Segoe UI Rounded', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Lilita One', 'Fredoka', 'Arial Rounded MT Bold', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--font-ui); font-size: 16px; color: var(--ink);
  background:
    radial-gradient(120% 40% at 50% 112%, #ff9fd0 0 38%, transparent 38.5%),
    radial-gradient(70% 30% at 8% 106%, #ffc4e4 0 50%, transparent 51%),
    radial-gradient(70% 30% at 94% 108%, #ffb0d8 0 50%, transparent 51%),
    linear-gradient(180deg, #62c6ff 0%, #9fdcff 35%, #ffd0ec 80%, #ffe6c7 100%) #8fd8ff;
  background-attachment: fixed;
}
[hidden] { display: none !important; }
a { color: var(--pink-dark); }
button { font: inherit; }

/* ---------- Bausteine ---------- */
.brand {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font-family: var(--font-display); font-size: 44px; line-height: 1; color: var(--pink);
  -webkit-text-stroke: 0.09em #fff; paint-order: stroke fill;
  filter: drop-shadow(0 4px 0 rgba(120, 20, 80, 0.3));
}
.brand img { width: 1.2em; height: 1.2em; filter: drop-shadow(0 3px 2px rgba(80, 10, 60, 0.25)); }
.brand span:last-child { color: #ffa800; }
.brand.small { font-size: 30px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 22px; border: 0; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: 16px; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: transform 0.12s, filter 0.15s, box-shadow 0.12s;
}
.btn:disabled { cursor: default; opacity: 0.55; }
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn-primary { background: linear-gradient(#ff7ab3, #ff3d8b); color: #fff; box-shadow: 0 4px 0 var(--pink-dark); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn-primary:active:not(:disabled) { box-shadow: 0 2px 0 var(--pink-dark); }
.btn-ghost { background: #f7e6ef; color: var(--pink-dark); box-shadow: 0 3px 0 #dcbccd; }
.btn-ghost:hover:not(:disabled) { background: #f2d9e6; }
.btn-danger { background: linear-gradient(#f06a7f, var(--red)); color: #fff; box-shadow: 0 4px 0 #9e1730; }
.btn-success { background: linear-gradient(#4fd476, var(--green)); color: #fff; box-shadow: 0 4px 0 #0e7232; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(123, 47, 247, 0.45); outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 15px; }
.field small { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type="text"], input[type="password"], input[type="search"], input:not([type]) {
  width: 100%; padding: 11px 14px; border: 2px solid var(--line); border-radius: 14px;
  font: inherit; font-size: 16px; color: var(--ink); background: #fff;
  transition: border-color 0.15s;
}
input:focus { border-color: #ff9ac4; outline: none; }

.form-error {
  margin: 0; padding: 10px 14px; border-radius: 12px;
  background: #ffe3e8; color: #9e1730; font-size: 15px; font-weight: 600;
}
.form-ok { margin: 0; padding: 10px 14px; border-radius: 12px; background: #dcf7e4; color: #0e6b2e; font-size: 15px; font-weight: 600; }

.card {
  background: var(--panel); border-radius: 24px; box-shadow: var(--shadow);
}

/* ---------- Anmeldung / Registrierung ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 32px 16px 60px;
}
.auth-card {
  width: 100%; max-width: 400px; padding: 28px 28px 24px;
  display: flex; flex-direction: column; gap: 16px;
  animation: popIn 0.35s cubic-bezier(.3, 1.5, .6, 1);
}
.auth-card h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 30px; color: var(--pink-dark); }
.auth-card .lead { margin: -8px 0 0; color: var(--muted); }
.auth-switch { margin: 0; text-align: center; color: var(--muted); }
.auth-switch a { font-weight: 700; }
.fineprint { margin: 0; font-size: 14px; color: #7a3f66; text-align: center; }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px max(16px, calc((100vw - 1180px) / 2));
  background: rgba(255, 255, 255, 0.55); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
}
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.balance-chip {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 4px 16px; border-radius: 16px; background: rgba(70, 10, 60, 0.75); color: #fff;
}
.balance-chip small { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: #ffc6e3; }
.balance-chip b { font-family: var(--font-display); font-weight: 400; font-size: 20px; color: var(--yellow); white-space: nowrap; }
.user-name { font-weight: 700; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Startseite ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 16px 64px; }
.hero h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(30px, 5vw, 44px); color: #fff;
  -webkit-text-stroke: 0.08em var(--pink-dark); paint-order: stroke fill; text-shadow: 0 4px 0 rgba(90, 0, 60, 0.3); }
.hero p { margin: 6px 0 0; font-size: 18px; color: var(--ink); }
.section-title { margin: 32px 0 14px; font-family: var(--font-display); font-weight: 400; font-size: 26px; color: var(--pink-dark); }

.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.tile { overflow: hidden; display: flex; flex-direction: column; transition: transform 0.18s; }
.tile:hover { transform: translateY(-4px); }
.tile-art {
  position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden;
  background:
    radial-gradient(90% 50% at 50% 118%, #ff9fd0 0 45%, transparent 46%),
    linear-gradient(180deg, #62c6ff, #9fdcff 50%, #ffd0ec);
}
.tile-art img { position: absolute; width: 26%; filter: drop-shadow(0 5px 4px rgba(80, 10, 60, 0.3)); transition: transform 0.4s; }
.tile:hover .tile-art img { transform: translateY(-6px) rotate(-4deg); }
.tile-art .a1 { left: 7%; top: 22%; width: 23%; }
.tile-art .a2 { left: 37%; top: 6%; width: 26%; }
.tile-art .a3 { right: 7%; top: 20%; width: 23%; }
.tile-art .a4 { left: -3%; top: -6%; width: 15%; transform: rotate(-25deg); opacity: 0.9; }
.tile-art .a5 { right: -2%; top: -5%; width: 14%; transform: rotate(18deg); opacity: 0.9; }
.tile:hover .tile-art .a4, .tile:hover .tile-art .a5 { transform: none; }
/* Sweet Mines: Bonbon-Bergwerk */
.tile-sweet-mines .tile-art {
  background:
    radial-gradient(60% 55% at 50% 40%, rgba(255, 246, 251, 0.95) 0%, rgba(255, 246, 251, 0) 70%),
    radial-gradient(28% 80% at -2% 60%, #e0a46c 0 60%, transparent 61%),
    radial-gradient(28% 80% at 102% 60%, #e0a46c 0 60%, transparent 61%),
    radial-gradient(90% 40% at 50% 116%, #d9955a 0 50%, transparent 51%),
    linear-gradient(180deg, #ff9fd0, #ffd6e9 55%, #f7c99a);
}
.tile-art .m-crystals-l { left: -4%; bottom: 8%; width: 30%; }
.tile-art .m-crystals-r { right: -4%; bottom: 8%; width: 30%; transform: scaleX(-1); }
.tile-art .m-cart { left: 33%; top: 8%; width: 36%; }
.tile-art .m-pick { left: 16%; top: 10%; width: 24%; transform: rotate(-12deg); }
.tile-art .m-bomb { right: 15%; top: 26%; width: 18%; }
.tile-art .m-gold { left: 61%; top: 4%; width: 13%; }
.tile:hover .tile-art .m-crystals-r { transform: scaleX(-1) translateY(-6px); }
/* Matrjoschka: Winternacht, geöffnete rote Puppe mit goldener darin */
.tile-matrjoschka .tile-art {
  background:
    radial-gradient(55% 60% at 50% 55%, rgba(255, 196, 120, 0.45), transparent 70%),
    linear-gradient(180deg, #1c2366 0%, #2c2f86 50%, #6a2d6a 100%);
}
.tile-matrjoschka .tile-art::before { content: ''; position: absolute; inset: 0; background: url('/games/matrjoschka/assets/ornament.svg') 0 0 / 140px 140px; opacity: 0.12; }
.tile-art .mj-l, .tile-art .mj-r { width: 21%; bottom: 20%; }
.tile-art .mj-l { left: 9%; transform: rotate(-6deg); }
.tile-art .mj-r { right: 9%; transform: rotate(6deg); }
.tile-art .mj-back, .tile-art .mj-front, .tile-art .mj-lid { left: 35%; bottom: 14%; width: 30%; }
.tile-art .mj-inner { left: 41.5%; bottom: 30%; width: 17%; filter: drop-shadow(0 0 10px rgba(255, 210, 60, 0.9)); }
.tile-art .mj-lid { transform: translate(-6%, -34%) rotate(-14deg); transform-origin: 18% 57%; }
.tile:hover .tile-art .mj-back, .tile:hover .tile-art .mj-front { transform: none; }
.tile:hover .tile-art .mj-lid { transform: translate(-8%, -42%) rotate(-18deg); }
.tile:hover .tile-art .mj-inner { transform: translateY(-10%); }
.tile:hover .tile-art .mj-l { transform: rotate(-6deg) translateY(-4px); }
.tile:hover .tile-art .mj-r { transform: rotate(6deg) translateY(-4px); }
.tile-logo.mj-logo span { color: #e53935; }
.tile-logo {
  position: absolute; left: 0; right: 0; bottom: 14px; text-align: center;
  font-family: var(--font-display); font-size: 34px; line-height: 1; transform: rotate(-2deg);
  -webkit-text-stroke: 0.1em #fff; paint-order: stroke fill;
}
.tile-logo span:first-child { color: var(--pink); }
.tile-logo span:last-child { color: #ffa800; }
/* Spiele mit Titelbild (Baukasten-Spiele) */
.tile-art .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: none; transition: transform 0.6s; }
.tile:hover .tile-art .cover { transform: scale(1.06); }
.tile-logo.cover-logo { bottom: 10px; padding: 0 10px; font-size: clamp(24px, 2.6vw, 30px); -webkit-text-stroke: 0.1em var(--stroke, #fff); }
.tile-logo.cover-logo span { color: var(--fill, var(--pink)); }
.cats { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.cat { padding: 7px 16px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.75); color: var(--pink-dark); font-weight: 700; font-size: 15px; cursor: pointer; box-shadow: 0 3px 0 rgba(150, 30, 90, 0.18); }
.cat small { font-weight: 600; opacity: 0.7; }
.cat[aria-pressed="true"] { background: linear-gradient(#ff7ab3, var(--pink)); color: #fff; box-shadow: 0 3px 0 var(--pink-dark); }
.tile-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tile-body h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 24px; color: var(--pink-dark); }
.tile-type { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--purple); }
.tile-body p { margin: 0; color: var(--muted); line-height: 1.4; }
.tile-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--ink); }
.tile-meta b { font-weight: 700; }
.tile-badge { align-self: flex-start; padding: 3px 10px; border-radius: 999px; background: linear-gradient(#fff4b8, #ffc93c); color: #8a3d00; font-size: 13px; font-weight: 700; }
.tile-body .btn { margin-top: auto; align-self: flex-start; }

.alert { padding: 14px 18px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); font-weight: 600; }
.alert.error { background: #ffe3e8; color: #9e1730; }

/* ---------- Admin ---------- */
.admin-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.admin-head h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 38px; color: var(--pink-dark); }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0; }
.stat { padding: 14px 18px; }
.stat small { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.stat b { font-family: var(--font-display); font-weight: 400; font-size: 28px; color: var(--ink); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar input { max-width: 320px; }
.toolbar .count { margin-left: auto; color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; }
table.users { width: 100%; border-collapse: collapse; font-size: 15px; }
.users th, .users td { padding: 10px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.users th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); background: var(--pink-soft); }
.users td.num, .users th.num { text-align: right; font-variant-numeric: tabular-nums; }
.users tbody tr { cursor: pointer; transition: background 0.12s; }
.users tbody tr:hover { background: #fff6fb; }
.users tbody tr:last-child td { border-bottom: 0; }
.users .empty { text-align: center; color: var(--muted); padding: 30px; cursor: default; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eee; color: #555; }
.badge.admin { background: #ece2ff; color: var(--purple); }
.badge.locked { background: #ffe3e8; color: #9e1730; }
.badge.ok { background: #dcf7e4; color: #0e6b2e; }
.badge.bonus { background: #fff1c2; color: #8a3d00; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

dialog.user-dialog {
  width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  border: 0; border-radius: 24px; color: var(--ink); box-shadow: 0 20px 60px rgba(40, 0, 40, 0.35);
}
dialog.user-dialog::backdrop { background: rgba(40, 0, 40, 0.55); backdrop-filter: blur(3px); }
.dlg-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; padding: 18px 70px 18px 22px; background: #fff; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 28px; color: var(--pink-dark); overflow-wrap: anywhere; }
.dlg-close { position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f7e6ef; color: var(--pink-dark); font-size: 26px; line-height: 1; cursor: pointer; }
.dlg-body { padding: 6px 22px 22px; }
.dlg-section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.dlg-section:last-child { border-bottom: 0; }
.dlg-section h3 { margin: 0 0 12px; font-size: 15px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kv div { background: var(--pink-soft); border-radius: 12px; padding: 8px 12px; }
.kv small { display: block; color: var(--muted); font-size: 12px; }
.kv b { font-size: 16px; }
.kv .big b { font-family: var(--font-display); font-weight: 400; font-size: 24px; color: var(--pink-dark); }
.balance-form { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.balance-form .actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 180px; }
.danger-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini-table th, .mini-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mini-table th { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.mini-table td.num, .mini-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-table td.note { white-space: normal; color: var(--muted); }
.plus { color: var(--green); font-weight: 700; }
.minus { color: var(--red); font-weight: 700; }
.muted { color: var(--muted); }
.dlg-msg { margin-top: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 8px 12px; }
  .brand.small { font-size: 24px; }
  .user-name { display: none; }
  .balance-chip { padding: 3px 12px; }
  .balance-chip b { font-size: 17px; }
  .topbar .btn-sm { padding: 6px 11px; }
  .auth-card { padding: 22px 18px 20px; }
  .brand { font-size: 36px; }
  .balance-form { grid-template-columns: 1fr; }
  .toolbar input { max-width: none; }
  .toolbar .count { margin-left: 0; }
  .dlg-head { padding: 16px 64px 16px 16px; }
  .dlg-close { right: 14px; top: 14px; }
  .dlg-body { padding-left: 16px; padding-right: 16px; }
}
