:root {
  color-scheme: dark;
  --bg: #050505;
  --bg-soft: #0e0e0e;
  --panel: #141414;
  --panel-strong: #1c1c1c;
  --text: #ffffff;
  --muted: #b6b6b6;
  --dim: #7d7d7d;
  --line: rgba(255, 255, 255, 0.14);
  --orange: #e16a03;
  --orange-light: #ff8a1f;
  --orange-soft: rgba(225, 106, 3, 0.16);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(225, 106, 3, 0.18), transparent 28%),
    linear-gradient(180deg, #000 0%, #080808 50%, #050505 100%);
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

a {
  color: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 42px;
}

.topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.trial-button {
  display: inline-flex;
  flex-direction: column;
  width: fit-content;
  max-width: 760px;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(225, 106, 3, 0.75);
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), #9f4300);
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow: 0 14px 34px rgba(225, 106, 3, 0.22);
}

.topline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.language-switcher {
  position: relative;
}

.language-switcher summary {
  display: inline-flex;
  gap: 8px;
  min-height: 44px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #fff;
  background: #080808;
  padding: 0 14px;
  font-size: 0.86rem;
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}

.globe-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #fff;
}

.language-switcher summary::-webkit-details-marker {
  display: none;
}

.language-switcher summary::after {
  content: "▾";
  margin-left: 9px;
  color: var(--orange-light);
}

.language-menu {
  position: absolute;
  right: 0;
  z-index: 10;
  display: none;
  min-width: 158px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #090909;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.language-switcher[open] .language-menu {
  display: grid;
}

.language-menu a {
  color: #fff;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.language-menu a:hover {
  background: var(--orange-soft);
}

.brand {
  display: block;
  width: 250px;
  max-width: 28vw;
  overflow: hidden;
  border-radius: 8px;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 100%;
  height: auto;
}

.intro-layout,
.quiz-layout,
.result-layout {
  animation: enter 260ms ease;
}

.intro-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(350px, 0.98fr);
  align-items: stretch;
  gap: 22px;
}

.intro-copy,
.question-panel,
.quiz-sidebar,
.result-main,
.result-details,
.answer-review {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 20, 20, 0.94);
  box-shadow: var(--shadow);
}

.intro-copy {
  display: flex;
  min-height: 650px;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
}

.uk-flag {
  width: 82px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.eyebrow {
  margin: 28px 0 12px;
  color: var(--orange-light);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  /* Match heading rules: don't break inside words */
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: manual;
}

/* Headings: never break inside a word. Either the word fits on the line, or it
   wraps to the next line as a whole. This prevents ugly mid-word breaks like
   "ОРИЕНТИРОВОЧНЫ" / "Й" or "the" / "level" being awkwardly split. */
h1,
h2,
h3 {
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: manual;
}

/* Paragraphs: allow long words and URLs to break if they truly don't fit, but
   prefer auto-hyphenation where the browser supports it for the active language. */
p {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  -webkit-hyphens: auto;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
  text-wrap: balance;
}

h1 {
  max-width: 760px;
  /* Smaller upper bound so the longest word in any language ("ОРИЕНТИРОВОЧНЫЙ",
     "Niveau-Einschatzung", "placement-style") fits on its own line at any
     viewport width without forcing a mid-word break. */
  font-size: clamp(1.55rem, 1rem + 1.9vw, 2.4rem);
  text-transform: uppercase;
}

.lead {
  max-width: 720px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.62;
}

.note {
  max-width: 700px;
  margin: 18px 0 0;
  border-left: 4px solid var(--orange);
  color: #dedede;
  background: var(--orange-soft);
  padding: 12px 14px;
  line-height: 1.45;
}

.start-form {
  display: grid;
  width: min(100%, 520px);
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 30px;
}

.form-field {
  display: grid;
  gap: 8px;
}

.start-form label {
  color: #f4f4f4;
  font-size: 0.88rem;
  font-weight: 800;
}

.start-form input,
.start-form select {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #fff;
  background: #070707;
  padding: 0 14px;
}

.start-form input::placeholder {
  color: #878787;
}

.start-form input:focus,
.start-form select:focus,
.option-button:focus-visible,
button:focus-visible,
.trial-button:focus-visible {
  outline: 3px solid rgba(225, 106, 3, 0.38);
  outline-offset: 2px;
}

.start-form .primary-action {
  margin-top: 4px;
}

.intro-visual {
  position: relative;
  display: grid;
  min-height: 650px;
  align-content: end;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #101010;
  box-shadow: var(--shadow);
}

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

.photo-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.78)),
    linear-gradient(90deg, rgba(225, 106, 3, 0.28), transparent 48%);
}

