:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #0f0f0f;
  --text: #f4ede3;
  --muted: #b9a48e;
  --line: rgba(183, 101, 41, 0.22);
  --accent: #b76529;
  --accent-deep: #8f4a1f;
  --green: #1f8d45;
  --green-soft: rgba(31, 141, 69, 0.18);
  --red: #b73d33;
  --red-soft: rgba(183, 61, 51, 0.18);
  --white: #fff8f0;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top, rgba(183, 101, 41, 0.12), transparent 24%),
    linear-gradient(180deg, #080808 0%, #020202 100%);
  color: var(--text);
}

body.intro-mode {
  background:
    radial-gradient(circle at top center, rgba(255, 247, 219, 0.92), rgba(255, 247, 219, 0) 28%),
    linear-gradient(180deg, rgba(248, 231, 183, 0.98), rgba(245, 226, 174, 0.98)),
    #f5e1ab;
}

button,
a {
  font: inherit;
}

.app-shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 0 0 32px;
}

.intro-screen,
.results-view {
  padding-top: 24px;
}

.intro-card,
.results-hero,
.result-card,
.history-item {
  border: 1px solid var(--line);
  background: rgba(14, 14, 14, 0.95);
}

.intro-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px 0;
}

.intro-card {
  max-width: 1240px;
  width: 100%;
  position: relative;
  overflow: hidden;
  padding: clamp(44px, 6vw, 76px);
  text-align: center;
  border-radius: 0;
  border: 3px solid rgba(84, 34, 8, 0.95);
  background:
    linear-gradient(180deg, rgba(248, 231, 183, 0.98), rgba(245, 226, 174, 0.98)),
    #f5e1ab;
  color: #542208;
  min-height: min(92vh, 1220px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.intro-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(84, 34, 8, 0.8);
  pointer-events: none;
}

.intro-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top center, rgba(255, 247, 219, 0.9), rgba(255, 247, 219, 0) 32%),
    radial-gradient(circle at bottom center, rgba(167, 95, 43, 0.05), rgba(167, 95, 43, 0) 28%);
  pointer-events: none;
}

.intro-brand,
.intro-copy,
.intro-actions {
  position: relative;
  z-index: 1;
}

.intro-brand {
  padding-bottom: 34px;
}

.intro-logo {
  width: min(520px, 58vw);
  display: block;
  margin: 0 auto;
}

.intro-mark,
.results-mark {
  color: #6a2f0e;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
}

.intro-copy {
  max-width: 880px;
  margin: 0 auto;
  padding: 0;
  border-top: 0;
}

.intro-title {
  margin: 18px auto 18px;
  max-width: 860px;
  font-size: clamp(2.3rem, 4vw, 4.1rem);
  line-height: 1.05;
  font-weight: 500;
  color: #55230b;
}

.intro-divider {
  width: min(170px, 34%);
  height: 20px;
  margin: 24px auto 26px;
  position: relative;
}

.intro-divider::before,
.intro-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 44%;
  height: 1px;
  background: rgba(84, 34, 8, 0.7);
}

.intro-divider::before {
  left: 0;
}

.intro-divider::after {
  right: 0;
}

.intro-divider {
  background:
    radial-gradient(circle, rgba(84, 34, 8, 1) 0 18%, rgba(84, 34, 8, 0) 19%),
    linear-gradient(135deg, transparent 41%, rgba(84, 34, 8, 1) 42% 58%, transparent 59%),
    linear-gradient(225deg, transparent 41%, rgba(84, 34, 8, 1) 42% 58%, transparent 59%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px, 32px 12px, 32px 12px;
}

.intro-text {
  max-width: 760px;
  margin: 0 auto 16px;
  font-size: clamp(1.16rem, 1.55vw, 1.48rem);
  line-height: 1.68;
  color: rgba(84, 34, 8, 0.96);
}

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

.intro-actions {
  margin-top: 34px;
  padding-top: 0;
  border-top: 0;
}

.intro-ornament {
  width: 92px;
  height: 22px;
  margin: 0 auto 26px;
  position: relative;
}

.intro-ornament::before,
.intro-ornament::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 36px;
  height: 1px;
  background: rgba(84, 34, 8, 0.75);
}

.intro-ornament::before {
  left: 0;
}

.intro-ornament::after {
  right: 0;
}

.intro-ornament {
  background:
    radial-gradient(circle, rgba(84, 34, 8, 1) 0 16%, rgba(84, 34, 8, 0) 17%),
    linear-gradient(135deg, transparent 39%, rgba(84, 34, 8, 1) 40% 60%, transparent 61%),
    linear-gradient(225deg, transparent 39%, rgba(84, 34, 8, 1) 40% 60%, transparent 61%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px, 18px 8px, 18px 8px;
}

.start-button,
.secondary-button,
.report-link {
  border-radius: 999px;
  padding: 16px 24px;
  font-family: "Helvetica Neue", Arial, sans-serif;
  text-decoration: none;
}

.start-button {
  min-width: 280px;
  margin-top: 0;
  border: 1px solid rgba(84, 34, 8, 0.75);
  background: linear-gradient(180deg, rgba(109, 51, 18, 0.96), rgba(77, 29, 8, 1));
  color: #f8e5b7;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(84, 34, 8, 0.16);
}

.review-screen {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding-top: 14px;
}

.topbar {
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  align-items: center;
  gap: 16px;
}

.position-label {
  text-align: center;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--white);
}

