@font-face { font-family: "Tetria"; src: url("/fonts/tetria-light.woff2") format("woff2"), url("/fonts/tetria-light.woff") format("woff"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Tetria"; src: url("/fonts/tetria-black.woff2") format("woff2"), url("/fonts/tetria-black.woff") format("woff"); font-weight: 900; font-style: normal; font-display: swap; }

:root {
  --night: #070b16;
  --glass: rgba(14, 10, 12, 0.58);
  --gold: #e6bd6e;
  --gold-deep: #b98a35;
  --gold-line: rgba(230, 189, 110, 0.38);
  --wine: #7a1322;
  --snow: #f3efe6;
  --snow-dim: rgba(243, 239, 230, 0.66);
  --serif: "Tetria", "Segoe UI", system-ui, sans-serif;
  --sans: "Tetria", "Segoe UI", system-ui, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --night: #070b16; }
}
:root[data-theme="dark"] { --night: #070b16; }

*, *::before, *::after { box-sizing: inherit; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--night);
  color: var(--snow);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene.dragging { cursor: grabbing; }
#scene.pointing { cursor: pointer; }

.title {
  position: fixed;
  top: calc(22px + env(safe-area-inset-top, 0px));
  left: 28px;
  pointer-events: none;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.8);
}
.title h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 900;
  font-style: normal;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--gold);
}
.title p {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--snow-dim);
}

/* Karte, die den Text einer Kugel zeigt */
#card {
  position: fixed;
  left: 0; top: 0;
  width: max-content;
  max-width: min(280px, 78vw);
  padding: 14px 18px 15px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  will-change: transform;
}
#card.show { opacity: 1; }
#card.red { border-color: rgba(190, 60, 78, 0.6); }
#card .kind {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.72rem;
  color: var(--snow-dim);
  margin-bottom: 6px;
}
#card .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff3cf, var(--gold) 45%, var(--gold-deep));
}
#card.red .dot { background: radial-gradient(circle at 32% 30%, #e8909c, var(--wine) 50%, #3d060e); }
#card .text {
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.32;
  color: var(--snow);
}

/* Eingabe */
.panel {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 28px));
  padding: 22px 20px 14px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 236, 190, 0.12);
}
/* Aufhänger: die Eingabe hängt selbst wie ein Anhänger am Faden */
.panel::before {
  content: "";
  position: absolute;
  top: -13px; left: 50%;
  width: 26px; height: 26px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff6d8, var(--gold) 42%, var(--gold-deep) 78%, #6d4c12);
  box-shadow: 0 0 22px rgba(240, 190, 90, 0.65), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.panel label {
  display: block;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.32rem;
  line-height: 1.2;
  margin-bottom: 12px;
}
.row { display: flex; gap: 10px; align-items: stretch; }
.panel input {
  flex: 1; min-width: 0;
  font: 400 0.95rem var(--sans);
  color: var(--snow);
  background: rgba(255, 245, 220, 0.06);
  border: 1px solid rgba(230, 189, 110, 0.28);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.panel input::placeholder { color: rgba(243, 239, 230, 0.42); }
.panel input:focus {
  border-color: var(--gold);
  background: rgba(255, 245, 220, 0.1);
  box-shadow: 0 0 0 3px rgba(230, 189, 110, 0.18);
}
.panel button.hang {
  font: 900 0.92rem var(--sans);
  color: #2a1a02;
  border: 0;
  border-radius: 12px;
  padding: 0 20px;
  cursor: pointer;
  background: linear-gradient(160deg, #ffe9b0, var(--gold) 45%, var(--gold-deep));
  box-shadow: 0 6px 22px rgba(230, 180, 80, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.15s, filter 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.panel button.hang:hover { filter: brightness(1.07); }
.panel button.hang:active { transform: translateY(1px); }
.panel button.hang:disabled { opacity: 0.45; cursor: default; filter: none; }
.panel button:focus-visible { outline: 2px solid var(--snow); outline-offset: 2px; }
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 14px;
  margin-top: 10px;
  font-size: 0.72rem;
  color: var(--snow-dim);
}
.foot button {
  font: inherit; color: inherit;
  background: none; border: 0; padding: 0;
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.foot button[hidden] { display: none; }

@media (max-width: 520px) {
  .title { left: 16px; }
  .title p { font-size: 0.78rem; margin-top: 6px; }
  .panel { padding: 20px 14px 12px; }
  .panel label { font-size: 1.15rem; }
  .row { flex-direction: column; }
  .panel button.hang { padding: 12px 20px; }
}
/* Sprachwahl: drei Flaggen, mittig auf dem oberen Rand des Eingabefelds, rechts */
.gm-lang {
  position: absolute; top: 0; right: 18px;
  transform: translateY(-50%);
  display: flex; gap: 8px;
}
.gm-lang button {
  width: 30px; height: 30px; padding: 0;
  border-radius: 50%; overflow: hidden; cursor: pointer;
  border: 2px solid var(--gold-line);
  background: var(--night);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  opacity: 0.72;
  transition: transform 0.15s, opacity 0.2s, border-color 0.2s;
}
.gm-lang button svg { display: block; width: 100%; height: 100%; }
.gm-lang button:hover { opacity: 1; transform: translateY(-1px); }
.gm-lang button[aria-pressed="true"] { opacity: 1; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(230, 189, 110, 0.35), 0 4px 14px rgba(0, 0, 0, 0.5); }
.gm-lang button:focus-visible { outline: 2px solid var(--snow); outline-offset: 2px; }

/* Bildschirm und Studio: keine Bedienung, grössere Karte, skaliert mit dem Format */
body.gm-noui .panel, body.gm-noui #count { display: none; }
body.gm-noui:not(.gm-show-title) .title { display: none; }
body.gm-noui #scene { cursor: none; }
body.gm-noui #card { max-width: min(72vmin, 900px); padding: 2vmin 2.6vmin 2.2vmin; border-radius: 1.6vmin; }
body.gm-noui #card .kind { font-size: clamp(0.72rem, 2.2vmin, 1.7rem); margin-bottom: 0.8vmin; gap: 1vmin; }
body.gm-noui #card .dot { width: 1.4vmin; height: 1.4vmin; min-width: 8px; min-height: 8px; }
body.gm-noui #card .text { font-size: clamp(1.1rem, 4.2vmin, 3.4rem); line-height: 1.25; }
body.gm-noui.gm-show-title .title { top: 4vmin; left: 4vmin; }
body.gm-noui.gm-show-title .title h1 { font-size: clamp(2rem, 7vmin, 6rem); }
body.gm-noui.gm-show-title .title p { display: block; font-size: clamp(0.8rem, 2.2vmin, 1.8rem); }
.gm-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#fallback {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center; text-align: center; padding: 24px;
  font-family: var(--serif); font-size: 1.3rem;
}

/* Studio: die Oberfläche zeichnet das Studio selbst ins Video */
body.gm-studio .title, body.gm-studio #card { display: none !important; }
body.gm-studio #scene { cursor: grab; }
