/* ═══════════════════════════════════════════════════
   SABACC — style.css
   Dark card-game theme · Mobile portrait
═══════════════════════════════════════════════════ */

/* ─── Tokens ────────────────────────────────────── */
:root {
  --bg:        #080c14;
  --surface:   #101624;
  --card-dark: #0d1b2a;
  --card-mid:  #132338;
  --gold:      #c9a84c;
  --gold-dim:  #7a5e22;
  --gold-pale: rgba(201,168,76,0.12);
  --gold-line: rgba(201,168,76,0.22);
  --text:      #e8dcc8;
  --muted:     #5a6a7a;
  --red:       #d95050;
  --green:     #3dba6e;
  --radius-card: 16px;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-ui:    -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── Reset ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html { height: 100%; overscroll-behavior: none; }

body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
}

/* ─── Screen system ─────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen.active { display: block; }

.screen-wrap {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 36px;
  gap: 20px;
  max-width: 460px;
  margin: 0 auto;
}

/* ─── Screen 1 — Logo ───────────────────────────── */
.logo-area {
  text-align: center;
  padding: 24px 0 8px;
}

.logo-deco {
  color: var(--gold-dim);
  letter-spacing: 10px;
  font-size: 12px;
  margin-bottom: 10px;
}

.logo-title {
  font-family: var(--font-serif);
  font-size: clamp(52px, 17vw, 80px);
  font-weight: bold;
  letter-spacing: 0.14em;
  line-height: 1;
  background: linear-gradient(160deg, #f0d880 0%, #c9a84c 45%, #8a6020 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Setup card ────────────────────────────────── */
.setup-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--gold-line);
  border-radius: 18px;
  padding: 22px 20px 18px;
}

.setup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0;
}

.setup-label {
  font-size: 15px;
  color: var(--text);
}

.setup-sep {
  height: 1px;
  background: var(--gold-line);
  margin: 16px 0;
}

/* Spinner */
.spinner {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  overflow: hidden;
}

.spin-btn {
  width: 46px;
  height: 46px;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.spin-btn:active { background: var(--gold-pale); }

.spin-val {
  min-width: 38px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  user-select: none;
}

/* Mode buttons */
.mode-row {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}

.mode-btn {
  flex: 1;
  padding: 13px 6px;
  background: var(--bg);
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.18s;
}

.mode-btn.active {
  background: var(--gold-pale);
  border-color: var(--gold);
  color: var(--gold);
}

/* ─── Gold CTA button ───────────────────────────── */
.btn-gold {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, #d4b056, #a07830);
  border: none;
  border-radius: 14px;
  color: #06090f;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(201,168,76,0.28);
  transition: opacity 0.18s, transform 0.1s;
  margin-top: auto;
}
.btn-gold:active { opacity: 0.8; transform: scale(0.98); }

/* ─── Screen 2 — Namen ──────────────────────────── */
.topbar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
}

.btn-back {
  width: 42px;
  height: 42px;
  background: none;
  border: 1px solid var(--gold-line);
  border-radius: 10px;
  color: var(--gold);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.screen-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: bold;
  color: var(--text);
}

.name-inputs {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.name-input {
  width: 100%;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.18s;
  caret-color: var(--gold);
}
.name-input:focus { border-color: var(--gold); }
.name-input::placeholder { color: var(--muted); }

/* ─── Screen 3 — Spiel ──────────────────────────── */
#s-game.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-y: hidden; /* überschreibt .screen overflow-y: auto */
}

#s-game .game-wrap {
  /* Überschreibt .screen-wrap komplett */
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 8px 16px 12px;
  gap: 8px;
  overflow: hidden;
  /* kein height nötig – flex: 1 füllt #s-game */
}

/* ─── Deck zone ─────────────────────────────────── */
.deck-zone {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  /* kein justify-content: center – Karte soll von oben wachsen */
}

/* Stack – füllt verfügbare Höhe, Breite via aspect-ratio */
.stack {
  position: relative;
  flex: 1;
  min-height: 0;
  aspect-ratio: 2 / 3;
  max-width: clamp(200px, 63vw, 275px);
  width: auto;
}

/* Ghost cards */
.ghost {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  background: var(--card-dark);
  border: 1px solid var(--gold-line);
}
.ghost.g3 { transform: translate(-6px, 9px) rotate(-3deg);   opacity: 0.3; z-index: 1; }
.ghost.g2 { transform: translate( 5px, 6px) rotate( 2deg);   opacity: 0.5; z-index: 2; }
.ghost.g1 { transform: translate(-2px, 3px) rotate(-1.2deg); opacity: 0.7; z-index: 3; }

/* Flip container */
.flip-wrap {
  position: absolute;
  inset: 0;
  z-index: 10;
  perspective: 1200px;
  cursor: pointer;
}

.flipper {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.42, 0, 0.18, 1);
  will-change: transform;
}

