:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #5b6472;
  --line: #d9dee7;
  --surface: #ffffff;
  --soft: #f6f8fb;
  --accent: #0f8b6f;
  --accent-dark: #0a6c57;
  --yellow: #fff3bf;
  --yellow-line: #e0b72f;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
}

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

button.secondary {
  background: #eff3f6;
  color: var(--ink);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

a {
  color: var(--accent-dark);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 80px;
}

.top-logo {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 26px;
}

.search-row,
.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.result-area {
  margin-top: 30px;
}

.video-result {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 22px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.video-result img,
.thumbnail-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: var(--soft);
}

.thumbnail-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
}

.quality-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

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

.panel-shell,
.form-shell {
  width: min(1040px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.form-shell {
  width: min(680px, calc(100% - 28px));
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-section {
  margin-top: 22px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
  gap: 14px;
  align-items: end;
}

.stack-form {
  display: grid;
  gap: 16px;
}

.stack-form label,
.settings-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.note-yellow {
  border: 1px solid var(--yellow-line);
  border-radius: 8px;
  background: var(--yellow);
  padding: 14px;
  color: #3d3210;
}

.table-wrap {
  overflow-x: auto;
}

.text-muted {
  color: var(--muted);
}

.danger-text {
  color: var(--danger);
}

@media (max-width: 720px) {
  .site-shell {
    padding-top: 28px;
  }

  .search-row,
  .inline-form,
  .settings-grid,
  .video-result {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }
}