.nav-button,
.secondary-button {
  height: 48px;
  border: 1px solid var(--line);
  background: rgba(15, 15, 15, 0.9);
  color: var(--white);
  cursor: pointer;
}

.image-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 16px;
}

.image-stage img {
  max-width: 100%;
  max-height: min(68vh, calc(100vh - 230px));
  object-fit: contain;
}

.bottom-bar {
  position: sticky;
  bottom: 0;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(5, 5, 5, 0), rgba(5, 5, 5, 0.92) 35%, rgba(5, 5, 5, 1));
}

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

.decision-button {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px solid transparent;
  border-radius: 24px;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(1.22rem, 2vw, 1.8rem);
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.decision-button:hover {
  transform: translateY(-1px);
}

.decision-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
}

.decision-button.like {
  background: linear-gradient(180deg, rgba(31, 141, 69, 0.92), rgba(15, 83, 40, 0.96));
  border-color: rgba(110, 212, 146, 0.35);
  color: #f5fff8;
}

.decision-button.dislike {
  background: linear-gradient(180deg, rgba(183, 61, 51, 0.94), rgba(107, 28, 23, 0.96));
  border-color: rgba(255, 153, 145, 0.3);
  color: #fff4f2;
}

.decision-button.active.like {
  box-shadow: 0 0 0 2px rgba(110, 212, 146, 0.25);
}

.decision-button.active.dislike {
  box-shadow: 0 0 0 2px rgba(255, 153, 145, 0.25);
}

.decision-button.like::after {
  background: radial-gradient(circle, rgba(216, 248, 226, 0.45) 0%, rgba(216, 248, 226, 0) 65%);
}

.decision-button.dislike::after {
  background: radial-gradient(circle, rgba(255, 217, 212, 0.42) 0%, rgba(255, 217, 212, 0) 65%);
}

.decision-button.pulse::after {
  animation: button-pulse 520ms ease;
}

.button-icon {
  font-size: 1.4em;
  line-height: 1;
}

.results-hero {
  padding: 24px;
  border-radius: 28px;
}

.results-hero h2 {
  margin: 10px 0;
  font-size: clamp(2rem, 3vw, 2.9rem);
  font-weight: 400;
}

.results-lead {
  margin: 0;
  max-width: 920px;
  line-height: 1.65;
  color: var(--muted);
}

.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.filter-group,
.results-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-button,
.report-link {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--white);
  cursor: pointer;
}

.filter-button {
  border-radius: 999px;
  padding: 10px 16px;
}

.filter-button.active {
  background: rgba(183, 101, 41, 0.22);
}

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

.result-card {
  padding: 12px;
  border-radius: 22px;
  cursor: pointer;
}

.result-card-media {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #181818;
}

.result-card-image {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}

.result-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.result-card-badge.like {
  background: var(--green-soft);
}

.result-card-badge.dislike {
  background: var(--red-soft);
}

.result-card-badge.undetermined {
  background: rgba(183, 101, 41, 0.18);
  color: #f0c9a9;
}

.result-card-meta {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

.result-card-time {
  color: var(--white);
  font-size: 0.95rem;
}

.result-card-seconds,
.history-date,
.history-balance,
.history-empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.history-section {
  margin-top: 28px;
}

.history-section h3 {
  margin: 0 0 14px;
  font-size: 1.2rem;
  font-weight: 400;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  color: var(--white);
  text-decoration: none;
}

.history-title,
.history-date,
.history-balance,
.history-empty {
  font-family: "Helvetica Neue", Arial, sans-serif;
}

.history-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none;
}

@keyframes button-pulse {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  25% {
    opacity: 0.95;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1380px);
  }

  .intro-card {
    min-height: auto;
    padding: 34px 24px 38px;
  }

  .intro-brand {
    padding-bottom: 24px;
  }

  .intro-copy {
    max-width: 100%;
  }

  .intro-actions {
    margin-top: 24px;
  }

  .intro-logo {
    width: min(420px, 72vw);
  }

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

  .position-label {
    grid-column: 1 / -1;
    order: -1;
  }

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

  .results-toolbar,
  .history-item {
    grid-template-columns: 1fr;
  }

  .results-actions,
  .filter-group {
    width: 100%;
  }

  .start-button,
  .report-link,
  .secondary-button {
    width: 100%;
    text-align: center;
  }

  .decision-button {
    min-height: 78px;
  }

  .image-stage img {
    max-height: min(60vh, calc(100vh - 240px));
  }
}
