:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  line-height: 1.5;
  background: #fff;
  color: #111;
  --accent: #ffeb3b;
  --focus: #005fcc;
  --surface: #f5f5f5;
  --border: #666;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input {
  font: inherit;
}

button,
summary,
input {
  min-height: 64px;
}

button,
summary {
  touch-action: manipulation;
}

button {
  border: 3px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 1rem;
  background: #fff;
  color: #111;
  cursor: pointer;
}

button:hover {
  background: #e5e5e5;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 5px solid var(--focus);
  outline-offset: 4px;
}

button[aria-pressed="true"],
button[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #000;
}

button:disabled {
  border-color: #aaa;
  color: #ddd;
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
  padding: 1rem;
  background: var(--accent);
  color: #000;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem max(1rem, calc((100vw - 1200px) / 2));
  border-bottom: 2px solid var(--border);
}

.brand {
  border-color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
}

.brand.youtube-brand {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  border-color: #fff;
}

.brand.youtube-brand::before {
  content: "▶";
  display: grid;
  width: 52px;
  height: 36px;
  place-items: center;
  border-radius: 9px;
  background: #c80000;
  color: #fff;
  font-size: 0.8rem;
}

.screen {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

#youtube-screen {
  width: 100%;
  padding: 0 0 10rem;
}

#youtube-screen #list-title,
#youtube-screen .results-status {
  margin-right: 1rem;
  margin-left: 1rem;
}

#youtube-screen .video-grid {
  column-gap: 0;
}

#youtube-screen .video-card > p,
#youtube-screen .video-card > h3 {
  margin-right: 0.6rem;
  margin-left: 0.6rem;
}

.section-label {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}

h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.15;
}

h2 {
  line-height: 1.2;
}

#launcher-screen {
  width: 100%;
  height: 100dvh;
  padding: 0;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  height: 100%;
}

.app-tile {
  min-height: 0;
  border: 3px solid #000;
  border-radius: 0;
  background: #555;
  color: #fff;
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 700;
  text-align: center;
}

.app-tile.youtube-tile {
  background: #c80000;
}

.app-tile.youtube-tile:hover {
  background: #a80000;
}

.app-tile:disabled {
  border-color: #000;
  background: #555;
  color: #fff;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  row-gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.section-nav,
.player-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.youtube-bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  flex-wrap: nowrap;
  margin: 0;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  border-top: 2px solid #555;
  background: #000;
}

.nav-button,
.action-button {
  flex: 1 1 220px;
}

.youtube-bottom-nav .nav-button {
  min-width: 0;
  padding: 0.7rem 0.4rem;
}

.results-status {
  font-weight: 700;
}

.results-status:empty {
  display: none;
}

#load-more-sentinel {
  height: 1px;
}

.video-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.2rem;
}

.video-card h3 {
  margin: 0;
  color: #555;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.15;
}

.video-card p {
  margin: 0;
  color: #767676;
  font-size: 0.7rem;
  line-height: 1.15;
}

.thumbnail-button {
  position: relative;
  width: 100%;
  min-height: 0;
  padding: 0;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

.video-grid {
  position: relative;
}

#youtube-screen.is-loading .video-grid {
  pointer-events: none;
}

#youtube-screen.is-loading .video-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgb(0 0 0 / 55%);
}

.thumbnail-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-duration {
  position: absolute;
  right: 0.4rem;
  bottom: 0.4rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: #000;
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.4;
}

#player-screen {
  width: 100%;
  padding: 0 0 3rem;
}

.watch-layout {
  display: flex;
  height: 100dvh;
  flex-direction: column;
}

#player-screen .player-actions {
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: #fff;
}

button.action-button.like-action {
  border-color: #00c853;
  background: #007f32;
  color: #fff;
}

button.action-button.like-action[aria-pressed="true"] {
  background: #00c853;
  color: #000;
}

button.action-button.dislike-action {
  border-color: #ff5252;
  background: #c80000;
  color: #fff;
}

button.action-button.dislike-action[aria-pressed="true"] {
  background: #ff5252;
  color: #000;
}

#player-screen .demo-note,
#player-screen .description-block,
#player-screen .future-feature {
  margin-right: 1rem;
  margin-left: 1rem;
}

.video-channel,
.demo-note {
  color: #666;
}

.player-container {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  margin-bottom: 0;
  background: var(--surface);
  overflow: hidden;
}

.player-container iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.description-block,
.future-feature {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.description-block summary {
  padding: 0.5rem;
  font-weight: 700;
  cursor: pointer;
}

.link-list {
  padding-left: 1.5rem;
}

.link-list a {
  display: inline-block;
  min-height: 64px;
  padding: 0.5rem 0;
  color: #005fcc;
  overflow-wrap: anywhere;
}

.visually-hidden {
  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-width: 600px) {
  :root {
    font-size: 20px;
  }

  .app-header > button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
