:root{
  --bg:#0f1115;
  --panel:#141922;
  --panel2:#0f141c;
  --text:#eef2ff;
  --muted:#a7b0c3;
  --accent:#33d17a;
  --accent2:#f2c94c;
  --danger:#ff5c5c;
  --border:rgba(255,255,255,.10);
  --shadow: 0 14px 40px rgba(0,0,0,.35);
  --radius:18px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 30% 0%, #1a2132, var(--bg));
}

.wrap{
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 14px;
}

.topbar{
  position: sticky;
  top:0;
  z-index:20;
  backdrop-filter: blur(10px);
  background: rgba(10,12,16,.65);
  border-bottom:1px solid var(--border);
}

.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 12px 0;
}

.brand{ display:flex; align-items:center; gap:12px; }
.brand-badge{
  width:42px; height:42px;
  border-radius:14px;
  display:grid; place-items:center;
  background: linear-gradient(180deg, rgba(51,209,122,.20), rgba(51,209,122,.05));
  border:1px solid rgba(51,209,122,.35);
  box-shadow: 0 10px 25px rgba(51,209,122,.08);
  font-size: 20px;
}
.brand-title{ font-weight:800; letter-spacing:.2px; }
.brand-sub{ color:var(--muted); font-size:12px; margin-top:2px; }

.main{ padding: 16px 0 28px; }

.panel{
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.panel-head{
  padding: 18px 16px 6px;
}
.panel-head h1{ margin:0 0 6px; font-size: 20px; }
.muted{ color: var(--muted); }
.small{ font-size: 12px; }

.mode-row{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
  padding: 10px 16px 4px;
}
.mode{
  border:1px solid var(--border);
  border-radius: 16px;
  padding: 12px 10px;
  background: rgba(0,0,0,.18);
  color: var(--text);
  cursor:pointer;
  text-align:left;
  transition: transform .08s ease, border-color .12s ease, background .12s ease;
}
.mode:hover{ transform: translateY(-1px); border-color: rgba(51,209,122,.45); }
.mode.active{
  background: linear-gradient(180deg, rgba(51,209,122,.18), rgba(0,0,0,.10));
  border-color: rgba(51,209,122,.55);
}
.mode-title{ font-weight:800; }
.mode-sub{ color:var(--muted); font-size: 12px; margin-top:3px; }

.hud{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:10px;
  padding: 10px 16px 16px;
}
.hud-box{
  border:1px solid var(--border);
  border-radius: 16px;
  padding: 10px 10px;
  background: rgba(0,0,0,.18);
}
.hud-label{ color:var(--muted); font-size: 12px; }
.hud-value{ font-weight:800; font-size: 16px; margin-top:2px; }

.game-area{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 14px;
  padding: 0 16px 16px;
}

.board{
  border-radius: 18px;
  border: 1px solid var(--border);
  background:
    radial-gradient(900px 450px at 30% 0%, rgba(242,201,76,.12), rgba(0,0,0,0)),
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(0,0,0,.10));
  padding: 12px;
  min-height: 260px;
}

.grid{
  display:grid;
  gap:10px;
}

/* Karten */
.memcard{
  position:relative;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  border:1px solid var(--border);
  background:
    radial-gradient(500px 250px at 30% 0%, rgba(255,255,255,.06), rgba(0,0,0,0)),
    linear-gradient(180deg, rgba(0,0,0,.20), rgba(0,0,0,.35));
  cursor:pointer;
  user-select:none;
  overflow:hidden;
  transform: translateZ(0);
  transition: transform .08s ease, border-color .12s ease;
}
.memcard:hover{ transform: translateY(-1px); border-color: rgba(242,201,76,.40); }
.memcard.disabled{ cursor:default; opacity:.65; }
.memcard.matched{ border-color: rgba(51,209,122,.60); box-shadow: 0 14px 30px rgba(51,209,122,.10); }

.memcard .inner{
  position:absolute; inset:0;
  display:grid; place-items:center;
  padding: 10px;
}

/* “Wood” Rückseite */
.memcard .back{
  background:
    linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,0) 28%, rgba(255,255,255,.04) 55%, rgba(255,255,255,0)),
    repeating-linear-gradient(
      90deg,
      rgba(120,72,35,.35) 0px,
      rgba(120,72,35,.35) 10px,
      rgba(92,54,26,.35) 10px,
      rgba(92,54,26,.35) 20px
    ),
    radial-gradient(900px 500px at 30% 0%, rgba(242,201,76,.14), rgba(0,0,0,0));
}
.memcard .back .stamp{
  width: 64px; height:64px;
  border-radius: 18px;
  display:grid; place-items:center;
  border:1px dashed rgba(255,255,255,.35);
  background: rgba(0,0,0,.16);
  font-weight:900;
  letter-spacing:.6px;
}

