 :root{
      --bg: #f6f7fb;
      --text: #0c1220;
      --muted: rgba(12,18,32,.55);
      --card: rgba(255,255,255,.86);
      --stroke: rgba(12,18,32,.10);
      --shadow: 0 18px 45px rgba(0,0,0,.12);
      --glass: blur(14px);
      --good: 46 204 113; /* rgb */
      --bad: 255 71 87;   /* rgb */
      --accent: 72 112 255;
  --surface: rgba(255,255,255,.38);
  --surface-2: rgba(255,255,255,.28);
  --stage-surface: rgba(255,255,255,.18);      
    }
    @media (prefers-color-scheme: dark){
      :root{
        --bg: #0a0d14;
        --text: #eef2ff;
        --muted: rgba(238,242,255,.6);
        --card: rgba(18,22,33,.72);
        --stroke: rgba(238,242,255,.12);
        --shadow: 0 18px 55px rgba(0,0,0,.55);
    --surface: rgba(16,20,30,.58);
    --surface-2: rgba(16,20,30,.42);
    --stage-surface: rgba(16,20,30,.34);        
      }
    }

    *{ box-sizing:border-box; }
    html,body{ height:100%; }
    body{
      margin:0;
      font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
      background: radial-gradient(1200px 700px at 20% 10%, rgba(var(--accent),.12), transparent 55%),
                  radial-gradient(1000px 600px at 90% 20%, rgba(255, 184, 108,.10), transparent 55%),
                  var(--bg);
      color: var(--text);
      overflow:hidden;
      touch-action: none; /* wichtig: verhindert Scroll-Konflikte beim Drag */
    }

    .app{
      height:100%;
      display:flex;
      flex-direction:column;
      padding: 14px;
      gap: 12px;
      max-width: 520px;
      margin: 0 auto;
    }

    header{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:12px;
      padding: 10px 12px;
      border: 1px solid var(--stroke);
      border-radius: 16px;
  background: var(--surface);
      backdrop-filter: var(--glass);
      -webkit-backdrop-filter: var(--glass);
    }


    .title{
      display:flex;
      flex-direction:column;
      gap:2px;
      min-width: 0;
    }
    .title h1{
      font-size: 14px;
      margin:0;
      letter-spacing: .2px;
      font-weight: 750;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }
    .title p{
      margin:0;
      font-size: 12px;
      color: var(--muted);
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }

    .counters{
      display:flex;
      gap:8px;
      align-items:center;
      flex-wrap:wrap;
      justify-content:flex-end;
    }
    .pill{
      display:flex;
      align-items:center;
      gap:8px;
      padding: 8px 10px;
      border-radius: 999px;
      border: 1px solid var(--stroke);
  background: var(--surface);
      backdrop-filter: var(--glass);
      -webkit-backdrop-filter: var(--glass);
      font-size: 12px;
      user-select:none;
    }

    .dot{
      width:10px; height:10px;
      border-radius: 50%;
      box-shadow: 0 0 0 3px rgba(255,255,255,.35) inset;
    }
    .dot.good{ background: rgb(var(--good)); }
    .dot.bad{ background: rgb(var(--bad)); }
    .pill b{ font-size: 13px; }

    .stage{
      position:relative;
      flex:1;
      border-radius: 22px;
      border: 1px solid var(--stroke);
  background: var(--stage-surface);
      backdrop-filter: var(--glass);
      -webkit-backdrop-filter: var(--glass);
      overflow:hidden;
      display:flex;
      align-items:center;
      justify-content:center;
    }


    /* Zonen links/rechts (visuelles Hint) */
    .zone{
      position:absolute;
      top:0; bottom:0;
      width: 34%;
      display:flex;
      align-items:flex-end;
      padding: 14px;
      pointer-events:none;
      opacity:.55;
      transition: opacity .2s ease;
    }
    .zone.left{ left:0; justify-content:flex-start; }
    .zone.right{ right:0; justify-content:flex-end; }
    .zone .tag{
      font-size: 12px;
      padding: 8px 10px;
      border-radius: 999px;
      border: 1px solid var(--stroke);
  background: var(--surface-2);
      backdrop-filter: var(--glass);
      -webkit-backdrop-filter: var(--glass);
      color: var(--muted);
      user-select:none;
    }

    /* Flash-Overlay */
    .flash{
      position:absolute;
      inset:-20px;
      pointer-events:none;
      opacity:0;
      transform: scale(1.02);
      transition: opacity .18s ease;
      filter: blur(4px);
    }
    .flash.good{ background: radial-gradient(800px 500px at 20% 50%, rgba(var(--good),.35), transparent 60%); }
    .flash.bad{  background: radial-gradient(800px 500px at 80% 50%, rgba(var(--bad), .35), transparent 60%); }
    .flash.on{ opacity:1; }

    /* Kartenstapel */
