:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --text: #171512;
  --muted: #6f675f;
  --line: #ded7ce;
  --panel: #fffaf2;
  --accent: #c73422;
  --accent-dark: #9f2719;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 48px;
}

.topbar strong {
  font-size: 22px;
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.intro {
  max-width: 780px;
}

.eyebrow,
.label {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(44px, 7vw, 84px);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead {
  max-width: 650px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.6;
}

.search {
  margin-top: 34px;
}

.search label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

.search-row {
  display: flex;
  gap: 10px;
}

input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 17px;
  padding: 15px 16px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(199, 52, 34, 0.16);
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  padding: 0 24px;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.secondary-button,
.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: rgba(199, 52, 34, 0.55);
  background: #fff7ed;
}

.ghost-button {
  min-height: 38px;
  padding: 0 14px;
}

.small-button {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
}

.link-button {
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  padding: 0;
}

.link-button:hover {
  background: transparent;
  color: var(--accent-dark);
}

.auth-panel,
.app-panel {
  margin-top: 34px;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.7fr);
  gap: 28px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 30px;
}

.auth-panel h2,
.subscriptions-head h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.auth-panel p,
.subscriptions-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-actions button {
  min-height: 50px;
  padding: 0 14px;
}

.auth-status {
  min-height: 22px;
  margin: 0;
  color: var(--accent);
}

.tabs {
  display: inline-flex;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

.tab {
  min-height: 40px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 18px;
}

.tab:hover,
.tab.active {
  background: var(--accent);
  color: #fff;
}

.tab-panel {
  margin-top: 28px;
}

.player-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.7fr);
  gap: 24px;
  align-items: start;
  margin-top: 38px;
}

.player-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #111;
}

iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.now-playing {
  border-left: 3px solid var(--accent);
  padding-left: 18px;
}

.now-playing h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
}

.now-playing p:last-child {
  margin: 0;
  color: var(--muted);
}

.results-section {
  margin-top: 36px;
}

.status {
  min-height: 24px;
  color: var(--muted);
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.video-card,
.channel-card {
  display: flex;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
}

.video-card {
  flex-direction: column;
}

.video-open {
  display: flex;
  width: 100%;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.video-card:hover,
.channel-card:hover {
  border-color: rgba(199, 52, 34, 0.55);
  background: #fff;
}

.video-open:hover {
  background: transparent;
}

.video-card img,
.channel-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #ddd;
}

.video-copy {
  padding: 13px;
}

.video-copy h3 {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 9px;
  font-size: 16px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.video-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.video-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding: 10px;
}

.subscriptions-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.subscriptions-head button {
  min-height: 42px;
}

.channels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.channel-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.channel-card img {
  width: 58px;
  height: 58px;
  aspect-ratio: 1;
  border-radius: 50%;
}

.channel-card h3 {
  overflow: hidden;
  margin: 0 0 6px;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-card .small-button {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 1120px);
    padding: 28px 0;
  }

  h1 {
    font-size: 46px;
  }

  .lead {
    font-size: 17px;
  }

  .topbar,
  .account,
  .subscriptions-head {
    align-items: stretch;
    flex-direction: column;
  }

  .search-row,
  .player-panel,
  .auth-panel,
  .auth-actions {
    grid-template-columns: 1fr;
  }

  .search-row {
    flex-direction: column;
  }

  button,
  .ghost-button {
    min-height: 50px;
  }
}