.hero-badge {
  position: absolute;
  right: 28px;
  top: 28px;
  display: grid;
  width: 154px;
  height: 112px;
  place-items: center;
  transform: rotate(2deg);
}

.cat-face {
  position: relative;
  z-index: 2;
  display: grid;
  width: 138px;
  height: 86px;
  place-items: center;
  border-radius: 8px 8px 20px 20px;
  color: #fff;
  background: var(--orange);
  font-size: 2.35rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow:
    7px 7px 0 #a74700,
    18px 18px 36px rgba(0, 0, 0, 0.4);
}

.cat-ear {
  position: absolute;
  top: 2px;
  z-index: 1;
  width: 42px;
  height: 42px;
  background: var(--orange);
  transform: rotate(45deg);
}

.cat-ear.left {
  left: 20px;
}

.cat-ear.right {
  right: 20px;
}

.cat-tail {
  position: absolute;
  right: -5px;
  bottom: 12px;
  width: 58px;
  height: 34px;
  border: 9px solid var(--orange);
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 26px 0 0;
}

.level-ladder {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 18px;
}

.level-ladder span {
  min-height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #fff;
  background: rgba(0, 0, 0, 0.52);
  font-size: 0.88rem;
  font-weight: 900;
  text-align: center;
}

.quiz-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  align-items: start;
  gap: 22px;
}

.quiz-sidebar,
.question-panel,
.result-main,
.result-details,
.answer-review {
  padding: 28px;
}

.quiz-sidebar {
  position: sticky;
  top: 18px;
}

.tester {
  display: grid;
  gap: 5px;
  margin-bottom: 18px;
}

.tester-label {
  color: var(--orange-light);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tester strong {
  font-size: 1.45rem;
}

#tester-age {
  color: var(--muted);
}

.route-pill {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px solid rgba(225, 106, 3, 0.45);
  border-radius: 8px;
  color: #fff;
  background: var(--orange-soft);
  padding: 0 12px;
  font-size: 0.86rem;
  font-weight: 800;
}

.progress-block {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.progress-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.progress-text strong {
  color: #fff;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #303030;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), #fff);
  transition: width 220ms ease;
}

.skill-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 24px;
}

.skill-stack span {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #f6f6f6;
  background: #101010;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.question-panel {
  min-height: 590px;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.question-meta span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid rgba(225, 106, 3, 0.42);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--orange-soft);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 900;
}

#question-title {
  max-width: 860px;
  font-size: clamp(1.4rem, 0.95rem + 1.6vw, 2.12rem);
}

#question-text {
  max-width: 860px;
  min-height: 56px;
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.58;
}

.passage {
  max-width: 860px;
  margin: 0 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 5px solid var(--orange);
  border-radius: 8px;
  background: #090909;
  padding: 18px;
  color: #f3f3f3;
  line-height: 1.6;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.option-button {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #0b0b0b;
  color: #fff;
  padding: 18px;
  text-align: left;
  font-weight: 800;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.option-button:hover {
  transform: translateY(-2px);
  border-color: rgba(225, 106, 3, 0.58);
}

.option-button.is-selected {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.option-letter {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: #111;
  background: #fff;
  font-size: 0.95rem;
  font-weight: 900;
}

.quiz-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 900;
}

.primary-action {
  border: 0;
  color: #fff;
  background: var(--orange);
  box-shadow:
    5px 5px 0 #923f00,
    0 18px 34px rgba(225, 106, 3, 0.24);
}

.primary-action:hover:not(:disabled) {
  background: var(--orange-light);
}

.secondary-action {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  background: #080808;
}

.secondary-action:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.38);
  background: #151515;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.74fr);
  gap: 22px;
}

.result-main {
  min-height: 470px;
}

#result-title {
  font-size: clamp(1.5rem, 1.05rem + 1.7vw, 2.35rem);
}

.result-score {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin: 26px 0 18px;
}

#result-level {
  display: inline-flex;
  min-height: 58px;
  align-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--orange);
  padding: 0 18px;
  font-size: 1.45rem;
  font-weight: 900;
}

