/* JULUS TEXT — Teletext-Bildschirm plus Fernbedienung.
   Layout: quer Seite links + Fernbedienung rechts (side), hoch Seite oben + Fernbedienung unten (stack),
   Handy quer nur Seite mit einblendbarer Fernbedienung (tv). Modus und Zellmaß setzt teletext.js. */
@font-face { font-family: "Bedstead"; src: url("/static/fonts/bedstead.otf") format("opentype"); font-display: block; }
:root {
  color-scheme: dark;
  --tt-k: #000000; --tt-r: #ff0000; --tt-g: #00ff00; --tt-y: #ffff00;
  --tt-b: #0000ff; --tt-m: #ff00ff; --tt-c: #00ffff; --tt-w: #ffffff;
  --remote: #2e2f34; --remote-hi: #3a3b41; --key: #4a4b52; --key-down: #38393f;
  --key-ink: #f1f1f3; --key-ink-dim: #a9aab2;
  --fk-r: #c8102e; --fk-g: #00843d; --fk-y: #f2c300; --fk-b: #0057b8;
  --f-tt: "Bedstead", ui-monospace, "Courier New", monospace;
  --f-label: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
}
html, body { height: 100%; margin: 0; }
body { background: var(--tt-k); color: var(--tt-w); overflow: hidden; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

#app {
  position: fixed; inset: 0; display: grid; background: var(--tt-k); overflow: hidden;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
#app.side { grid-template-columns: 1fr 250px; }
#app.stack { grid-template-rows: auto 1fr; }
#app.tv, #app.login-app { grid-template-columns: 1fr; }
#screen { position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#app.stack #screen { padding: 10px 8px 0; }
#app.side #screen { padding: 14px; }
#app.tv #screen, #app.login-app #screen { padding: 6px; }

/* Teletext-Seite */
#pagebox { position: relative; flex: none; }
#page { position: relative; transform-origin: left top; font-family: var(--f-tt); color: var(--tt-w);
  font-variant-ligatures: none; cursor: default; user-select: none; -webkit-user-select: none; visibility: hidden; }
#page.ready { visibility: visible; }
.row { position: relative; display: block; white-space: pre; height: var(--ch, 16px); line-height: var(--ch, 16px); }
.row span { display: inline-block; height: var(--ch, 16px); vertical-align: top; }
.row.lnk { cursor: pointer; }
.row.lnk:active, .row.lnk.hit { filter: invert(1); }
.row.lnk:focus-visible { outline: 2px solid var(--tt-c); outline-offset: -2px; }
.dh { transform: scaleY(2); transform-origin: left top; position: relative; z-index: 2; background: transparent !important; }
.fk { color: var(--tt-k); } .fr { color: var(--tt-r); } .fg { color: var(--tt-g); } .fy { color: var(--tt-y); }
.fb { color: var(--tt-b); } .fm { color: var(--tt-m); } .fc { color: var(--tt-c); } .fw { color: var(--tt-w); }
.br { background: var(--tt-r); } .bg { background: var(--tt-g); } .by { background: var(--tt-y); } .bb { background: var(--tt-b); }
.bm { background: var(--tt-m); } .bc { background: var(--tt-c); } .bw { background: var(--tt-w); }

/* Anmeldung: echte Formularfelder auf den Rasterzeilen 9, 12 und 14 */
#loginform { position: absolute; inset: 0; }

/* Hinweiszeile bei Verbindungsproblemen, liegt über Zeile 23 der aktuellen Seite */
.msg { position: absolute; left: 0; right: 0; top: calc(23 * var(--ch, 16px)); height: var(--ch, 16px);
  line-height: var(--ch, 16px); background: var(--tt-k); color: var(--tt-r); white-space: pre; z-index: 3; }
#loginform .in { position: absolute; box-sizing: border-box; border: 0; margin: 0; padding: 0 .2em; border-radius: 0;
  background: var(--tt-b); color: var(--tt-w); font-family: var(--f-tt); font-size: var(--ch, 16px); outline: none;
  caret-color: var(--tt-y); left: var(--adv, 10px); width: calc(24 * var(--adv, 10px)); height: var(--ch, 16px); }
#loginform .in:focus { background: var(--tt-w); color: var(--tt-k); }
#loginform .in-user { top: calc(9 * var(--ch, 16px)); }
#loginform .in-pass { top: calc(12 * var(--ch, 16px)); }
#loginform .btn-login { position: absolute; border: 0; margin: 0; padding: 0; background: transparent; cursor: pointer;
  left: var(--adv, 10px); top: calc(14 * var(--ch, 16px)); width: calc(12 * var(--adv, 10px)); height: var(--ch, 16px); }
#loginform .btn-login:focus-visible { outline: 2px solid var(--tt-y); }

/* Fernbedienung */
#remote { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 14px; }
#app.side #remote { padding: 16px 16px 16px 0; }
#app.stack #remote { padding: 12px 16px 14px; }
.rc { width: 100%; max-width: 300px; max-height: 100%; box-sizing: border-box; border-radius: 30px; padding: 18px 16px 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(180deg, var(--remote-hi), var(--remote) 30%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 24px rgba(0,0,0,.5); }
#app.side .rc { height: 100%; justify-content: center; }
#app.stack .rc { max-width: 420px; }
.ir { align-self: center; width: 10px; height: 6px; border-radius: 3px; background: #5a1a1a; box-shadow: inset 0 1px 1px rgba(255,255,255,.15); }
.brand { align-self: center; font-family: var(--f-label); font-stretch: condensed; font-weight: 600; font-size: 13px; letter-spacing: .14em; color: var(--key-ink-dim); }
.rc.tight .brand, .rc.tight .ir { display: none; }
.rc.tight { gap: 8px; padding: 12px 12px 10px; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.sub-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.key { font-family: var(--f-label); font-stretch: condensed; font-weight: 600; font-size: 22px; color: var(--key-ink);
  background: var(--key); border: 0; border-radius: 14px; min-height: 40px; height: var(--kh, 52px); cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.1);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.key small { display: block; font-size: 11px; font-weight: 500; color: var(--key-ink-dim); margin-top: -2px; }
.key:active, .key.down { background: var(--key-down); box-shadow: inset 0 2px 3px rgba(0,0,0,.35); transform: translateY(1px); }
.key:focus-visible { outline: 2px solid var(--tt-c); outline-offset: 2px; }
.key.small { font-size: 17px; }
.fast { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 2px; }
.fast div { display: flex; flex-direction: column; gap: 5px; }
.fast .key { height: 26px; min-height: 26px; border-radius: 13px; }
.fast .r { background: var(--fk-r); } .fast .g { background: var(--fk-g); } .fast .y { background: var(--fk-y); } .fast .b { background: var(--fk-b); }
.fast span { font-family: var(--f-label); font-stretch: condensed; font-size: 12px; font-weight: 500; color: var(--key-ink-dim); text-align: center; line-height: 1.1; }
#remotefab { display: none; }
#app.tv #remote { position: absolute; right: 0; top: 0; bottom: 0; width: 260px; background: rgba(0,0,0,.6); transform: translateX(105%); transition: transform .2s ease-out; }
#app.tv.rc-open #remote { transform: none; }
#app.tv #remotefab { display: block; position: absolute; z-index: 5; right: calc(10px + env(safe-area-inset-right, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  font-family: var(--f-label); font-weight: 600; font-size: 14px; color: var(--key-ink); background: var(--remote);
  border: 1px solid var(--key); border-radius: 18px; padding: 8px 14px; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { #app.tv #remote { transition: none; } }
