/* ── Lokale Fonts (kein Google Fonts CDN) ────────────────────────────────── */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/fraunces-latin-800-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/fraunces-latin-800-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/dm-sans-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/dm-sans-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/dm-sans-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── SpielFinn Shared Styles ────────────────────────────────────────────── */
/* Wird von spielfinn-v0.1.html, uno/game.html und 7mal7/game.html geladen.  */

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { -webkit-tap-highlight-color: transparent; }
*:focus-visible { outline: 3px solid #E63946; outline-offset: 2px; border-radius: 4px; }

/* ── Design Tokens ───────────────────────────────────────────────────────── */
:root {
  --terra:    #E07A5F;   /* Haupt-Akzentfarbe (terra = rot-orange) */
  --schiefer: #3D405B;
  --creme:    #F2CC8F;
  --salbei:   #81B29A;
  --himmel:   #8ECAE6;
  --red:      #E07A5F;   /* Alias für --terra (Abwärtskompatibilität) */
  --navy:     #3D405B;   /* Alias für --schiefer */
  --bg:       #e8e4de;
  --header-h: 64px;
  --c-red:    #E63946;   /* Fehler-/Error-Rot (deutlich dunkler als --terra) */
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  position: fixed; top: 0; left: 0;
  width: 100%; height: var(--header-h); z-index: 100;
  background: rgba(240,237,232,0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 2px 8px rgba(29,53,87,0.08);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
}
.header-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.header-grid-wrap { transform: rotate(-5deg); flex-shrink: 0; padding: 2px; }
.header-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 3px; width: 28px; height: 28px; }
.header-wordmark-svg { height: 26px; width: auto; flex-shrink: 0; overflow: visible; }

/* ── Logo-Kacheln (Animation) ────────────────────────────────────────────── */
.logo-tile { perspective: 200px; }
.logo-tile-inner {
  width: 100%; height: 100%; border-radius: 2px;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
.logo-tile-inner.flipped { transform: rotateY(180deg); }
.logo-tile-front, .logo-tile-back {
  position: absolute; inset: 0; border-radius: 2px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.logo-tile-back { transform: rotateY(180deg); }

/* ── Toasts ──────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; top: calc(var(--header-h) + 8px); left: 50%;
  transform: translateX(-50%);
  z-index: 400; display: flex; flex-direction: column; gap: 6px;
  pointer-events: none; width: calc(100% - 32px); max-width: 400px;
}
.toast {
  background: rgba(61,64,91,0.92);
  border-radius: 12px; padding: 10px 16px;
  font-size: 13px; font-weight: 500; color: #fff;
  text-align: center;
  animation: toastIn 0.3s ease forwards;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(61,64,91,0.2);
}
.toast.error { background: rgba(230,57,70,0.92); }
@keyframes toastIn  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-6px); } }
.toast.hiding { animation: toastOut 0.3s ease forwards; }

/* ── Gemeinsame Lobby / Warteraum Elemente ───────────────────────────────── */
.screen { display: none; flex-direction: column; padding: 28px 16px 36px; gap: 16px; max-width: 480px; margin: 0 auto; width: 100%; }
.screen.active { display: flex; }

.lobby-hero {
  background: var(--game-color, var(--terra));
  border-radius: 10px;
  padding: 28px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
}
.lobby-hero-title {
  font-family: 'Fraunces', serif;
  font-size: 52px; font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em; line-height: 1;
}
.lobby-hero-sub { font-size: 13px; color: rgba(61,64,91,0.55); font-weight: 500; }

.section-label {
  font-size: 11px; font-weight: 700;
  color: rgba(61,64,91,0.5);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0 2px;
}

.sf-input {
  width: 100%;
  background: #fff;
  border: 1.5px solid rgba(61,64,91,0.18);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px; color: var(--navy);
  outline: none;
  transition: border-color 0.2s;
}
.sf-input::placeholder { color: rgba(61,64,91,0.35); }
.sf-input:focus { border-color: rgba(61,64,91,0.4); }
.sf-input.code {
  text-transform: uppercase; letter-spacing: 0.15em;
  font-weight: 700; text-align: center; font-size: 18px;
}

.btn-primary {
  width: 100%;
  background: var(--navy); color: #fff;
  border: none; border-radius: 22px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 700;
  height: 50px; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.4; cursor: default; }
.btn-primary.accent { background: var(--terra); }

.btn-secondary {
  width: 100%;
  background: rgba(61,64,91,0.08); color: var(--navy);
  border: none; border-radius: 22px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 700;
  height: 50px; cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:active { background: rgba(61,64,91,0.14); }
.btn-secondary:disabled { opacity: 0.35; cursor: default; }
.btn-secondary.active { background: var(--navy); color: #fff; }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: rgba(61,64,91,0.35); font-size: 12px; font-weight: 600;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px;
  background: rgba(61,64,91,0.12);
}

.error-msg {
  font-size: 13px; color: var(--c-red);
  text-align: center; min-height: 18px; font-weight: 500;
}

/* ── Warteraum ───────────────────────────────────────────────────────────── */
.room-code-card {
  background: #fff; border-radius: 10px;
  padding: 20px; text-align: center;
  border: 1px solid rgba(61,64,91,0.1);
}
.room-code-label {
  font-size: 11px; color: rgba(61,64,91,0.45); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px;
}
.room-code-value {
  font-family: 'Fraunces', serif;
  font-size: 42px; font-weight: 800;
  letter-spacing: 0.15em; color: var(--terra); line-height: 1;
}
.room-code-hint { font-size: 12px; color: rgba(61,64,91,0.4); margin-top: 6px; }

.player-list { display: flex; flex-direction: column; gap: 8px; }
.player-item {
  background: #fff; border: 1px solid rgba(61,64,91,0.1);
  border-radius: 10px; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.player-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-size: 16px; font-weight: 800;
  color: #fff; flex-shrink: 0;
}
.player-item-name { flex: 1; font-size: 14px; font-weight: 600; }
.player-item-you { font-size: 11px; color: rgba(61,64,91,0.4); }
.ready-badge {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(129,178,154,0.15); color: var(--salbei);
  border: 1px solid rgba(129,178,154,0.3);
}
.waiting-badge { font-size: 11px; color: rgba(61,64,91,0.4); }

.kick-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: transparent;
  color: rgba(61,64,91,0.25); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.kick-btn:hover { background: rgba(230,57,70,0.1); color: #E63946; }

/* ── Name-Eingabe ────────────────────────────────────────────────────────── */
.name-section { display: flex; flex-direction: column; gap: 5px; }
.name-label {
  font-size: 11px; font-weight: 700; color: rgba(61,64,91,0.5);
  text-transform: uppercase; letter-spacing: 0.08em; padding: 0 2px;
}
.name-input-wrap { position: relative; flex: 1; }
.name-input-wrap .sf-input { width: 100%; }
.name-input-wrap .sf-input.is-generated { color: rgba(61,64,91,0.38); }
.fake-cursor {
  position: absolute; left: 17px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 18px; background: rgba(61,64,91,0.45);
  pointer-events: none; animation: blink-cursor 1s step-end infinite; border-radius: 1px;
}
.fake-cursor.hidden { display: none; }
@keyframes blink-cursor { 0%,100%{opacity:1} 50%{opacity:0} }

.name-row { display: flex; gap: 8px; align-items: stretch; }
.name-row .sf-input { flex: 1; }
.btn-shuffle {
  width: 52px; flex-shrink: 0;
  background: #fff; border: 1.5px solid rgba(61,64,91,0.18); border-radius: 10px;
  cursor: pointer; color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.btn-shuffle:active { background: rgba(61,64,91,0.07); transform: scale(0.93); }

/* ── Warteschlange ───────────────────────────────────────────────────────── */
.queue-status {
  display: flex; align-items: center; gap: 10px;
  background: rgba(129,178,154,0.1);
  border: 1px solid rgba(129,178,154,0.35);
  border-radius: 10px; padding: 10px 14px;
  font-size: 13px; font-weight: 600; color: var(--salbei);
}
.queue-spinner {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid rgba(129,178,154,0.3);
  border-top-color: var(--salbei);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.queue-status span { flex: 1; }
.queue-cancel-text {
  background: none; border: none; cursor: pointer; padding: 0;
  font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 600;
  color: rgba(61,64,91,0.45);
  text-decoration: underline; text-underline-offset: 2px;
  transition: color 0.15s; white-space: nowrap;
}
.queue-cancel-text:hover { color: var(--terra); }

/* ── Public-Toggle ───────────────────────────────────────────────────────── */
.public-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 2px 0; }
.public-toggle input[type="checkbox"] { display: none; }
.public-toggle-box {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 1.5px solid rgba(61,64,91,0.25);
  border-radius: 5px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.public-toggle input:checked + .public-toggle-box { background: var(--salbei); border-color: var(--salbei); }
.public-toggle input:checked + .public-toggle-box::after {
  content: ''; width: 5px; height: 9px;
  border: 2px solid #fff; border-top: none; border-left: none;
  transform: rotate(45deg) translateY(-1px); display: block;
}
.public-toggle-label { font-size: 13px; color: rgba(61,64,91,0.6); font-weight: 500; user-select: none; }
.input-hint { font-size: 11px; color: rgba(61,64,91,0.4); font-weight: 500; padding: 0 4px; margin-top: -8px; }

/* ── Gewinner Screen (gemeinsam) ─────────────────────────────────────────── */
.win-card {
  background: #fff; border-radius: 22px; padding: 36px 24px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(61,64,91,0.12);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.win-emoji { font-size: 64px; }
.win-title { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 800; color: var(--navy); }
.win-sub { font-size: 14px; color: rgba(61,64,91,0.5); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.sf-footer {
  width: 100%;
  padding: 0 0 28px;
  margin-top: auto;
  border-top: 1px solid rgba(61,64,91,0.1);
}
.sf-footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 14px;
  padding-top: 16px;
}
.sf-footer-brand {
  font-family: 'Fraunces', serif; font-size: 13px; font-weight: 800;
  color: rgba(61,64,91,0.3); letter-spacing: -0.01em;
}
.sf-footer-links {
  display: flex; gap: 16px; align-items: center;
}
.sf-footer-links a {
  font-size: 12px; font-weight: 500; color: rgba(61,64,91,0.4);
  text-decoration: none; transition: color 0.15s;
}
.sf-footer-links a:hover { color: var(--navy); }