#result-percent {
  font-size: clamp(1.85rem, 1.3rem + 1.9vw, 2.72rem);
}

.result-summary {
  max-width: 750px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.recommendations {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.recommendations p {
  margin: 0;
  border: 1px solid rgba(225, 106, 3, 0.22);
  border-radius: 8px;
  color: #f7f7f7;
  background: var(--orange-soft);
  padding: 14px 16px;
  line-height: 1.45;
}

.result-details h3 {
  font-size: 1.35rem;
}

.breakdown {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.skill-row {
  display: grid;
  gap: 8px;
}

.skill-row header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.skill-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #303030;
}

.skill-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
}

.answer-review {
  grid-column: 1 / -1;
  box-shadow: none;
}

.answer-review h3 {
  margin-bottom: 16px;
}

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

.review-item {
  display: grid;
  gap: 6px;
  border-radius: 8px;
  background: #090909;
  padding: 14px;
}

.review-item strong {
  color: #fff;
}

.review-item span {
  color: var(--muted);
}

.review-item.is-correct {
  border-left: 5px solid var(--orange);
}

.review-item.is-wrong {
  border-left: 5px solid #fff;
}

.footer-note {
  display: grid;
  max-width: 960px;
  gap: 8px;
  margin: 24px auto 0;
  color: var(--dim);
  font-size: 0.75rem;
  line-height: 1.45;
  text-align: center;
}

.footer-note a {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
  text-decoration-color: var(--orange);
  text-underline-offset: 4px;
}

.is-hidden {
  display: none !important;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .topline {
    grid-template-columns: 1fr;
  }

  .topline-actions {
    justify-content: space-between;
    width: 100%;
  }

  .brand {
    max-width: 260px;
  }

  .intro-layout,
  .quiz-layout,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .intro-copy,
  .intro-visual {
    min-height: auto;
  }

  .intro-copy,
  .quiz-sidebar,
  .question-panel,
  .result-main,
  .result-details,
  .answer-review {
    padding: 24px;
  }

  .intro-visual {
    min-height: 420px;
  }

  .quiz-sidebar {
    position: static;
  }

  .skill-stack {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 12px;
  }

  h1 {
    font-size: 1.55rem;
  }

  #question-title,
  #result-title {
    font-size: 1.4rem;
  }

  .lead,
  #question-text,
  .result-summary {
    font-size: 1rem;
  }

  .trial-button {
    width: 100%;
    font-size: 0.76rem;
  }

  .topline-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .brand {
    width: 100%;
    max-width: 280px;
  }

  .language-switcher summary {
    width: 100%;
    justify-content: center;
  }

  .language-menu {
    left: 0;
    right: auto;
    width: 100%;
  }

  .start-form,
  .options-grid,
  .level-ladder,
  .skill-stack {
    grid-template-columns: 1fr;
  }

  .start-form label:first-child,
  .start-form label:nth-of-type(2) {
    grid-column: auto;
  }

  .hero-badge {
    right: 16px;
    top: 16px;
    transform: scale(0.78) rotate(2deg);
    transform-origin: top right;
  }

  .quiz-actions,
  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }
}

/* Very narrow viewports (e.g. iPhone SE in portrait, ~320–380px). Drop heading
   font sizes further so the longest word in any language ("ОРИЕНТИРОВОЧНЫЙ",
   "Niveau-Einschatzung", etc.) still fits on its own line without breaking. */
@media (max-width: 380px) {
  h1 {
    font-size: 1.3rem;
  }

  #question-title,
  #result-title {
    font-size: 1.2rem;
  }

  .eyebrow {
    font-size: 0.7rem;
  }
}

@media print {
  body {
    color: #000;
    background: #fff;
  }

  .topline,
  .intro-layout,
  .quiz-layout,
  .result-actions,
  .footer-note,
  .answer-review.is-hidden {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }

  .result-layout {
    display: block;
  }

  .result-main,
  .result-details,
  .answer-review {
    border: 0;
    color: #000;
    background: #fff;
    box-shadow: none;
    page-break-inside: avoid;
  }
}