.deck{
  width: min(92vw, 420px);
  height: clamp(340px, 62vh, 520px);
  aspect-ratio: 4 / 5;
}



    .card{
      position:absolute;
      inset:0;
      border-radius: 22px;
      border: 1px solid var(--stroke);
      background: var(--card);
      box-shadow: var(--shadow);
      overflow:hidden;
      transform: translate3d(0,0,0) rotate(0deg);
      will-change: transform;
      touch-action: none;
      user-select: none;
      display:flex;
      flex-direction:column;
      padding: 0;
    }

    .card::before{
      content:"";
      position:absolute;
      inset:0;
      background: linear-gradient(180deg, rgba(255,255,255,.22), transparent 35%);
      pointer-events:none;
    }
    @media (prefers-color-scheme: dark){
      .card::before{ background: linear-gradient(180deg, rgba(255,255,255,.10), transparent 38%); }
    }

    .card .meta{
      padding: 14px 14px 10px 14px;
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      z-index:1;
    }
    .card .meta .name{
      font-weight: 750;
      font-size: 14px;
      letter-spacing: .2px;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
      max-width: 80%;
    }
    .card .meta .hint{
      font-size: 12px;
      color: var(--muted);
      white-space:nowrap;
    }

.card .imgWrap{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 2px;
  z-index:1;
}

.card img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;

  border-radius: 18px;          /* sichtbarer, sauberer Radius */
  background: transparent;      /* kein milchiger Hintergrund */
}


    @media (prefers-color-scheme: dark){
      .card img{ border-color: rgba(238,242,255,.10); background: rgba(255,255,255,.06); }
    }

    .below{
      padding: 10px 2px 0 2px;
      display:flex;
      justify-content:space-between;
      gap:10px;
      font-size: 12px;
      color: var(--muted);
      user-select:none;
    }

    .btnRow{
      display:flex;
      gap:10px;
      margin-top: 10px;
      justify-content:center;
      flex-wrap:wrap;
    }

    .btn{
      border: 1px solid var(--stroke);
      background: rgba(255,255,255,.30);
      backdrop-filter: var(--glass);
      -webkit-backdrop-filter: var(--glass);
      color: var(--text);
      padding: 10px 12px;
      border-radius: 14px;
      font-size: 13px;
      font-weight: 650;
      cursor:pointer;
      user-select:none;
      transition: transform .08s ease;
    }
    .btn:active{ transform: scale(.98); }
    @media (prefers-color-scheme: dark){
      .btn{ background: rgba(255,255,255,.06); }
    }

    .end{
      text-align:center;
      padding: 18px;
      display:none;
      flex-direction:column;
      gap:10px;
      align-items:center;
      justify-content:center;
      color: var(--muted);
  inset: 0;                       /* füllt die Stage */

    }
    .end h2{
      margin:0;
      color: var(--text);
      font-size: 18px;
    }
   .card .meta{
  flex: 0 0 auto;
}
.card .imgWrap{
  flex: 1 1 auto;
  min-height: 0; /* wichtig in Flex-Layouts */
}
.card img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
 body{
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(var(--accent),.14), transparent 55%),
    radial-gradient(1000px 600px at 90% 20%, rgba(255, 184, 108,.06), transparent 55%),
    var(--bg);
}
@media (prefers-color-scheme: dark){
  body{
    background:
      radial-gradient(1200px 700px at 20% 10%, rgba(var(--accent),.16), transparent 55%),
      radial-gradient(1000px 600px at 90% 20%, rgba(255, 184, 108,.04), transparent 55%),
      var(--bg);
  }
}
html{
  background: var(--bg);
}

