:root {
  color-scheme: dark;
  --bg: #14181c;
  --panel: #1f252b;
  --panel-soft: #2c3440;
  --panel-deep: #0f1317;
  --text: #d8e0e8;
  --heading: #ffffff;
  --muted: #9ab;
  --line: #3b4652;
  --green: #00c030;
  --orange: #ff8000;
  --blue: #40bcf4;
  --wrong: #ff5a5f;
  --right: #00c030;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(20, 24, 28, 0.68), #14181c 34rem),
    linear-gradient(120deg, rgba(255, 128, 0, 0.14), transparent 22rem),
    linear-gradient(240deg, rgba(64, 188, 244, 0.12), transparent 24rem),
    var(--bg);
  color: var(--text);
}

button,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: stretch;
  padding: 18px 0;
}

.quiz-panel,
.side-panel {
  border: 1px solid rgba(154, 170, 187, 0.2);
  background: rgba(31, 37, 43, 0.94);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.36);
  border-radius: 8px;
}

.quiz-panel {
  min-height: 0;
  padding: clamp(16px, 2.5vw, 28px);
  display: grid;
  grid-template-rows: auto auto minmax(110px, 0.75fr) minmax(220px, 1.35fr) auto;
  gap: 14px;
}

.topbar,
.controls-row,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-mark span {
  width: 12px;
  aspect-ratio: 1;
  border-radius: 999px;
}

.brand-mark span:nth-child(1) {
  background: var(--orange);
}

.brand-mark span:nth-child(2) {
  background: var(--green);
}

.brand-mark span:nth-child(3) {
  background: var(--blue);
}

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

h1 {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--heading);
  font-size: clamp(1.8rem, 3.9vw, 3.65rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  color: var(--heading);
  font-size: 1rem;
}

.score-card {
  width: 96px;
  aspect-ratio: 1;
  border: 1px solid rgba(154, 170, 187, 0.22);
  background: linear-gradient(180deg, #2c3440, #1b2128);
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  flex: 0 0 auto;
}

.score-card span {
  display: block;
  font-size: 2rem;
  font-weight: 900;
  color: var(--green);
}

.score-card small {
  color: var(--muted);
}

.controls-row {
  margin: 0;
  justify-content: flex-start;
  flex-wrap: wrap;
}

label {
  color: var(--muted);
  font-weight: 800;
}

select,
button {
  min-height: 38px;
  border: 1px solid rgba(154, 170, 187, 0.24);
  border-radius: 4px;
}

select {
  background: var(--panel-soft);
  color: var(--text);
  padding: 0 12px;
}

button {
  cursor: pointer;
  background: var(--green);
  color: #061208;
  font-weight: 850;
  padding: 0 18px;
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.82;
}

.ghost-button {
  background: #33404c;
  color: var(--text);
}

.language-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  min-height: 38px;
  overflow: hidden;
  border: 1px solid rgba(154, 170, 187, 0.24);
  border-radius: 4px;
  background: #1b2229;
}

.lang-option {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
}

.lang-option.active {
  background: var(--blue);
  color: #071016;
}

.review-box {
  min-height: 0;
  height: 100%;
  border: 1px solid rgba(154, 170, 187, 0.2);
  background: #202830;
  color: #e7eef5;
  border-radius: 4px;
  padding: clamp(14px, 2.4vw, 22px);
  display: flex;
  align-items: center;
}

.review-box p {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(0.98rem, 1.65vw, 1.25rem);
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
}

.choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 0;
  gap: clamp(10px, 1.8vw, 18px);
  margin-top: 0;
}

.choice {
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  text-align: left;
}

.poster-frame {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  overflow: hidden;
  border: 1px solid rgba(154, 170, 187, 0.28);
  background:
    linear-gradient(145deg, rgba(255, 128, 0, 0.22), transparent 45%),
    linear-gradient(320deg, rgba(64, 188, 244, 0.18), transparent 48%),
    var(--panel-deep);
  border-radius: 6px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.34);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.poster-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  color: #fff;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
}

.choice:not(.poster-missing) .poster-fallback {
  display: none;
}

.movie-title {
  min-height: 36px;
  color: #c8d4df;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.choice:hover:not(:disabled) .poster-frame {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(64, 188, 244, 0.28), 0 20px 46px rgba(0, 0, 0, 0.42);
  transform: translateY(-4px);
}

.choice.correct .poster-frame {
  border-color: var(--right);
  box-shadow: 0 0 0 4px rgba(0, 192, 48, 0.35), 0 20px 46px rgba(0, 0, 0, 0.42);
}

.choice.wrong .poster-frame {
  border-color: var(--wrong);
  box-shadow: 0 0 0 4px rgba(255, 90, 95, 0.34), 0 20px 46px rgba(0, 0, 0, 0.42);
}

.choice:disabled {
  cursor: default;
}

.status-row {
  min-height: 40px;
  margin-top: 0;
}

#feedback {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.hidden {
  display: none;
}

.side-panel {
  align-self: stretch;
  padding: 18px;
  display: grid;
  align-content: center;
}

dl {
  display: grid;
  gap: 14px;
  margin: 0;
}

dl div {
  border-top: 1px solid rgba(154, 170, 187, 0.18);
  padding-top: 14px;
}

dt {
  color: var(--muted);
  font-size: 0.85rem;
}

dd {
  margin: 3px 0 0;
  color: var(--heading);
  font-size: 1.7rem;
  font-weight: 900;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .topbar {
    align-items: flex-start;
  }

  .side-panel {
    padding: 10px 14px;
  }

  .side-panel h2 {
    display: none;
  }

  dl {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  dl div {
    border-top: 0;
    padding-top: 0;
  }

  dd {
    font-size: 1.2rem;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 8px 0;
  }

  .quiz-panel {
    padding: 12px;
    grid-template-rows: auto auto minmax(92px, 0.8fr) minmax(150px, 1fr) auto;
    gap: 10px;
  }

  .topbar {
    display: flex;
    gap: 10px;
  }

  .score-card {
    width: 72px;
    min-height: 64px;
  }

  .score-card span {
    font-size: 1.55rem;
  }

  h1 {
    font-size: 1.42rem;
  }

  .brand-mark {
    margin-bottom: 5px;
    font-size: 0.72rem;
  }

  .brand-mark span {
    width: 9px;
  }

  .controls-row {
    gap: 8px;
  }

  label {
    display: none;
  }

  select,
  button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .language-toggle {
    min-height: 34px;
  }

  .lang-option {
    padding: 0 8px;
  }

  .review-box p {
    font-size: 0.88rem;
    line-height: 1.34;
    -webkit-line-clamp: 5;
  }

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

  .movie-title {
    min-height: 48px;
    font-size: 0.7rem;
  }

  .status-row {
    min-height: 34px;
    gap: 8px;
  }

  #feedback {
    font-size: 0.78rem;
  }

  .side-panel {
    padding: 8px 12px;
  }

  dt {
    font-size: 0.68rem;
  }

  dd {
    font-size: 1rem;
  }
}
