:root {
  color-scheme: light;
  --navy: #182d38;
  --ink: #1a2930;
  --muted: #4c626b;
  --paper: #f5f8f7;
  --line: #c9d7d7;
  --aqua: #a6e7dc;
  --strong: #146b62;
  font: 16px/1.5 system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
body:has(dialog[open]) { overflow: hidden; }
button, input, .button { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .45rem .85rem; border: 1px solid transparent; border-radius: .55rem;
  color: inherit; background: transparent; text-decoration: none; font-weight: 650; cursor: pointer;
}
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #228678; outline-offset: 4px; }
.quiet { border-color: var(--line); }
.quiet:hover:not(:disabled) { background: #e3eeeb; }
.primary { color: white; background: var(--strong); }
.primary:hover:not(:disabled) { background: #105950; }
.shell { width: min(100%, 62rem); padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right)); margin-inline: auto; }
.masthead { background: var(--navy); color: white; padding-top: env(safe-area-inset-top); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; min-height: 4.5rem; }
.masthead .quiet:hover { background: #2f4550; }
.wordmark { display: inline-flex; align-items: center; gap: .7rem; font-size: 1.35rem; font-weight: 750; letter-spacing: -.045em; }
.mark { width: 1.45rem; height: 1.45rem; background: var(--aqua); clip-path: polygon(0 7%, 57% 7%, 57% 20%, 100% 50%, 57% 80%, 57% 93%, 0 93%, 0 75%, 53% 75%, 53% 59%, 0 59%, 0 41%, 53% 41%, 53% 25%, 0 25%); }
main { padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
#welcome { padding-block: clamp(2.7rem, 9vw, 6rem); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 5vw, 2.45rem); line-height: 1.13; letter-spacing: -.05em; }
h2 { font-size: clamp(1.2rem, 4vw, 1.65rem); line-height: 1.25; }
.muted { color: var(--muted); }
#welcome-message { margin-block: .65rem 1.1rem; }
.tabs { display: flex; gap: .5rem; margin-block: .8rem clamp(1.35rem, 4vw, 2.4rem); border-bottom: 1px solid var(--line); }
.tabs button { border-radius: .4rem .4rem 0 0; border-bottom: 3px solid transparent; }
.tabs [aria-pressed="true"] { color: var(--strong); border-bottom-color: var(--strong); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
#feed-status, #search-status { margin-block: .5rem 1rem; }
#feed-status:empty, #search-status:empty { margin-block: .9rem; }
.video-list { padding: 0; margin: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 1rem; row-gap: 1.15rem; }
.video { width: 100%; display: grid; text-align: left; justify-content: stretch; gap: .5rem; padding: 0 0 .75rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.video:hover .video-title { text-decoration: underline; color: var(--strong); }
.thumbnail { display: block; aspect-ratio: 16 / 9; width: 100%; object-fit: cover; background: #dce9e8; border-radius: .55rem; }
.video-title { display: block; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.metadata { display: block; color: var(--muted); font-size: .85rem; font-weight: 500; margin-top: .25rem; }
.more { margin-block: 1.1rem; }
.search-form { display: flex; gap: .5rem; margin-block: .9rem; max-width: 37rem; }
.search-form input { min-width: 0; flex: 1; min-height: 44px; border: 1px solid var(--line); border-radius: .55rem; padding: .5rem .65rem; background: white; color: var(--ink); }
dialog { border: 0; }
#watch {
  width: min(calc(100% - 1.5rem), 54rem); max-height: 90dvh; padding: 0; border-radius: .85rem;
  color: var(--ink); background: var(--paper); box-shadow: 0 15px 45px #142a3870;
}
#watch::backdrop { background: #132630b8; }
.watch-bar { padding: .65rem; }
#player { width: 100%; background: #101c21; }
#player iframe { display: block; border: 0; width: 100%; aspect-ratio: 16 / 9; min-height: 200px; }
.watch-details { padding: .8rem .85rem 1.1rem; }
.watch-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-block: .8rem .5rem; }
#pocket-status { font-size: .875rem; }
#pocket {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; color: white; background: #000; touch-action: none; overscroll-behavior: none; user-select: none;
}
#pocket::backdrop { background: black; }
.pocket-off { position: absolute; inset: auto auto 1rem 1rem; opacity: 0; pointer-events: none; }
.pocket-off:focus-visible { opacity: 1; }
#wake-status { position: absolute; inset: auto 1rem max(1.25rem, env(safe-area-inset-bottom)); text-align: center; color: #ffd58b; }
@media (max-width: 740px) {
  .video-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .video-list { grid-template-columns: minmax(0, 1fr); row-gap: .65rem; }
  .video { grid-template-columns: minmax(6rem, 38%) minmax(0, 1fr); align-items: start; gap: .65rem; }
}