.flipper.flipped {
  transform: rotateY(180deg);
}

/* Card faces */
.card-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* ─── Card Back ─────────────────────────────────── */
.card-back {
  transform: rotateY(0deg);
  overflow: hidden;
  background: linear-gradient(155deg, #142238 0%, #0a1625 100%);
  border: 1px solid rgba(201,168,76,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Subtle diagonal pattern */
.back-pattern {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(201,168,76,0.035) 0px,
      rgba(201,168,76,0.035) 1px,
      transparent 1px,
      transparent 18px
    );
}

/* Inner border frames */
.card-back::before,
.card-back::after {
  content: '';
  position: absolute;
  border: 1px solid rgba(201,168,76,0.18);
  border-radius: calc(var(--radius-card) - 5px);
  pointer-events: none;
}
.card-back::before { inset: 8px; }
.card-back::after  { inset: 14px; border-color: rgba(201,168,76,0.10); }

.back-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.back-gem {
  color: var(--gold);
  font-size: 22px;
  opacity: 0.6;
}

.back-wordmark {
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: 0.28em;
  color: var(--gold);
  font-weight: bold;
}

/* ─── Card Front ────────────────────────────────── */
.card-front {
  transform: rotateY(180deg);
  overflow: hidden;
  background: linear-gradient(155deg, #1a2e44 0%, #102030 100%);
  border: 1px solid rgba(201,168,76,0.35);
  display: flex;
  flex-direction: column;
  padding: 18px 16px 16px;
  gap: 0;
}

.card-badge {
  align-self: flex-start;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 20px;
  padding: 5px 11px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.card-badge.badge-18 {
  color: var(--red);
  border-color: var(--red);
}

.card-question {
  flex: 1;
  font-family: var(--font-serif);
  font-size: clamp(15px, 4.3vw, 19px);
  line-height: 1.55;
  color: var(--text);
  display: flex;
  align-items: center;
  text-align: center;
}

/* Answer block */
.card-answer {
  display: none;
  background: rgba(201,168,76,0.07);
  border: 1px solid rgba(201,168,76,0.22);
  border-radius: 10px;
  padding: 10px 13px;
  margin-top: 10px;
  flex-shrink: 0;
}

.card-answer.visible { display: block; }

.ans-label {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 4px;
}

.ans-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
}

/* Sips */
.card-sips {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--gold-line);
  flex-shrink: 0;
}

.sips-num {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: bold;
  line-height: 1;
  color: var(--gold);
}

.sips-lbl {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Tap hint ──────────────────────────────────── */
.tap-hint {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  animation: hint-pulse 2.2s ease-in-out infinite;
  flex-shrink: 0;
}

.tap-hint.hidden { visibility: hidden; animation: none; }

.deck-count {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.4;
  flex-shrink: 0;
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* ─── Bewertungs-Buttons (In-Card) ──────────────── */
.card-rating {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.card-rating.visible {
  opacity: 1;
  pointer-events: auto;
}

.rating-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.rating-btn:active {
  transform: scale(0.92);
}

.rating-btn.picked {
  background: rgba(201,168,76,0.18);
  border-color: rgba(201,168,76,0.5);
}

.card-rating.done .rating-btn:not(.picked) {
  opacity: 0.3;
  pointer-events: none;
}

/* ─── In-card tap hint ──────────────────────────── */
.card-tap-hint {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(201,168,76,0.45);
  text-align: center;
  padding-top: 6px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.card-tap-hint.visible {
  opacity: 1;
  animation: hint-pulse 2.2s ease-in-out infinite;
}

/* ─── Action buttons ────────────────────────────── */
.action-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  min-height: 48px;
}

.btn-challenge {
  width: 100%;
  padding: 13px;
  background: transparent;
  border: 1px solid var(--red);
  border-radius: 13px;
  color: var(--red);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.03em;
}
.btn-challenge:active { background: rgba(217,80,80,0.14); }

.btn-pass {
  width: 100%;
  padding: 13px;
  background: transparent;
  border: 1px solid var(--green);
  border-radius: 13px;
  color: var(--green);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.03em;
}
.btn-pass:active { background: rgba(61,186,110,0.14); }

.btn-next {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #d4b056, #a07830);
  border: none;
  border-radius: 13px;
  color: #06090f;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 4px 18px rgba(201,168,76,0.24);
}
.btn-next:active { opacity: 0.8; transform: scale(0.98); }

/* ─── Card transition animations ───────────────── */
@keyframes card-out {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-36px) scale(0.93); }
}

@keyframes card-in {
  0%   { opacity: 0; transform: translateY(20px) scale(0.93); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.flip-wrap.leaving {
  animation: card-out 0.28s ease-in forwards;
  pointer-events: none;
}

.flip-wrap.entering {
  animation: card-in 0.28s ease-out forwards;
}

/* ─── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-line); border-radius: 2px; }
