#watchDialog {
  --watch-line: #ffffff20;
  --watch-muted: #b1bcb3;
  --watch-accent: var(--leaf, #b8e99b);
  width: min(1540px, calc(100% - 40px));
  max-width: none;
  max-height: 94vh;
  max-height: 94dvh;
  padding: 0;
  color: #f3f6ef;
  background: #111813;
  border: 1px solid var(--watch-line);
  border-radius: 18px;
  box-shadow: 0 32px 100px #0009;
  overflow: auto;
  overscroll-behavior: contain;
}
#watchDialog[open] { animation: watch-enter 220ms ease-out both; }
#watchDialog::backdrop { background: #030805df; backdrop-filter: blur(7px); }
html:has(#watchDialog[open]) { overflow: hidden; }
.watch-symbols { position: absolute; width: 0; height: 0; pointer-events: none; }
#watchLinkStatus { margin: 0 0 16px; padding: 12px 15px; border-left: 3px solid var(--leaf); background: var(--panel); color: var(--cream); }
#watchDialog button { font-family: inherit; }
#watchDialog button:focus-visible, #watchDialog input:focus-visible, #playerShell:focus-visible {
  outline: 2px solid var(--watch-accent);
  outline-offset: 2px;
}
#watchDialog svg:not(.watch-symbols) {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.watch-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  border-bottom: 1px solid var(--watch-line);
}
.watch-back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 3px 10px;
  margin-left: -8px;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.watch-back:hover { background: #ffffff0d; }
.watch-brand { font: 800 13px/1 "DM Sans", sans-serif; letter-spacing: .04em; color: #aabdac; }
#watchDialog .watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(245px, 25vw, 350px);
  gap: clamp(18px, 2vw, 32px);
  padding: 22px 24px 26px;
}
#watchDialog .player-shell { background: #060806; border-radius: 12px; max-height: 72vh; max-height: 72dvh; }
#watchDialog .player-shell video { max-height: none; border-radius: 0; background: #060806; }
#watchDialog .player-shell:fullscreen { max-height: none; border-radius: 0; }
#watchDialog .center-play {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0 0 0 3px;
  background: #101a13de;
  border: 1px solid #ffffff5c;
  color: white;
  backdrop-filter: blur(8px);
}
#watchDialog .center-play svg { width: 29px; height: 29px; }
#watchDialog .center-play.is-hidden, #playerShell.is-waiting .center-play,
#playerShell.has-error .center-play, #playerShell.has-error .player-controls { visibility: hidden; }
.watch-spinner {
  display: none;
  position: absolute;
  top: calc(50% - 19px);
  left: calc(50% - 19px);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid #ffffff45;
  border-top-color: var(--watch-accent);
  pointer-events: none;
}
.is-waiting .watch-spinner { display: block; animation: watch-turn 800ms linear infinite; }
.watch-player-error { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; padding: 12px 20px; text-align: center; }
.watch-player-error[hidden] { display: none; }
#watchDialog .watch-player-error p { color: #e4ebe5; font-size: 14px; }
.watch-player-error button { min-height: 38px; margin-top: 14px; background: #233126; color: #fff; border: 1px solid #687b68; border-radius: 100px; padding: 0 16px; cursor: pointer; }
#watchDialog .player-controls { padding: 35px 14px 8px; background: linear-gradient(transparent, #000c); opacity: 1; }
#watchDialog .player-shell.controls-idle:not(.is-paused):not(:has(.player-controls :focus-visible)) .player-controls { opacity: 0; pointer-events: none; }
#watchDialog .player-shell.controls-idle:not(.is-paused) video { cursor: none; }
#watchDialog .seek-bar, #watchDialog .volume-bar {
  --watch-fill: 0%;
  appearance: none;
  display: block;
  margin: 0;
  height: 18px;
  background: linear-gradient(to right, var(--watch-accent) var(--watch-fill), #ffffff62 var(--watch-fill)) left center / 100% 3px no-repeat;
  cursor: pointer;
}
#watchDialog .seek-bar { width: 100%; }
#watchDialog .volume-bar { width: 64px; --watch-fill: 100%; }
#watchDialog input[type=range]::-moz-range-thumb { width: 11px; height: 11px; border: none; background: var(--watch-accent); }
#watchDialog input[type=range]::-webkit-slider-thumb { width: 11px; height: 11px; background: var(--watch-accent); box-shadow: none; }
#watchDialog .control-row { gap: 4px; margin: 0; }
#watchDialog .control-button { width: 38px; height: 38px; background: none; color: #fff; border-radius: 8px; }
#watchDialog .control-button:hover { background: #ffffff22; }
#watchDialog .control-button:disabled { opacity: .35; cursor: default; }
#watchDialog .speed-button { min-width: 44px; font-size: 13px; font-weight: 700; }
.watch-time { margin-left: 8px; color: #fafbf8; font: 600 12px/1.5 "DM Sans", sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
#watchDialog h2 { margin: 17px 0 5px; color: #f3f8f1; font-size: clamp(19px, 1.65vw, 27px); line-height: 1.45; overflow-wrap: anywhere; }
#watchDialog #watchMeta, #watchDialog #watchNotice { color: var(--watch-muted); font-size: 12px; line-height: 1.65; }
#watchDialog .watch-actions { gap: 12px; flex-wrap: wrap; margin-top: 12px; padding-top: 15px; border-color: var(--watch-line); }
#watchDialog .watch-channel { flex: 0 1 auto; min-width: 0; max-width: 100%; }
#watchDialog .watch-avatar { background-color: #2b4231; width: 42px; height: 42px; border: 1px solid #ffffff20; }
.watch-channel-name { min-width: 0; }
#watchDialog .watch-channel-name b { font-size: 14px; max-width: 240px; }
#watchDialog .watch-channel-name small { color: var(--watch-muted); font-size: 11px; }
.watch-tools { display: flex; gap: 7px; flex-wrap: wrap; }
#watchDialog .watch-pill, #watchDialog .follow-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--watch-line);
  border-radius: 100px;
  background: #233027;
  color: #f1f7f0;
  cursor: pointer;
  transition: background 150ms, transform 150ms;
}
#watchDialog .watch-pill svg { width: 16px; height: 16px; }
#watchDialog .follow-button { background: var(--watch-accent); color: #142219; border-color: transparent; }
#watchDialog .follow-button.is-following, #watchDialog .watch-pill[aria-pressed="true"] { background: #304b36; color: #d5f4c6; border-color: #45774b; }
#watchDialog .watch-pill[aria-pressed="true"] svg { fill: #d5f4c640; }
#watchDialog .watch-pill:hover:enabled { background: #344639; }
#watchDialog .watch-pill:active:enabled, #watchDialog .follow-button:active:enabled { transform: scale(.97); }
#watchDialog .follow-button:disabled, #watchDialog .watch-pill:disabled { opacity: .58; cursor: default; }
#watchDialog #watchNotice:not(:empty) { margin-top: 12px; }
#watchDialog #watchLink { margin-top: 8px; }
#watchDialog .watch-recommendations { padding: 0; }
#watchDialog .watch-recommendations h3 { margin: 0 0 15px; font-size: 17px; line-height: 1.4; }
#watchRecommendations { display: grid; gap: 10px; }
#watchDialog .recommendation {
  grid-template-columns: 40% minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 3px;
  color: inherit;
  border-radius: 10px;
  transition: background 160ms;
}
#watchDialog .recommendation:hover { background: #ffffff09; }
#watchDialog .recommendation-thumb { position: relative; overflow: hidden; background: linear-gradient(125deg, #344640, #1c2520 75%); }
#watchDialog .recommendation:nth-child(3n+2) .recommendation-thumb { background: linear-gradient(125deg, #52473c, #27251e 75%); }
#watchDialog .recommendation:nth-child(3n) .recommendation-thumb { background: linear-gradient(125deg, #394458, #1f262e 75%); }
#watchDialog .recommendation-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 200ms ease; }
#watchDialog .recommendation:hover img { transform: scale(1.04); }
.recommendation-time { position: absolute; right: 4px; bottom: 4px; background: #000b; color: #fff; font: 600 10px/1 "DM Sans", sans-serif; border-radius: 4px; padding: 3px 4px; }
#watchDialog .recommendation b { overflow-wrap: anywhere; font-size: 13px; }
#watchDialog .recommendation small { color: var(--watch-muted); font-size: 11px; overflow-wrap: anywhere; }
@keyframes watch-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes watch-turn { to { transform: rotate(360deg); } }
@media (max-width: 900px) {
  #watchDialog .watch-layout { grid-template-columns: minmax(0, 1fr); gap: 23px; padding: 16px; }
  #watchDialog .watch-recommendations { border-top: 1px solid var(--watch-line); padding-top: 16px; }
  #watchRecommendations { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  #watchDialog { margin: 0; width: 100%; height: 100%; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
  .watch-topline { padding: 5px 15px; }
  #watchDialog .watch-layout { padding: 0 13px max(16px, env(safe-area-inset-bottom)); }
  #watchDialog .player-shell { margin: 0 -13px; border-radius: 0; }
  #watchDialog .player-controls { padding: 15px 8px 2px; }
  #watchDialog .control-row { gap: 1px; }
  #watchDialog .volume-bar { width: 40px; }
  #watchDialog .watch-channel { width: 100%; flex-basis: 100%; }
  #watchDialog .follow-button { margin-left: auto; }
  #watchDialog .control-button { width: 33px; height: 34px; }
  #watchDialog .center-play { width: 52px; height: 52px; }
  #watchDialog .watch-recommendations > div { grid-template-columns: 1fr; }
  #watchDialog .recommendation { grid-template-columns: minmax(100px, 36%) minmax(0, 1fr); }
}
@media (max-width: 385px) { #watchDialog .volume-bar { display: none; } }
@media (prefers-reduced-motion: reduce) {
  #watchDialog[open], #watchDialog .watch-spinner { animation: none; }
  #watchDialog *, #watchDialog *::before, #watchDialog *::after { transition: none !important; }
}
