:root {
  color-scheme: light;
  --ink: #24170d;
  --muted: #7d6143;
  --line: #d7ad68;
  --panel: #fff7e6;
  --paper: #f3c66d;
  --accent: #d99b2b;
  --accent-strong: #a85e1f;
  --gold: #f0bc43;
  --turquoise: #0f7f85;
  --night: #14112d;
  --danger: #a13d2d;
  --ok: #0f5f5f;
  --shadow: 0 18px 44px rgba(55, 29, 8, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(239, 177, 77, 0.88) 0 21%, rgba(189, 103, 37, 0.72) 22% 31%, transparent 32%),
    linear-gradient(180deg, #14112d 0%, #2f2857 34%, #c47433 64%, #eab85d 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255, 231, 174, 0.1), rgba(79, 38, 17, 0.1)),
    transparent;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
}

.panel,
.creator-card,
.metrics article,
.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.controls {
  position: sticky;
  top: 20px;
  align-self: start;
  padding: 18px;
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #1d1308;
  background: linear-gradient(180deg, #ffe08a, var(--gold));
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.08rem;
}

.brand-block p,
.toolbar p,
.note,
.metrics span,
.field span,
.channel-link,
.video-meta {
  color: var(--muted);
}

.brand-block p,
.toolbar p,
.note {
  font-size: 0.9rem;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
}

.field span,
.keywords summary {
  font-size: 0.82rem;
  font-weight: 700;
}

.help-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--turquoise);
  color: #fff7e6;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  cursor: help;
}

.help-icon::after {
  content: attr(data-help);
  position: absolute;
  z-index: 20;
  left: 50%;
  bottom: calc(100% + 7px);
  width: min(280px, 82vw);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #24170d;
  color: #fff7e6;
  padding: 9px 10px;
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 5px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.help-icon:hover::after,
.help-icon:focus::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.field-hint {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf0;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

input[type="checkbox"] {
  width: auto;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--turquoise);
  box-shadow: 0 0 0 3px rgba(15, 127, 133, 0.2);
}

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

.checkbox-field {
  align-content: center;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 63px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf0;
  padding: 10px 11px;
}

.checkbox-field input {
  margin: 0;
  accent-color: var(--accent);
}

.keywords {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.keywords summary {
  cursor: pointer;
  margin-bottom: 10px;
}

.keyword-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.keyword-actions button,
.file-import {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.file-import input {
  display: none;
}

#gameKeywordCount {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.platforms {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  padding-bottom: 14px;
}

.platforms h2 {
  font-size: 0.86rem;
  text-transform: uppercase;
  color: var(--muted);
}

.platform-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  overflow: hidden;
}

.platform-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.platform-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px;
  cursor: pointer;
  padding: 11px 12px;
}

.platform-head span {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 900;
}

.platform-head strong {
  color: var(--muted);
  font-size: 0.78rem;
}