body{
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(var(--accent),.14), transparent 55%),
    radial-gradient(1000px 600px at 90% 20%, rgba(255, 184, 108,.08), transparent 55%),
    var(--bg);
}
/* BODY-FEEDBACK (sehr dezent, pastellig) */
/* BODY-FEEDBACK (sichtbar, aber ruhig) */
body{
  position: relative;
}

body::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease-out;
  z-index: 0;
}

/* ✅ Grün – klar, aber weich */
body.flash-yes::before{
  opacity: 0.7;
  background:
    radial-gradient(
      900px 600px at 50% 42%,
      rgba(46, 204, 113, 0.38),
      transparent 62%
    ),
    radial-gradient(
      1400px 900px at 30% 85%,
      rgba(46, 204, 113, 0.22),
      transparent 72%
    );
}

/* ❌ Rot – wahrnehmbar, nicht alarmierend */
body.flash-no::before{
  opacity: 0.7;
  background:
    radial-gradient(
      900px 600px at 50% 42%,
      rgba(255, 71, 87, 0.36),
      transparent 62%
    ),
    radial-gradient(
      1400px 900px at 70% 85%,
      rgba(255, 71, 87, 0.20),
      transparent 72%
    );
}



/* sorgt dafür, dass deine App sicher über dem Overlay liegt */
.app{ position: relative; z-index: 1; }
.end{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 420px);      /* exakt wie .deck */
  aspect-ratio: 4 / 5;

  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
/* Flip-Card Basis */
/* --- FLIP: Seiten wie normale Karte --- */
.card { perspective: 1200px; }

.card .flip{
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 260ms ease;
}
.card.is-flipped .flip{ transform: rotateY(180deg); }

.card .side{
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  display: flex;            /* ✅ gleiche Logik wie deine Card */
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.card .side.back{ transform: rotateY(180deg); }

/* --- WICHTIG: wenn .meta leer ist, soll es NICHTS “wegnehmen” --- */
.card .meta:empty{
  display: none;
  padding: 0;
  margin: 0;
}

/* ===== iOS Safari Flip Fix ===== */

/* Perspective lieber auf .card lassen (ok), aber iOS braucht oft auch Webkit-Pendants */
.card{
  -webkit-perspective: 1200px;
  perspective: 1200px;
}

/* Flip-Container: unbedingt preserve-3d + Webkit */
.card .flip{
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;

  transition: transform 260ms ease;
  -webkit-transition: -webkit-transform 260ms ease;

  transform: translateZ(0);         /* Safari Stabilität */
  -webkit-transform: translateZ(0);
  will-change: transform;
}

/* Seiten: backface hidden + eigene Transform-Angabe */
.card .side{
  position: absolute;
  inset: 0;

  display: flex;
  flex-direction: column;

  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;

  transform: translateZ(0);         /* wichtig auf iOS */
  -webkit-transform: translateZ(0);
}

/* explizit setzen (iOS mag das) */
.card .side.front{
  transform: rotateY(0deg) translateZ(0);
  -webkit-transform: rotateY(0deg) translateZ(0);
}

.card .side.back{
  transform: rotateY(180deg) translateZ(0);
  -webkit-transform: rotateY(180deg) translateZ(0);
}

/* Flip-State */
.card.is-flipped .flip{
  transform: rotateY(180deg) translateZ(0);
  -webkit-transform: rotateY(180deg) translateZ(0);
}

/* GANZ WICHTIG: auch auf IMG backface hidden */
.card img{
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}
/* iOS-only: verhindert, dass Safari beide Seiten gleichzeitig zeichnet */
@supports (-webkit-touch-callout: none) {
  .card .flip { -webkit-transform-style: preserve-3d; }
  .card .side { -webkit-backface-visibility: hidden; }
}
/* iOS-Safari: erzwinge, welche Seite sichtbar ist */
.card .side.front{
  opacity: 1;
  visibility: visible;
}

.card .side.back{
  opacity: 0;
  visibility: hidden;
}

/* wenn geflippt: genau andersrum */
.card.is-flipped .side.front{
  opacity: 0;
  visibility: hidden;
}

.card.is-flipped .side.back{
  opacity: 1;
  visibility: visible;
}

/* optional: weicher Übergang (zusätzlich zum Rotate) */
.card .side{
  transition: opacity 160ms ease, visibility 0s linear 160ms;
}
.card.is-flipped .side{
  transition: opacity 160ms ease, visibility 0s linear 0s;
}
