/* Schrift: Bricolage Grotesque (Google Fonts, SIL Open Font License), lokal im Ordner fonts/,
   damit das Spiel auch ohne Internet überall gleich aussieht. Variable Schrift: eine Datei für alle Stärken. */
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/bricolage-grotesque-latin.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Spieltisch: dunkle, flache Fläche (auf dem Beamer = wenig Licht), die Karten sind das einzig Helle. */
:root {
  --table: #15130f;
  --rule: #39342c;
  --ink: #f4efe4;
  --muted: #b3aa99;
  --card: #fbf8f1;
  --card-edge: #d8d0c0;
  --a: #2e86de;
  --b: #ee6c2b;
  --pile: min(48vh, 32vw);
  --hand: min(52vh, 36vw);
  font-family: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--table);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
::selection { background: var(--ink); color: var(--table); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.hidden { display: none !important; }

kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.9em; height: 1.7em; padding: 0 .4em;
  border: 1.5px solid currentColor; border-radius: .35em;
  font: inherit; font-size: .8em; font-weight: 600; line-height: 1;
}
/* Pfeiltasten als gezeichnete Pfeile statt Zeichen */
kbd.arrow::before {
  content: ""; width: .9em; height: .9em; background: currentColor;
  -webkit-mask: var(--arrow) center / contain no-repeat; mask: var(--arrow) center / contain no-repeat;
}
kbd.arrow.l { --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M14 8H3M7.5 3.5 3 8l4.5 4.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
kbd.arrow.r { --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 8h11M8.5 3.5 13 8l-4.5 4.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* ---------- Startbildschirm ---------- */
#setup { position: fixed; inset: 0; overflow: auto; }
.setup { width: min(820px, 100% - 48px); margin: 7vh auto 6vh; }
h1 { margin: 0 0 40px; font-size: 56px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }

.names { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 40px; }
.name { display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-weight: 600; }
.name.a span { color: var(--a); }
.name.b span { color: var(--b); }
.name input {
  font: inherit; font-size: 24px; font-weight: 500; color: var(--ink); caret-color: currentColor;
  padding: 6px 0 8px; background: none; border: 0; border-bottom: 2px solid var(--rule); border-radius: 0;
}
.name input:focus { outline: none; }
.name.a input:focus { border-bottom-color: var(--a); }
.name.b input:focus { border-bottom-color: var(--b); }

.source { margin-bottom: 40px; }
.status { margin: 0 0 16px; font-size: 15px; color: var(--muted); max-width: 70ch; }
.status.ok { color: #9fd49a; }
.status.err { color: #ff9c86; }
/* Auswahlkarten (Kartensatz, Schwierigkeit): Radiobuttons, die ganze Karte ist klickbar */
.choice { border: 0; padding: 0; margin: 28px 0 0; min-width: 0; }
.choice legend { padding: 0; margin-bottom: 10px; font-size: 15px; font-weight: 600; }
.opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.opts.three { grid-template-columns: repeat(3, 1fr); }
.opts.auto { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.opt {
  position: relative; display: flex; flex-direction: column; gap: 4px; cursor: pointer;
  padding: 14px 16px; border: 1.5px solid var(--rule); border-radius: 10px;
  transition: border-color .15s ease-out, background-color .15s ease-out;
}
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt:hover { border-color: var(--muted); }
.opt-title { font-size: 17px; font-weight: 700; color: var(--ink); }
.opt-text { font-size: 14px; line-height: 1.35; color: var(--muted); }
.opt-meta { margin-top: auto; padding-top: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.opt:has(input:checked) { border-color: var(--card); background: var(--card); }
.opt:has(input:checked) .opt-title, .opt:has(input:checked) .opt-text, .opt:has(input:checked) .opt-meta { color: var(--table); }
.opt:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; }
.opt:has(input:disabled) { cursor: not-allowed; border-style: dashed; }
.opt:has(input:disabled):hover { border-color: var(--rule); }
.opt:has(input:disabled) .opt-title, .opt:has(input:disabled) .opt-text { color: #6a6255; }
@media (max-width: 640px) { .opts, .opts.three, .opts.auto { grid-template-columns: 1fr 1fr; } }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }

/* Symbole auf dem Einstellungsbildschirm: nur eine kurze Zeile, alles Weitere im Dialog */
.symbols-row { display: flex; align-items: center; gap: 18px; }
.symbols-info { flex: 1; min-width: 0; }
.symbols-info .status { margin: 0; }
.peek { display: flex; flex: none; }
.peek .sym { width: 40px; height: 40px; margin-left: -12px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 2px var(--table);
  display: flex; align-items: center; justify-content: center; font-size: 22px; overflow: hidden; }
.peek .sym:first-child { margin-left: 0; }
.peek .sym img { width: 70%; height: 70%; object-fit: contain; }

.sym-dialog { width: min(900px, 100% - 48px); max-height: min(86vh, 900px); padding: 0; color: var(--ink); background: var(--table);
  border: 1.5px solid var(--rule); border-radius: 14px; }
.sym-dialog::backdrop { background: rgb(10 9 7 / .72); }
.sym-dialog-in { padding: 24px 28px 28px; }
.sym-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.sym-head h2 { margin: 0; font-size: 24px; }
.sym-dialog .preview { max-height: none; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
@media (max-width: 640px) { .symbols-row { flex-wrap: wrap; } .peek { display: none; } }

.btn {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--ink);
  background: none; border: 1.5px solid var(--rule); border-radius: 8px; padding: 9px 16px;
  transition: border-color .15s ease-out, background-color .15s ease-out;
}
.btn:hover { border-color: var(--muted); }
.btn.start {
  display: block; width: 100%; padding: 16px; font-size: 22px; font-weight: 700;
  background: var(--card); color: var(--table); border-color: var(--card);
}
.btn.start:hover { background: #fff; }
.btn.start:disabled { background: none; color: var(--muted); border-color: var(--rule); cursor: not-allowed; }

.preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; max-height: 24vh; overflow: auto; scrollbar-color: var(--rule) transparent; }
.preview .sym { aspect-ratio: 1; background: var(--card); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; overflow: hidden; }
.preview .sym img { width: 70%; height: 70%; object-fit: contain; }

.rules { margin-top: 32px; font-size: 15px; line-height: 1.55; color: var(--muted); }
.rules summary { cursor: pointer; font-weight: 600; color: var(--ink); list-style: none; display: inline-flex; align-items: center; gap: .5em; }
.rules summary::-webkit-details-marker { display: none; }
.rules summary::before {
  content: ""; width: .75em; height: .75em; background: currentColor; transition: transform .15s ease-out;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 3l5 5-5 5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 3l5 5-5 5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.rules[open] summary::before { transform: rotate(90deg); }
.rules p { max-width: 70ch; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; align-items: center; margin: 18px 0 0; }
.keys dt { color: var(--ink); display: flex; gap: 6px; }
.keys dd { margin: 0; }

/* ---------- Spielfeld ---------- */
#game { position: fixed; inset: 0; }
.card { position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%; }

/* Karte: Fläche + Symbolebenen. 1 Karten-Einheit = 0.5cqw (Karte = 200 Einheiten breit). */
.dcard { position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%; container-type: inline-size; user-select: none; }
.dcard .face { position: absolute; inset: 0; border-radius: 50%; background: var(--card); border: .75cqw solid var(--card-edge); }
.dcard .orbit, .dcard .orbit-run { position: absolute; inset: 0; }
.dcard .slot { position: absolute; }
.dcard .spin, .dcard .pulse { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.dcard.moving .orbit-run, .dcard.moving .spin, .dcard.moving .pulse { will-change: transform; }
.dcard img { display: block; flex: none; width: 70.71%; height: 70.71%; object-fit: contain; }
.dcard .emo { line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.dcard .ring { position: absolute; border-radius: 50%; border: 2.25cqw solid; }
@keyframes dm-rot { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes dm-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(.8); } }

.pile-wrap { position: absolute; top: 3vh; left: 50%; transform: translateX(-50%); width: var(--pile); z-index: 5; }
.pile { position: relative; width: 100%; aspect-ratio: 1; }
.pile .card { position: absolute; inset: 0; }
.pile .card.top { will-change: transform; }
.pile-label { margin: 1.4vh 0 0; text-align: center; font-size: 2.2vh; color: var(--muted); font-variant-numeric: tabular-nums; }

.player { position: absolute; bottom: 2vh; width: var(--hand); }
.player.a { left: 3vw; }
.player.b { right: 3vw; }
.card.ghost { position: fixed; z-index: 30; pointer-events: none; will-change: transform; }
.ghost.a .face { border: 2.5cqw solid var(--a); }
.ghost.b .face { border: 2.5cqw solid var(--b); }
.hand .card { will-change: transform; }
.player.a .face { border: 2.5cqw solid var(--a); }
.player.b .face { border: 2.5cqw solid var(--b); }
.empty-card { width: 100%; height: 100%; border-radius: 50%; border: .3vh dashed var(--rule); }
.plabel { display: flex; align-items: center; justify-content: center; gap: 1.4vh; margin: 1.4vh 0 0; font-size: 3.2vh; font-weight: 700; }
.player.a .plabel { color: var(--a); }
.player.b .plabel { color: var(--b); }
.pcount { font-weight: 500; color: var(--muted); font-size: .75em; font-variant-numeric: tabular-nums; }

.winner { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgb(21 19 15 / .9); }
.winner-text { margin: 0; font-size: 11vh; font-weight: 700; letter-spacing: -0.02em; text-align: center; line-height: 1.05; }
.winner-text small { display: block; font-size: .45em; font-weight: 500; color: var(--ink); margin-top: 1.5vh; letter-spacing: 0; }
.winner-sub { margin: 5vh 0 0; font-size: 2.4vh; color: var(--muted); display: flex; gap: .5em; align-items: center; }
.winner-sub kbd { margin-left: 1em; }
.winner-sub kbd:first-child { margin-left: 0; }

/* ---------- Quizmaster-Fenster ---------- */
body.qm #root { height: 100%; display: flex; flex-direction: column; padding: 3vh 3vw 2.5vh; }
.qm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 2vw; padding-bottom: 1.6vh; border-bottom: 1px solid var(--rule); }
.qm-head h1 { margin: 0; font-size: 4vh; letter-spacing: -0.01em; }
.qm-state { margin: 0; font-size: 2.4vh; color: var(--muted); font-variant-numeric: tabular-nums; }
.qm-state b { color: var(--ink); font-weight: 700; }
.qm-sol { flex: 1.3; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; }
.qm-col { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6vh; padding: 2vh 1vw; }
.qm-col + .qm-col { border-left: 1px solid var(--rule); }
.qm-who { margin: 0; display: flex; align-items: center; gap: 1.2vh; font-size: 3.6vh; font-weight: 700; }
.qm-col.a .qm-who { color: var(--a); }
.qm-col.b .qm-who { color: var(--b); }
.qm-big { flex: 1; min-height: 0; max-height: 30vh; aspect-ratio: 1; border-radius: 50%; background: var(--card); display: flex; align-items: center; justify-content: center; }
.qm-col.a .qm-big { box-shadow: 0 0 0 .6vh var(--a); }
.qm-col.b .qm-big { box-shadow: 0 0 0 .6vh var(--b); }
.qm-big img { width: 72%; height: 72%; object-fit: contain; }
.qm-big span { font-size: 17vh; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.qm-lbl { margin: 0; font-size: 3vh; font-weight: 600; text-align: center; overflow-wrap: anywhere; }
.qm-none { margin: 0; font-size: 3vh; color: var(--muted); }
.qm-same { margin: 0 0 1.5vh; text-align: center; font-size: 2.4vh; font-weight: 600; }
.qm-cards { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3vw; padding-top: 2vh; border-top: 1px solid var(--rule); }
.qm-card { margin: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: .8vh; }
.qm-card .dcard, .qm-card .empty-card { flex: 1 1 0; min-height: 0; max-width: 100%; width: auto; aspect-ratio: 1; height: auto; }
.qm-card figcaption { font-size: 2vh; color: var(--muted); }
.qm-msg { flex: 1; display: flex; align-items: center; justify-content: center; gap: .5em; margin: 0; font-size: 3.4vh; color: var(--muted); text-align: center; }
.qm-keys { display: flex; justify-content: center; flex-wrap: wrap; gap: 1vh 3vw; padding-top: 2vh; font-size: 2vh; color: var(--muted); }
.qm-keys span { display: inline-flex; align-items: center; gap: .6em; }

/* ---------- Beamer: Startbild ---------- */
/* Der ganze Bildschirm ist die Karte: warmweiße Fläche, Symbole frei darauf, Schriftzug in Tinte. */
.intro { position: fixed; inset: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: var(--card); color: var(--table); }
.intro ::selection { background: var(--table); color: var(--card); }
.intro-symbols { position: absolute; inset: 0; pointer-events: none; }
.intro-sym { position: absolute; display: flex; align-items: center; justify-content: center; }
.intro-in { display: flex; align-items: center; justify-content: center; }
.intro-sym img { display: block; object-fit: contain; filter: drop-shadow(0 .5vh .8vh rgb(21 19 15 / .16)); }
.intro-sym span { line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }

.intro-mark { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; }
.logo-word { margin: 0; font-size: 21vh; font-weight: 800; letter-spacing: -0.045em; line-height: .82; }
.logo-sub { margin: 2.6vh 0 0; display: flex; align-items: center; gap: 1.4vh; font-size: 3.4vh; font-weight: 600; letter-spacing: -0.01em; color: #5f574b; }
.logo-sub::before, .logo-sub::after { content: ""; width: 1.2vh; height: 1.2vh; border-radius: 50%; }
.logo-sub::before { background: var(--a); }
.logo-sub::after { background: var(--b); }
.intro-hint { margin: 4.5vh 0 0; display: flex; align-items: center; gap: .55em; font-size: 1.8vh; font-weight: 500; color: #6f675b; }

/* Ein einziger Auftritt beim Erscheinen: Schriftzug und Symbole setzen sich nacheinander ab. */
@keyframes intro-in { from { opacity: 0; transform: translateY(2.2vh) scale(.94); } to { opacity: 1; transform: none; } }
.intro:not(.hidden) .intro-in, .intro:not(.hidden) .intro-mark { animation: intro-in .7s cubic-bezier(.16, 1, .3, 1) both; }
@media (prefers-reduced-motion: reduce) {
  .intro:not(.hidden) .intro-in, .intro:not(.hidden) .intro-mark { animation: none; }
}
