/* M-02 MOBILE V2 — Phone-Frame, fusion_v2-Fluss, CRT nur als Ereignis */

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

:root {
  --bg: #050505;
  --chrome: #c8c4bc;
  --muted: rgba(200, 196, 188, 0.38);
  --bezel: #121212;
  --bezel-hi: #1c1c1c;
  --screen: #080808;
  --accent: #c8c4bc;
  --ease-move: cubic-bezier(0.25, 0.85, 0.3, 1);
  --phone-w: 390px;
  --phone-h: 844px;
  --radius: 44px;
  --t-11: 11px;
  --t-13: 13px;
  --t-15: 15px;
  --t-18: 18px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--chrome);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, #0c0c0c 0%, var(--bg) 72%),
    var(--bg);
}

.lab-chrome {
  position: fixed;
  top: 18px;
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  z-index: 10;
  pointer-events: none;
  font-size: var(--t-11);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.lab-mark {
  color: var(--chrome);
  letter-spacing: 0.18em;
  font-weight: 500;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 16px 48px;
}

.phone {
  width: var(--phone-w);
  height: var(--phone-h);
  max-height: calc(100dvh - 110px);
  aspect-ratio: 390 / 844;
  flex-shrink: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.phone-bezel {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 12px;
  background:
    linear-gradient(160deg, var(--bezel-hi) 0%, var(--bezel) 40%, #0a0a0a 100%);
  border-radius: var(--radius);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 -1px 0 rgba(0, 0, 0, 0.55) inset,
    0 28px 80px rgba(0, 0, 0, 0.72),
    0 8px 24px rgba(0, 0, 0, 0.45);
}

.phone-notch {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 26px;
  background: #050505;
  border-radius: 20px;
  z-index: 6;
  pointer-events: none;
}

.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius) - 8px);
  overflow: hidden;
  background: var(--screen);
  isolation: isolate;
}

.phone-home {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 108px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  z-index: 6;
  pointer-events: none;
}

/* —— Power / Boot —— */
.power-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: #010101;
}

.power-layer[hidden] {
  display: none;
}

.power-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.boot-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22%;
  z-index: 2;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(200, 196, 188, 0.42);
  pointer-events: none;
  animation: boot-pulse 5.5s steps(8, end) infinite;
}

.boot-hint[hidden] {
  display: none;
}

@keyframes boot-pulse {
  0%, 72% { opacity: 0.42; }
  86% { opacity: 0.18; }
  100% { opacity: 0.42; }
}

body[data-phase="power"] .boot-hint {
  display: none;
}

/* —— Room UI —— */
.room-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.room-ui[hidden] {
  display: none;
}

.channel-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 0 8px;
  padding: 48px 14px 0;
  background: linear-gradient(180deg, rgba(8, 8, 8, 0.92) 0%, rgba(8, 8, 8, 0.55) 70%, transparent 100%);
  pointer-events: none;
}

.channel-btn,
.tt-btn {
  pointer-events: auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(200, 196, 188, 0.32);
  font-family: var(--mono);
  font-size: var(--t-11);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 10px 0 14px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 70ms steps(2, end), border-color 70ms steps(2, end);
}

.tt-btn {
  padding: 10px 8px 14px;
  min-width: 44px;
  border-bottom-color: rgba(200, 196, 188, 0.12);
}

.channel-btn:active,
.tt-btn:active {
  transform: scale(0.98);
}

.channel-btn.is-active,
.tt-btn[aria-pressed="true"] {
  color: var(--chrome);
  border-bottom-color: rgba(200, 196, 188, 0.55);
}

.channel-btn:focus-visible,
.tt-btn:focus-visible {
  outline: 1px solid rgba(200, 196, 188, 0.55);
  outline-offset: 2px;
}

.viewport {
  position: absolute;
  inset: 0;
  cursor: grab;
}

.viewport.is-dragging {
  cursor: grabbing;
}

body[data-phase="open"] .viewport {
  pointer-events: none;
}

.ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  transition: background 650ms var(--ease-move);
  z-index: 0;
}

.cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform, opacity;
  z-index: 1;
}