/* Vorderseite */
.memcard .front{
  background:
    radial-gradient(700px 420px at 30% 0%, rgba(51,209,122,.12), rgba(0,0,0,0)),
    linear-gradient(180deg, rgba(0,0,0,.10), rgba(0,0,0,.45));
}
.face{
  width: 100%;
  height: 100%;
  display:grid;
  place-items:center;
  text-align:center;
}
.face .emoji{ font-size: 40px; }
.face .label{ margin-top:8px; font-weight:800; }
.face svg{ width:72%; max-width: 110px; height:auto; filter: drop-shadow(0 10px 20px rgba(0,0,0,.35)); }

.hidden .front{ display:none; }
.revealed .back{ display:none; }

/* Side */
.side{ display:flex; flex-direction:column; gap:12px; }
.cardbox{
  border:1px solid var(--border);
  border-radius: 18px;
  background: rgba(0,0,0,.18);
  overflow:hidden;
}
.cardbox-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
  padding: 12px 12px 10px;
  border-bottom:1px solid var(--border);
}
.cardbox-title{ font-weight:900; }

.highscores{ padding: 10px 12px 12px; }
.hs-row{
  display:grid;
  grid-template-columns: 28px 1fr auto;
  gap:10px;
  padding: 8px 8px;
  border-radius: 14px;
}
.hs-row:nth-child(odd){ background: rgba(255,255,255,.03); }
.badge{
  width: 26px; height:26px;
  border-radius: 10px;
  display:grid; place-items:center;
  background: rgba(255,255,255,.06);
  border:1px solid var(--border);
  font-weight:900;
}
.hs-name{ font-weight:800; }
.hs-meta{ color: var(--muted); font-size: 12px; margin-top:2px; }
.hs-time{ font-weight:900; }

.tips{
  border:1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  background: rgba(0,0,0,.18);
}
.tips-title{ font-weight:900; margin-bottom:6px; }
.tips ul{ margin:8px 0 0 18px; padding:0; color: var(--muted); }
.tips li{ margin: 6px 0; }

.btn{
  border:1px solid rgba(51,209,122,.55);
  background: linear-gradient(180deg, rgba(51,209,122,.22), rgba(51,209,122,.10));
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight:900;
  cursor:pointer;
}
.btn:hover{ border-color: rgba(51,209,122,.75); }
.btn-ghost{
  border:1px solid var(--border);
  background: rgba(0,0,0,.15);
}
.iconbtn{
  border:1px solid var(--border);
  background: rgba(0,0,0,.20);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 14px;
  cursor:pointer;
}

.footer{
  margin-top: 18px;
  border-top:1px solid var(--border);
  background: rgba(10,12,16,.55);
}
.footer-inner{
  padding: 14px 0;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 12px;
}
.dot{
  width:10px; height:10px; border-radius:999px;
  background: var(--accent);
  display:inline-block;
  margin-right:8px;
  box-shadow: 0 0 0 6px rgba(51,209,122,.10);
}

/* Modal */
.modal{
  position:fixed; inset:0;
  display:none;
  place-items:center;
  padding: 18px;
  background: rgba(0,0,0,.55);
  z-index:50;
}
.modal.show{ display:grid; }
.modal-card{
  width:min(520px, 100%);
  border-radius: 20px;
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.25));
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 12px 12px;
  border-bottom:1px solid var(--border);
}
.modal-title{ font-weight: 1000; }
.modal-body{ padding: 12px; }
.result{
  display:flex; gap:12px; flex-wrap:wrap;
  border:1px solid var(--border);
  background: rgba(0,0,0,.18);
  border-radius: 16px;
  padding: 10px;
  margin-bottom: 10px;
}
.field{ display:block; margin: 10px 0; }
.field-label{ display:block; font-weight:800; margin-bottom:6px; }
.input{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.20);
  color: var(--text);
  outline:none;
}
.input:focus{ border-color: rgba(242,201,76,.55); }
.modal-actions{ display:flex; gap:10px; margin-top: 10px; flex-wrap:wrap; }

/* Responsive */
@media (max-width: 920px){
  .game-area{ grid-template-columns: 1fr; }
}
@media (max-width: 560px){
  .mode-row{ grid-template-columns: 1fr; }
  .hud{ grid-template-columns: 1fr 1fr; }
  .brand-sub{ display:none; }
}