/* ------------- Listening question card (Round 4) ------------- */
.listen-card {
  max-width: 860px;
  margin: 0 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 5px solid var(--orange);
  border-radius: 8px;
  background: #090909;
  padding: 22px;
  display: grid;
  gap: 14px;
}
.listen-hint {
  color: #cfcfcf;
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.5;
}
.listen-button {
  justify-self: start;
  border: 0;
  border-radius: 8px;
  padding: 14px 22px;
  background: var(--orange);
  color: #fff;
  font-weight: 900;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.listen-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 0 #a74700;
}
.listen-button:disabled {
  opacity: 0.6;
  cursor: default;
}
.listen-fallback {
  color: #f3f3f3;
  line-height: 1.6;
  margin: 0;
  font-style: italic;
}

/* ============================================================
   CAP MESSAGE — shown when child scores 90%+ in an age band
   that has a Cambridge YLE/Schools ceiling below C1. Explains
   the standard and offers next steps.
============================================================ */
.cap-message {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid rgba(225, 106, 3, 0.42);
  border-left: 5px solid var(--orange);
  border-radius: 8px;
  background: rgba(225, 106, 3, 0.08);
  display: grid;
  gap: 12px;
}

.cap-message-title {
  display: block;
  font-size: 1.1rem;
  color: #fff;
  font-weight: 900;
}

.cap-message-text {
  margin: 0;
  color: #e8e8e8;
  line-height: 1.6;
  font-size: 0.97rem;
}

.cap-try-next-button {
  justify-self: start;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  padding: 12px 22px;
  background: transparent;
  color: var(--orange-light);
  border: 2px solid var(--orange);
  font-weight: 900;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}
.cap-try-next-button:hover {
  background: var(--orange);
  color: #fff;
  transform: translateY(-1px);
}
.cap-try-next-button:active {
  transform: translateY(1px);
}

@media (max-width: 680px) {
  .cap-try-next-button {
    width: 100%;
    text-align: center;
  }
}

/* ============================================================
   GIFT BLOCK ON RESULT PAGE
   ============================================================
   Layout: hint sticker on top, gift emoji in the middle, reveal
   panel below (hidden until click). Everything sits in normal
   document flow inside .gift-wrap — no absolute positioning that
   could clip outside the container.
*/
.gift-wrap {
  margin-top: 28px;
  padding: 28px 24px;
  border: 1px solid rgba(225, 106, 3, 0.42);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(225, 106, 3, 0.14), rgba(225, 106, 3, 0.04));
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  /* Important: allow filters/animations to draw outside if needed without clipping */
  overflow: visible;
}

/* --- Hint above the gift --- */
.gift-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--orange);
  pointer-events: none;
  /* Bobs up and down to attract attention */
  animation: giftHintBob 1.2s ease-in-out infinite;
  /* Hide gracefully when opened */
  transition: opacity 280ms ease, transform 280ms ease, max-height 380ms ease, margin 280ms ease, padding 280ms ease;
  max-height: 90px;
  opacity: 1;
}
.gift-hint-label {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-weight: 900;
  font-size: 0.92rem;
  padding: 8px 16px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 0 #a74700;
  max-width: min(520px, 90vw);
  overflow: hidden;
  text-overflow: ellipsis;
}
.gift-hint-arrow {
  font-size: 1.3rem;
  line-height: 1;
  color: var(--orange);
  text-shadow: 0 2px 0 #a74700;
}
@keyframes giftHintBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* --- Gift emoji button --- */
.gift-emoji {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 4px 0;
  cursor: pointer;
  font-size: 6rem;
  line-height: 1;
  /* Important: must not be clipped by ancestor boxes */
  width: 7.5rem;
  height: 7.5rem;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 6px 12px rgba(225, 106, 3, 0.4));
  transition: transform 200ms ease, filter 220ms ease;
}
.gift-emoji-icon {
  display: inline-block;
  /* Subtle wiggle to look "wrapped and waiting" */
  animation: giftWiggle 2.4s ease-in-out infinite;
  transform-origin: 50% 80%;
}
.gift-emoji:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 8px 18px rgba(225, 106, 3, 0.55));
}
.gift-emoji:active {
  transform: scale(0.95);
}
@keyframes giftWiggle {
  0%, 90%, 100% { transform: rotate(0deg); }
  92%           { transform: rotate(-8deg); }
  94%           { transform: rotate(8deg); }
  96%           { transform: rotate(-5deg); }
  98%           { transform: rotate(3deg); }
}