.platform-head::after {
  content: "Off";
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.platform-toggle:checked + .platform-head {
  background: #f8dd9c;
}

.platform-toggle:checked + .platform-head::after {
  content: "On";
  color: var(--ink);
  background: var(--gold);
  border-color: var(--gold);
}

.platform-body {
  display: none;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.platform-toggle:checked ~ .platform-body {
  display: block;
}

.platform-source-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 10px;
}

.platform-source-actions button,
.platform-source-actions a {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.platform-results {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.platform-result {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf0;
  padding: 9px;
}

.platform-result strong,
.platform-result span {
  display: block;
}

.platform-result strong {
  font-size: 0.9rem;
}

.platform-result span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.platform-result .platform-stat-row {
  color: var(--ink);
  font-weight: 800;
}

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

#exportBtn,
#clearBtn {
  grid-column: 1 / -1;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf0;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  border-color: var(--turquoise);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.primary {
  color: #1d1308;
  background: linear-gradient(180deg, #f4c75e, var(--accent));
  border-color: var(--accent);
}

.primary:hover {
  background: linear-gradient(180deg, #e2a93a, var(--accent-strong));
  color: #fff7e6;
}

.note {
  margin-top: 13px;
  line-height: 1.45;
}

.results {
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 6px 0 18px;
}

h2 {
  font-size: 1.45rem;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.status-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  border: 0;
}

.status-filters label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf0;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}

.status-filters input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf0;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.summary strong {
  color: var(--ink);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metrics article {
  padding: 14px;
}

.metrics span,
.metrics strong {
  display: block;
}

.metrics strong {
  margin-top: 5px;
  font-size: 1rem;
}

.empty-state {
  padding: 32px;
  text-align: center;
}

.run-window {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 247, 230, 0.95);
  margin-bottom: 14px;
  padding: 14px;
}

.run-window header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.run-window h3 {
  font-size: 0.98rem;
}

.run-window header span {
  border-radius: 999px;
  background: #f5dea4;
  color: var(--ink);
  padding: 5px 8px;
  font-size: 0.78rem;
  font-weight: 900;
}

.run-window header span.running {
  background: var(--gold);
}

.run-window header span.failed {
  background: #f0b3a4;
}

.run-window header span.complete {
  background: #aad4d1;
}

.run-window p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.run-window dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}

.run-window dl div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf0;
  padding: 8px;
}

.run-window dt,
.run-window dd {
  margin: 0;
}

.run-window dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.run-window dd {
  margin-top: 4px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

.empty-state p {
  max-width: 620px;
  margin: 8px auto 0;
  color: var(--muted);
  line-height: 1.5;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.pagination span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.pagination button {
  min-height: 36px;
  padding: 0 12px;
}

.cards {
  display: grid;
  gap: 12px;
}

.creator-card {
  padding: 16px;
}

.creator-card header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.creator-main {
  display: flex;
  min-width: 0;
  gap: 12px;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: #efe2bd;
}

.creator-card h3 {
  font-size: 1.08rem;
}

.channel-link {
  display: inline-block;
  margin-top: 3px;
  font-size: 0.88rem;
  word-break: break-word;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.8rem;
  font-weight: 800;
}

.badge.pass {
  color: #fdf5df;
  background: var(--turquoise);
}

.badge.fail {
  color: #3a1e10;
  background: #f0c46d;
}

.score-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.score-pill {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  min-height: 72px;
  background: #fffaf0;
}

.score-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.score-pill strong {
  display: block;
  margin-top: 5px;
  font-size: 1rem;
}

.score-pill.ok {
  border-color: rgba(15, 127, 133, 0.55);
}

.score-pill.miss {
  border-color: rgba(161, 61, 45, 0.42);
}

.evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.tag {
  border-radius: 999px;
  background: #f5dea4;
  color: #3b2411;
  padding: 6px 9px;
  font-size: 0.8rem;
}

details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

details summary {
  cursor: pointer;
  color: var(--turquoise);
  font-weight: 800;
}

.video-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.video-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fffaf0;
}

.video-row a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.video-row a:hover {
  color: var(--turquoise);
}

.video-meta {
  font-size: 0.82rem;
  margin-top: 4px;
}

.video-games {
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: right;
}

@media (max-width: 980px) {
  .shell {
    padding: 12px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .controls {
    position: static;
  }
}

@media (max-width: 680px) {
  .toolbar,
  .creator-card header {
    align-items: stretch;
    flex-direction: column;
  }

  .title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .summary {
    justify-content: flex-start;
  }

  .pagination {
    justify-content: stretch;
  }

  .pagination button,
  .pagination span {
    flex: 1;
    text-align: center;
  }

  .metrics,
  .run-window dl,
  .score-row,
  .control-grid,
  .actions {
    grid-template-columns: 1fr;
  }

  .video-row {
    grid-template-columns: 1fr;
  }

  .video-games {
    text-align: left;
  }
}
