/* ==========================================================
   Retro-Typer – Stylesheet
   Die Schreibmaschine selbst wird in world.js als 3D-Szene gerendert.
   ========================================================== */

:root {
  --bg: #fcfbf8;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .38 0 0 0 0 .32 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --bg-paper:
    radial-gradient(ellipse 85% 75% at 50% 45%, rgba(0, 0, 0, 0) 55%, rgba(105, 92, 72, .1) 100%),
    var(--grain),
    repeating-linear-gradient(0deg, rgba(120, 108, 90, .028) 0 1px, transparent 1px 3px),
    #fcfbf8;
  --ink: #18171a;
  --accent: #a8232b;
  --muted: #a5a5a8;
  --font-type: 'Special Elite', 'Courier New', Courier, monospace;
  --font-script: 'Yellowtail', 'Brush Script MT', cursive;
  --title-h: 50vh;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-type);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
}

#app {
  position: fixed;
  left: 0; top: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-paper);
  touch-action: none;
  cursor: text;
}

/* ---------------- 3D-Bühne ---------------- */

.stage {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.1s ease;
}
.stage.ready { opacity: 1; }
.stage canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ---------------- Werkzeugleiste ---------------- */

.toolbar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 4px;
  z-index: 40;
}

.toolbar { gap: 10px; }
.tb {                                   /* kleine Schreibmaschinentasten */
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  background:
    radial-gradient(circle at 42% 32%, #3c3c40 0%, #141416 58%, #040405 100%) padding-box,
    conic-gradient(from 200deg, #6f6d69, #fafafa, #a3a19c, #ffffff, #7a7874, #d9d7d2, #6f6d69) border-box;
  color: #efe7d3;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 3px 0 #0b0b0c, 0 6px 10px rgba(40, 30, 20, .25);
  transition: transform .07s ease, box-shadow .07s ease, filter .15s;
}
.tb:hover { filter: brightness(1.18); }
.tb:active { transform: translateY(2px); box-shadow: 0 1px 0 #0b0b0c, 0 3px 5px rgba(40, 30, 20, .25); }
.tb:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.tb svg { width: 17px; height: 17px; }
.tb .ico-off { display: none; }
.tb[aria-pressed="false"] .ico-on { display: none; }
.tb[aria-pressed="false"] .ico-off { display: block; }

/* ---------------- Impressum ---------------- */

.legal {                                /* dezente Links, wie eingeprägt auf dem schwarzen Korpus */
  position: absolute;
  left: 0; top: 0;
  transform: translate(-50%, -50%);
  z-index: 30;
  display: flex;
  align-items: center;
  white-space: nowrap;
  color: rgba(214, 198, 160, .5);
  opacity: 0;
  transition: opacity .8s ease;
}
.legal.ready { opacity: 1; }
.legal-sep { font-size: 10px; opacity: .7; }
.imprint-btn {
  padding: 6px 7px;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: var(--font-type);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .2s;
}
.imprint-btn:hover, .imprint-btn:focus-visible { color: rgba(232, 214, 168, .95); outline: none; }

.imprint-card { width: min(100%, 520px); }
.dialog { touch-action: auto; }
.imprint-body {
  margin-top: 14px;
  max-height: min(58vh, 460px);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  font-size: 13.5px;
  line-height: 1.55;
  color: #3d3a36;
  padding-right: 6px;
}
.imprint-body p + p { margin-top: 4px; }
.imprint-body .imp-h {
  margin-top: 14px;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.imprint-body .imp-h:first-child { margin-top: 0; }
.imprint-body .imp-link { color: inherit; text-decoration: underline; text-decoration-color: rgba(168, 35, 43, .5); text-underline-offset: 2px; }
.imprint-body .imp-link:hover { color: var(--accent); }
.imprint-body .para { font-family: Georgia, 'Times New Roman', serif; font-weight: 700; letter-spacing: 0; }

/* ---------------- Marke oben links ---------------- */

.brand {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .6s ease, transform .6s ease;
}
.brand.show { opacity: 1; transform: none; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-name {
  display: flex;
  align-items: baseline;
  font-size: 21px;
  line-height: 1;
  white-space: nowrap;
}
.brand-name .retro { margin-right: .04em; }
.brand-typer {
  font-family: var(--font-type);
  color: var(--ink);
  letter-spacing: .04em;
  text-shadow: 0 0 1px rgba(0, 0, 0, .45);
}
@media (max-width: 420px) {
  .brand-mark { width: 32px; height: 32px; }
  .brand-name { font-size: 18px; }
}

/* ---------------- Titel ---------------- */

.title {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: var(--title-h);
  padding: 60px 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .6em;
  container-type: size;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity .7s ease, transform .7s ease;
}
.title.ready { opacity: 1; }
.title.hidden { opacity: 0; transform: translateY(-16px); }

.logo {
  display: flex;
  align-items: baseline;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  font-size: 26px;
  font-size: min(5cqw, 15cqh, 40px);
}

.mark {
  width: 54px;
  height: 54px;
  width: min(13cqw, 24cqh, 64px);
  height: min(13cqw, 24cqh, 64px);
  margin-bottom: .1em;
  opacity: 0;
}
.title.ready .mark { animation: markIn .7s cubic-bezier(.2, .8, .25, 1) both; }
@keyframes markIn {
  0%   { opacity: 0; transform: translateY(-10px) scale(.92); }
  60%  { opacity: 1; transform: translateY(2px) scale(1); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.retro {                                /* gleiche Schrift wie das „R“ im Logo, mit Buchdruck-Prägung */
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  color: var(--accent);
  font-size: 1em;
  margin-right: .04em;
  display: inline-block;
  letter-spacing: .01em;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, .75),
    0 -1px 0 rgba(90, 10, 14, .25),
    0 0 1px rgba(120, 20, 24, .45);
}

.typer {
  font-family: var(--font-type);
  color: var(--ink);
  letter-spacing: .04em;
  display: inline-flex;
}
.typer i {
  font-style: normal;
  opacity: 0;
  text-shadow: 0 0 1px rgba(0, 0, 0, .45);
}
.title.ready .retro { animation: retroIn 1s cubic-bezier(.2, .7, .2, 1) both; }
.title.ready .typer i { animation: keyIn .01s linear forwards; }
.title.ready .typer i:nth-child(1) { animation-delay: .75s; }
.title.ready .typer i:nth-child(2) { animation-delay: .93s; }
.title.ready .typer i:nth-child(3) { animation-delay: 1.08s; }
.title.ready .typer i:nth-child(4) { animation-delay: 1.26s; }
.title.ready .typer i:nth-child(5) { animation-delay: 1.4s; }

@keyframes retroIn {
  from { opacity: 0; clip-path: inset(0 100% 0 0); }
  to   { opacity: 1; clip-path: inset(0 -10% 0 0); }
}
@keyframes keyIn { to { opacity: 1; } }

.tagline {                              /* wie eine alte Reklamezeile: Versalien zwischen Zierlinien */
  display: flex;
  align-items: center;
  gap: .9em;
  font-family: var(--font-type);
  color: #4a4744;
  font-size: 10px;
  font-size: clamp(9px, min(1.9cqw, 5cqh), 12px);
  letter-spacing: .24em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 .5px rgba(0, 0, 0, .35);
  opacity: 0;
  margin-top: -.1em;
}
.tagline::before, .tagline::after {
  content: '';
  width: 4.2em;
  height: 7px;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat;
  opacity: .55;
  -webkit-mask: linear-gradient(90deg, transparent, #000 40%);
          mask: linear-gradient(90deg, transparent, #000 40%);
}
.tagline::after {
  -webkit-mask: linear-gradient(270deg, transparent, #000 40%);
          mask: linear-gradient(270deg, transparent, #000 40%);
}
.tagline i {                            /* Raute */
  font-style: normal;
  color: var(--accent);
  letter-spacing: 0;
  font-size: .9em;
}
.title.ready .tagline { animation: hintIn .7s 1.55s ease forwards; }

.hint {
  font-family: var(--font-type);
  color: var(--muted);
  font-size: 13px;
  font-size: clamp(11px, min(2.8cqw, 6cqh), 15px);
  letter-spacing: .06em;
  opacity: 0;
}
.title.ready .hint { animation: hintIn .6s 2.2s ease forwards, blink 1.6s 2.8s steps(1) infinite; }
@keyframes hintIn { to { opacity: 1; } }
@keyframes blink { 50% { opacity: .35; } }

/* ---------------- Meldungen im Retro-Look ---------------- */

.notice,
.dlg-card {
  background:
    repeating-linear-gradient(0deg, rgba(120, 105, 80, .035) 0 1px, transparent 1px 3px),
    #fffdf8;
  color: var(--ink);
  font-family: var(--font-type);
  border: 1px solid #ddd6c8;
  box-shadow:
    0 1px 0 #fff inset,
    0 2px 4px rgba(0, 0, 0, .06),
    0 18px 40px rgba(0, 0, 0, .14);
}

.notice {
  position: absolute;
  left: 50%;
  top: max(64px, calc(env(safe-area-inset-top) + 56px));
  transform: translateX(-50%) rotate(-.6deg);
  width: min(92vw, 520px);
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: .02em;
  text-align: left;
  z-index: 50;
}
.notice::before {
  content: 'HINWEIS';
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: .25em;
}

.dialog {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(252, 251, 248, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: dlgFade .25s ease both;
  cursor: default;
}
.dialog[hidden] { display: none; }

.dlg-card {
  position: relative;
  width: min(100%, 440px);
  padding: 30px 30px 24px;
  transform: rotate(-.8deg);
  animation: dlgFeed .45s cubic-bezier(.2, .8, .25, 1) both;
}
.dlg-card::before {                     /* doppelte Rahmenlinie wie auf altem Formular */
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(40, 34, 26, .18);
  outline: 1px solid rgba(40, 34, 26, .1);
  outline-offset: 3px;
  pointer-events: none;
}
.dlg-title {
  font-size: 22px;
  letter-spacing: .03em;
  min-height: 1.3em;
  text-shadow: 0 0 .6px rgba(0, 0, 0, .45);
}
.dlg-text {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.55;
  color: #3d3a36;
  min-height: 1.55em;
}
.dlg-title .cur, .dlg-text .cur {
  display: inline-block;
  width: .6em;
  border-bottom: 2px solid var(--accent);
  animation: blink 1s steps(1) infinite;
}

.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 26px;
  flex-wrap: wrap;
}
.dlg-btn {                              /* Schreibmaschinentaste */
  position: relative;
  min-width: 118px;
  height: 46px;
  padding: 0 18px;
  border-radius: 23px;
  border: 3px solid transparent;
  background:
    radial-gradient(ellipse at 45% 30%, #3a3a3e 0%, #121214 60%, #050506 100%) padding-box,
    linear-gradient(180deg, #f6f5f2, #a8a6a1 45%, #6f6d69 55%, #d9d7d2) border-box;
  color: #f1e9d4;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 0 #0b0b0c, 0 7px 12px rgba(0, 0, 0, .3);
  transition: transform .07s ease, box-shadow .07s ease;
}
.dlg-btn span { position: relative; top: 1px; }
.dlg-btn:hover { filter: brightness(1.12); }
.dlg-btn:active, .dlg-btn.down {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #0b0b0c, 0 3px 6px rgba(0, 0, 0, .3);
}
.dlg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.dlg-btn.primary { color: #fff; }
.dlg-btn.primary::after {               /* rote Markierung wie bei der Farbband-Taste */
  content: '';
  position: absolute;
  left: 50%; bottom: 7px;
  width: 18px; height: 2px;
  margin-left: -9px;
  background: #b3262e;
  border-radius: 2px;
}

@keyframes dlgFade { from { opacity: 0; } }
@keyframes dlgFeed {
  from { opacity: 0; transform: translateY(26px) rotate(-.8deg); }
  to   { opacity: 1; transform: translateY(0) rotate(-.8deg); }
}

@media (max-width: 420px) {
  .dlg-card { padding: 26px 20px 20px; }
  .dlg-btn { min-width: 0; flex: 1; }
}

/* ---------------- Eingabe ---------------- */

.input {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 2px;
  height: 2px;
  opacity: 0;
  border: 0;
  padding: 0;
  resize: none;
  overflow: hidden;
  font-size: 16px;
  color: transparent;
  background: transparent;
  caret-color: transparent;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .title.ready .hint { animation: hintIn .3s forwards; }
}
