:root {
  --bg: #070b1a;
  --surface: #11172a;
  --text: #f7f3ea;
  --muted: #a8adbd;
  --accent: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1b2450 0, var(--bg) 45%);
  color: var(--text);

  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

html {
  background: var(--bg);
}

html,
body {
  overscroll-behavior: none;
  touch-action: manipulation;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 20px;
  display: flex;
  align-items: center;
  justify-content: center;

  background: radial-gradient(circle at top, #1b2450 0, var(--bg) 45%);

}

[data-screen] {
  width: 100%;
}

[data-screen="results"],
[data-screen="session-detail"] {
  touch-action: pan-y;
}

.brand {
  width: 100%;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(17, 23, 42, 0.72);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.brand-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.brand-horizontal {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 16px;
  align-items: center;
  text-align: left;
}

.brand-horizontal .brand-icon {
  margin-bottom: 0;
}

.brand-horizontal h1 {
  font-size: 36px;
}

.brand-horizontal p {
  margin-top: 4px;
}

.home-intro {
  margin: 28px 2px 36px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}


h1 {
  margin: 0;
  font-size: 42px;
  letter-spacing: -0.05em;
}

p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.debug-note {
  margin-top: 24px;
  font-size: 14px;
  text-align: center;
}

.home-card {
  width: 100%;
}

.home-form {
  margin-top: 24px;
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.mode-group legend {
  font-size: 14px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
}

.input-with-unit {
  position: relative;
}

.input-with-unit input {
  padding-right: 56px;
}

.input-unit {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
}

select option {
  color: #111;
}

.mode-group {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 10px;
}

.mode-group legend {
    margin-bottom: 8px;
}

.mode-group label {
  min-height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 120ms ease;
}

.mode-group input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-group label:has(input:checked) {
  background: rgba(255, 107, 107, 0.18);
  border-color: rgba(255, 107, 107, 0.75);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.18);
}

.mode-group label:active {
  transform: translateY(1px);
}

.primary-button {
  min-height: 52px;
  border: 0;
  border-radius: 18px;
  background: var(--accent);
  color: #180b0b;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

form .primary-button {
  margin-top: 24px;
}

.primary-button:active {
  transform: translateY(1px);
}

.calibration-card {
  width: 100%;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  background: rgba(17, 23, 42, 0.72);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.choice-line {
  margin-top: 20px;
  font-size: 22px;
  line-height: 1.35;
  color: var(--text);
}

.calibration-actions {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.secondary-button {
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button:active {
  transform: translateY(1px);
}


.result-deck {
  width: 100%;
  display: grid;
  gap: 18px;
}

.result-card {
  display: flex;
  flex-direction: column;

  width: 100%;
  min-height: 64vh;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  background: rgba(17, 23, 42, 0.72);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.result-card-header {
  display: grid;
  gap: 4px;
}

.result-secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.result-secondary-actions .ghost-button {
  min-height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

#active-result-card {
  width: 100%;
}

.recommendation-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recommendation-score {
  margin: 0;
  color: #3ddc84;
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.result-card-header h2 {
  margin-top: 8px;
  font-size: 24px;
}

.result-film-list {
  margin-top: 24px;
  display: grid;
  gap: 14px;
}

.compact-film-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
}

.compact-film-thumbnail {
  width: 92px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  background: #000;
}

.compact-film-content {
  min-width: 0;
}

.compact-film-index {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.compact-film-content h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.compact-film-content p {
  margin-top: 4px;
  font-size: 13px;
}

.result-card .primary-button {
  width: 100%;
  margin-top: auto;
}

.result-navigation {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  gap: 12px;
  align-items: center;
}

.result-counter {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.ghost-button {
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.session-detail {
  width: 100%;
  display: grid;
  gap: 18px;
}

.session-detail-header {
  margin-top: 8px;
}

.session-detail p {
  margin-bottom: 12px;
}

.session-detail-films {
  display: grid;
  gap: 18px;
}

.detail-film-card {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background: rgba(17, 23, 42, 0.72);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
}

.detail-film-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 18px;
  background: #000;
}

.detail-film-content {
  margin-top: 14px;
}

.detail-film-content h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.film-meta {
  margin-top: 6px;
  color: var(--accent);
  font-size: 13px;
}

.film-summary {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.primary-link-button {
  min-height: 48px;
  margin-top: 16px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--accent);
  color: #180b0b;
  font-weight: 800;
  text-decoration: none;
}

.detail-video-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  background: #000;
  aspect-ratio: 16 / 9;
}

.detail-video-frame iframe,
.detail-video-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.detail-video-frame img {
  object-fit: cover;
}



.result-card-slide-next {
  animation: slideNextCard 220ms ease-out;
}

.result-card-slide-previous {
  animation: slidePreviousCard 220ms ease-out;
}

.result-card-reroll {
  animation: throwCard 260ms ease-out;
}

@keyframes slideNextCard {
  from {
    opacity: 0;
    transform: translateX(42px) rotate(1.5deg);
  }

  to {
    opacity: 1;
    transform: translateX(0) rotate(0);
  }
}

@keyframes slidePreviousCard {
  from {
    opacity: 0;
    transform: translateX(-42px) rotate(-1.5deg);
  }

  to {
    opacity: 1;
    transform: translateX(0) rotate(0);
  }
}

@keyframes throwCard {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96) rotate(2deg);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
}