.glitch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
  mix-blend-mode: screen;
}

.glitch.is-active {
  opacity: 1;
}

.osd {
  position: absolute;
  top: 96px;
  right: 18px;
  z-index: 4;
  font-family: var(--mono);
  font-size: var(--t-13);
  letter-spacing: 0.12em;
  color: rgba(230, 230, 230, 0.9);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 70ms steps(2, end);
}

.osd:not([hidden]) {
  opacity: 1;
}

.osd[hidden] {
  display: none;
}

.work-chrome {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 48px 20px 52px;
  background: linear-gradient(0deg, rgba(8, 8, 8, 0.88) 0%, rgba(8, 8, 8, 0.35) 55%, transparent 100%);
  pointer-events: none;
}

.work-ch {
  font-family: var(--mono);
  font-size: var(--t-11);
  letter-spacing: 0.14em;
  color: rgba(200, 196, 188, 0.45);
}

.work-title {
  font-size: var(--t-15);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--chrome);
  line-height: 1.2;
}

.gesture-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 88px;
  z-index: 3;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(200, 196, 188, 0.28);
  pointer-events: none;
  transition: opacity 180ms steps(2, end);
}

.gesture-hint.is-gone {
  opacity: 0;
}

.epg {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px 28px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(200, 196, 188, 0.55);
  background: linear-gradient(0deg, rgba(8, 8, 8, 0.92) 0%, transparent 100%);
  pointer-events: none;
}

.epg[hidden] {
  display: none;
}

.epg-sep {
  opacity: 0.35;
}

/* —— Teletext —— */
.teletext {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 12px 48px;
  pointer-events: auto;
  background: rgba(4, 4, 4, 0.35);
}

.teletext[hidden] {
  display: none;
}

.tt-inner {
  width: 100%;
  max-height: 72%;
  aspect-ratio: 4 / 3;
  background: rgba(18, 14, 10, 0.82);
  border: 1px solid rgba(232, 220, 195, 0.18);
  color: #e8dcc3;
  font-family: var(--mono);
  display: flex;
  flex-direction: column;
  padding: 0.7rem 0.85rem 0.55rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}

.tt-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: #d9a44a;
  border-bottom: 1px solid rgba(232, 220, 195, 0.16);
  padding-bottom: 0.4rem;
  margin-bottom: 0.55rem;
}

.tt-body {
  flex: 1;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  white-space: pre-wrap;
  color: #e8dcc3;
  overflow: hidden;
}

.tt-foot {
  margin-top: 0.45rem;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a7f6d;
}

/* —— Open —— */
.open-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  background: #060606;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 650ms var(--ease-move),
    transform 650ms var(--ease-move),
    visibility 0s linear 650ms;
}

.open-layer[hidden] {
  display: none;
}

.open-layer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition:
    opacity 650ms var(--ease-move),
    transform 650ms var(--ease-move),
    visibility 0s linear 0s;
}

.open-layer.is-closing {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 500ms var(--ease-move),
    transform 500ms var(--ease-move),
    visibility 0s linear 500ms;
}

.open-media {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 14px 8px;
}

.open-cover {
  width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  background: #111;
}

.open-meta {
  flex: 0 0 auto;
  padding: 16px 20px 40px;
}

.open-title {
  font-size: var(--t-18);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: var(--chrome);
  margin-bottom: 8px;
}

.open-strip {
  font-family: var(--mono);
  font-size: var(--t-11);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.open-dismiss {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(200, 196, 188, 0.32);
}

.stage-hint {
  position: fixed;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  pointer-events: none;
  z-index: 10;
}

.sr-works {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-height: 900px) {
  .phone {
    height: calc(100dvh - 110px);
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .channel-btn,
  .tt-btn,
  .osd,
  .gesture-hint,
  .open-layer,
  .open-layer.is-open,
  .open-layer.is-closing,
  .cover,
  .ambient,
  .boot-hint {
    transition: none !important;
    animation: none !important;
  }

  .open-layer,
  .open-layer.is-open,
  .open-layer.is-closing {
    transform: none;
  }
}