/* --- Sparkles around the emoji (only show on click) --- */
.gift-sparkle {
  position: absolute;
  font-size: 1.4rem;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 6px #fff);
}
.gift-sparkle-1 { top: 6%;  left: 6%; }
.gift-sparkle-2 { top: 8%;  right: 6%; }
.gift-sparkle-3 { bottom: 12%; left: 4%; }
.gift-sparkle-4 { bottom: 10%; right: 4%; }

/* --- Click animation: shake + flash + sparkles --- */
.gift-wrap.is-blinking .gift-emoji-icon {
  animation: giftShake 0.7s ease-in-out;
}
@keyframes giftShake {
  0%, 100% { transform: rotate(0deg) scale(1); }
  10%      { transform: rotate(-12deg) scale(1.08); }
  25%      { transform: rotate(12deg)  scale(1.08); }
  40%      { transform: rotate(-10deg) scale(1.12); }
  55%      { transform: rotate(10deg)  scale(1.12); }
  70%      { transform: rotate(-6deg)  scale(1.16); }
  85%      { transform: rotate(4deg)   scale(1.18); }
}
.gift-wrap.is-blinking .gift-emoji {
  filter: drop-shadow(0 0 24px #ff8a2b) drop-shadow(0 0 36px #fff);
}
.gift-wrap.is-blinking .gift-sparkle {
  animation: giftSparkleFly 0.7s ease-out forwards;
}
.gift-wrap.is-blinking .gift-sparkle-2 { animation-delay: 80ms; }
.gift-wrap.is-blinking .gift-sparkle-3 { animation-delay: 160ms; }
.gift-wrap.is-blinking .gift-sparkle-4 { animation-delay: 240ms; }
@keyframes giftSparkleFly {
  0%   { opacity: 0; transform: scale(0.4) rotate(0deg); }
  40%  { opacity: 1; transform: scale(1.4) rotate(180deg); }
  100% { opacity: 0; transform: scale(0.6) rotate(360deg); }
}

/* --- Opened state: hide hint, fade gift, reveal message --- */
.gift-wrap.is-opened .gift-hint {
  opacity: 0;
  max-height: 0;
  margin: 0;
  padding: 0;
  transform: translateY(-10px);
}
.gift-wrap.is-opened .gift-emoji {
  transform: scale(0.78);
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}
.gift-wrap.is-opened .gift-emoji-icon {
  animation: none;
}

.gift-reveal {
  display: none;
  max-width: 560px;
  width: 100%;
  text-align: center;
}
.gift-wrap.is-opened .gift-reveal {
  display: grid;
  gap: 14px;
  justify-items: center;
  animation: giftRevealIn 520ms ease-out 200ms both;
}
@keyframes giftRevealIn {
  0%   { opacity: 0; transform: translateY(16px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.gift-reveal-title {
  display: block;
  font-size: 1.25rem;
  color: #fff;
}
.gift-reveal-text {
  margin: 0;
  color: #e8e8e8;
  line-height: 1.55;
}
.gift-reveal-button {
  display: inline-block;
  text-decoration: none;
  background: var(--orange);
  color: #fff;
  padding: 16px 28px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 1.05rem;
  box-shadow: 0 6px 0 #a74700;
  transition: transform 180ms ease, box-shadow 180ms ease;
  animation: giftButtonPulse 1.6s ease-in-out infinite;
}
.gift-reveal-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #a74700;
}
.gift-reveal-button:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #a74700;
}
@keyframes giftButtonPulse {
  0%, 100% { box-shadow: 0 6px 0 #a74700, 0 0 0 0 rgba(225, 106, 3, 0.6); }
  50%      { box-shadow: 0 6px 0 #a74700, 0 0 0 14px rgba(225, 106, 3, 0); }
}

/* --- Mobile tweaks --- */
@media (max-width: 680px) {
  .gift-wrap {
    padding: 22px 16px;
  }
  .gift-emoji {
    font-size: 5rem;
    width: 6.5rem;
    height: 6.5rem;
  }
  .gift-hint-label {
    font-size: 0.86rem;
    padding: 7px 14px;
  }
}

/* --- Respect reduced-motion preference --- */
@media (prefers-reduced-motion: reduce) {
  .gift-hint,
  .gift-emoji-icon,
  .gift-reveal-button {
    animation: none;
  }
}
