:root {
  color-scheme: dark;
  --bg: #101310;
  --surface: #171a17;
  --surface-2: #20251f;
  --surface-3: #2b302b;
  --text: #f2f4ef;
  --muted: #aeb6aa;
  --border: #3d453b;
  --accent: #9fb86f;
  --accent-2: #d2b45b;
  --danger: #d77b69;
  --good: #a6c983;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(159, 184, 111, 0.14), transparent 320px),
    radial-gradient(circle at 82% 8%, rgba(210, 180, 91, 0.09), transparent 230px),
    var(--bg);
  color: var(--text);
}

button,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--border);
  background: rgba(16, 19, 16, 0.88);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f5f3ed;
}

.brand-text {
  display: grid;
  gap: 2px;
}

.brand-text strong {
  font-size: 1.08rem;
}

.brand-text span,
.footer,
.mode-pill,
label,
.field-help {
  color: var(--muted);
}

.mode-pill,
.version {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

main {
  width: min(1040px, calc(100% - 32px));
  margin: 26px auto;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.entry-shell,
.report-shell,
.wait-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.entry-shell,
.report-shell {
  padding: clamp(18px, 2.4vw, 30px);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.1rem, 5vw, 4.7rem);
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3.4rem);
}

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

label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 780;
}

select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 11px;
  background: var(--surface-2);
  color: var(--text);
}

select:disabled {
  opacity: 0.58;
}

.blank-state {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.blank-state span {
  color: var(--muted);
}

.event-list {
  display: grid;
  gap: 12px;
}

.event-card {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(160px, 0.9fr) minmax(150px, 0.7fr) minmax(118px, 0.52fr);
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.event-name {
  display: grid;
  gap: 5px;
  align-self: center;
}

.event-name strong {
  font-size: 1.02rem;
}

.event-name span,
.field-help,
.points-preview {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.points-preview {
  min-height: 46px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-3);
}

.points-preview strong {
  color: var(--text);
  font-size: 1.15rem;
}

.entry-actions,
.report-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

.draft-score {
  display: grid;
  gap: 4px;
  min-width: 170px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.draft-score span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.draft-score strong {
  font-size: 1.3rem;
}

.primary-button,
.ghost-button {
  min-height: 46px;
  border-radius: 8px;
  padding: 11px 18px;
  font-weight: 850;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #12150f;
}

.primary-button:disabled {
  border-color: var(--border);
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
}

.ghost-button {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.wait-view {
  min-height: 62vh;
  place-items: center;
}

.wait-view.active-view {
  display: grid;
}

.wait-card {
  width: min(620px, 100%);
  padding: clamp(22px, 4vw, 40px);
  text-align: center;
}

.countdown {
  display: grid;
  place-items: center;
  width: 106px;
  height: 106px;
  margin: 24px auto;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--accent-2);
  font-size: 3rem;
  font-weight: 900;
}

.ad-space {
  display: grid;
  place-items: center;
  min-height: 112px;
  border: 1px dashed color-mix(in srgb, var(--accent-2) 55%, var(--border));
  border-radius: 8px;
  background: rgba(210, 180, 91, 0.07);
  color: var(--muted);
  font-weight: 800;
}

.report-ad {
  margin: 18px 0;
}

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

.result-card {
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-3);
}

.result-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.result-card strong {
  display: block;
  font-size: clamp(1.4rem, 3vw, 2.25rem);
  line-height: 1.05;
}

.pass-text {
  color: var(--good);
}

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

.report-details {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(130px, 0.65fr) minmax(110px, 0.5fr);
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.detail-row span {
  color: var(--muted);
  font-size: 0.84rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto 28px;
  font-size: 0.84rem;
}

@media (max-width: 880px) {
  .controls,
  .event-card,
  .result-grid,
  .detail-row {
    grid-template-columns: 1fr;
  }

  .entry-actions,
  .report-actions,
  .footer {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .brand-logo {
    width: 48px;
    height: 48px;
  }

  .brand-text span {
    display: none;
  }

  .mode-pill {
    display: none;
  }
}
