:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #18261f;
  background: #f2f5ed;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; }

.shell {
  max-width: 610px;
  margin: 0 auto;
  padding: max(26px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.heading {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 8px 0 23px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 14px;
  background: #d9f77e;
  display: grid;
  place-items: center;
}

.brand-mark i, .viewfinder i {
  position: relative;
  display: block;
  width: 20px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.brand-mark i::after, .viewfinder i::after {
  position: absolute;
  inset: 2px auto auto 5px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  width: 6px;
  height: 6px;
  content: "";
}

h1 {
  margin: 0;
  font-size: clamp(23px, 6vw, 32px);
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.heading p {
  margin: 4px 0 0;
  color: #516258;
  font-size: 14px;
}

.player {
  overflow: hidden;
  border-radius: 25px;
  border: 1px solid #dce4d9;
  background: #fcfdf9;
  box-shadow: 0 12px 35px #18261f0d;
}

.picture {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: #192821;
}

.picture-stage {
  position: absolute;
  inset: 0;
  --top: 0px;
  --right: 0px;
  --bottom: 0px;
  --left: 0px;
}

.picture-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body[data-expanded] { overflow: hidden; }

.picture[data-expanded] {
  position: fixed;
  inset: 0;
  z-index: 10;
  aspect-ratio: auto;
  background: #080b09;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px), var(--tg-content-safe-area-inset-right, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px), var(--tg-content-safe-area-inset-left, 0px));
}

.picture[data-expanded] .picture-stage {
  --top: var(--safe-top);
  --right: var(--safe-right);
  --bottom: var(--safe-bottom);
  --left: var(--safe-left);
}

@media (orientation: portrait) {
  .picture[data-expanded][data-landscape] .picture-stage {
    inset: 50% auto auto 50%;
    width: 100vh;
    height: 100vw;
    width: 100dvh;
    height: 100dvw;
    transform: translate(-50%, -50%) rotate(90deg);
    --top: var(--safe-right);
    --right: var(--safe-bottom);
    --bottom: var(--safe-left);
    --left: var(--safe-top);
  }
}

.actions { display: grid; gap: 8px; }
.sound { background: #edf1e8; }
.sound:hover:enabled { background: #e1eadc; }

.placeholder {
  position: absolute;
  display: grid;
  place-items: center;
  inset: 0;
  background:
    radial-gradient(ellipse at center, #3a59444d, #17281f 78%),
    repeating-linear-gradient(#a3c3a516 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, #a3c3a516 0 1px, transparent 1px 24px);
}

.viewfinder {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid #a4bfa75e;
  border-radius: 23px;
  background: #b6cfb212;
  color: #d5e2d1;
}

.viewfinder i { transform: scale(1.35); }

.status, .demo {
  position: absolute;
  top: calc(12px + var(--top));
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid #e9f2db3d;
  border-radius: 999px;
  background: #18261ff2;
  color: #f3f8ee;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.status { left: calc(12px + var(--left)); max-width: calc(100% - 100px - var(--left) - var(--right)); }
.demo { right: calc(12px + var(--right)); }

.status-dot {
  border-radius: 50%;
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  background: #a6b4a7;
}

.status[data-state="live"] .status-dot { background: #d9f77e; }
.status[data-state="waiting"] .status-dot { background: #f3ca80; }
.status[data-state="error"] .status-dot { background: #f5a397; }

.controls { padding: 17px; }

.controls p {
  margin: 0 0 14px;
  color: #43584c;
  font-size: 14px;
  line-height: 1.45;
  min-height: 2.9em;
  display: flex;
  align-items: center;
}

button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  width: 100%;
  min-height: 51px;
  padding: 11px;
  border: none;
  border-radius: 14px;
  background: #d9f77e;
  color: #1b2a21;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover:enabled { background: #ccea6e; }
button:active:enabled { background: #c1e15f; }
button:focus-visible { outline: 3px solid #2b6445; outline-offset: 3px; }
button:disabled { background: #e8eddf; color: #53645a; cursor: default; }
button[data-watching="true"] { background: #e6eee2; }

.view-actions {
  position: absolute;
  right: calc(10px + var(--right));
  bottom: calc(10px + var(--bottom));
  left: calc(10px + var(--left));
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.view-actions button {
  width: auto;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid #e9f2db52;
  border-radius: 12px;
  background: #18261ff0;
  color: #f3f8ee;
  font-size: 12px;
  line-height: 1.2;
}

.view-actions button:hover:enabled,
.view-actions button:active:enabled { background: #32483d; }
.view-actions button:focus-visible { outline-color: #d9f77e; }

.button-icon { display: inline-block; width: 12px; height: 12px; }
.button-icon[data-icon="play"] {
  width: 0;
  height: 0;
  border-block: 6px solid transparent;
  border-left: 9px solid currentColor;
}
.button-icon[data-icon="stop"] { border-radius: 3px; background: currentColor; }
.button-icon[data-icon="retry"] { display: none; }

.note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 0;
  color: #516258;
  font-size: 12px;
}

.note span {
  position: relative;
  width: 10px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 2px;
}
.note span::before {
  position: absolute;
  bottom: calc(100% + 1px);
  left: 1px;
  width: 4px;
  height: 4px;
  border: 1px solid currentColor;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  content: "";
}

@media (min-width: 650px) {
  .shell { padding-top: 54px; }
  .controls { padding: 20px; }
}
