:root {
  --bg: #0E0F13;
  --fg: #ECEDF2;
  --muted: #9A9CAB;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F6F6FA;
    --fg: #15161C;
    --muted: #5C5E6C;
  }
}
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
/* The canvas stays clear of the notch, the Dynamic Island, the rounded corners and the home
   indicator (viewport-fit=cover hands the whole screen to the page); the ground behind them is
   the theme's own colour, set on body. */
#app {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  right: env(safe-area-inset-right, 0px);
  bottom: env(safe-area-inset-bottom, 0px);
  left: env(safe-area-inset-left, 0px);
}
html, body {
  height: 100dvh;
}
body {
  -webkit-text-size-adjust: 100%;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
#app canvas {
  outline: none;
}
#splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 2;
  background: var(--bg);
  transition: opacity 200ms ease-out;
}
#splash.gone {
  opacity: 0;
  pointer-events: none;
}
#splash .name {
  margin: 12px 0 0;
  font-size: 20px;
  font-weight: 600;
}
#splash .note {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
#splash img {
  animation: tm-breathe 1.6s ease-in-out infinite;
}
@keyframes tm-breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.94); opacity: 0.8; }
}
@media (prefers-reduced-motion: reduce) {
  #splash img { animation: none; }
}

/* The player stand in, until web/player's own layer is wired in. */
#tm-player {
  position: fixed;
  inset: 0;
  z-index: 3;
  background: #000;
  display: flex;
  flex-direction: column;
}
#tm-player video {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #000;
}
#tm-player .bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: #fff;
  font-size: 14px;
  background: linear-gradient(#000c, #0000);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}
#tm-player .bar button {
  font: inherit;
  color: #fff;
  background: #ffffff1f;
  border: 1px solid #ffffff33;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
#tm-player .bar .title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#tm-player .status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 15px;
  text-align: center;
  pointer-events: none;
}

/* The video under the app's canvas while a video plays (web/player/video-host.js): the canvas
   over it draws the desktop app's own player controls and is clear everywhere else. */
#app {
  z-index: 1;
}
#tm-video {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #000;
}
html.tm-video-open, html.tm-video-open body {
  background: #000;
}
#tm-video video, #tm-video movi-player {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
#tm-video[data-shape="crop"] video {
  object-fit: cover;
}
#tm-video[data-shape="stretch"] video {
  object-fit: fill;
}
