@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;600&display=swap');

:root {
  --radius-global: 8px;
  --layout-gap: 24px;
  --layout-gap-mobile: 18px;
  --header-pad-y: 12px;
  --header-pad-x: 16px;
  --text-sm: 14px;
  --text-md: 16px;
  --focus-ring: 0 0 0 2px rgba(16, 185, 129, 0.55);
}

*,
*::before,
*::after {
  border-radius: var(--radius-global) !important;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(circle at 10% 5%, rgba(16, 185, 129, 0.08), transparent 35%), #09090b;
}

.app-shell {
  width: 100%;
}

.max-w-2xl {
  max-width: 50rem !important;
}

.app-header {
  display: grid !important;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 12px;
  margin-bottom: var(--layout-gap) !important;
  padding: var(--header-pad-y) var(--header-pad-x) !important;
}

.app-title {
  margin: 0;
  text-align: center;
}

.header-tagline {
  position: static;
  justify-self: end;
  line-height: 1.2;
}

#intro > * + *,
#results > * + * {
  margin-top: var(--layout-gap) !important;
}

#quiz > * + * {
  margin-top: calc(var(--layout-gap) - 4px);
}

#quiz > .progress-track {
  margin-bottom: 0 !important;
}

.header-badge {
  position: static;
  display: flex;
  align-items: center;
}

button,
input,
select {
  box-sizing: border-box;
  height: 50px !important;
  min-height: 50px !important;
  max-height: 50px !important;
  border-radius: 8px !important;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: var(--text-md) !important;
  padding: 0 15px !important;
  padding-bottom: 0 !important;
}

input,
select {
  font-size: 14px !important;
  font-weight: 400 !important;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.heading {
  font-family: 'Space Grotesk', sans-serif;
}

.bg-orb {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 9999px;
  filter: blur(60px);
  opacity: 0.22;
  pointer-events: none;
}

.bg-orb-1 {
  top: -80px;
  right: -100px;
  background: #10b981;
}

.bg-orb-2 {
  bottom: -120px;
  left: -120px;
  background: #0ea5e9;
}

.glass-card {
  background: rgba(24, 24, 27, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.primary-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: none;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 160ms ease;
}

.primary-btn:hover {
  filter: brightness(1.05);
  box-shadow: none;
}

.primary-btn:active {
  transform: translateY(1px) scale(0.998);
}

.soft-btn {
  transition: border-color 120ms ease, background-color 120ms ease;
}

.soft-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgb(63 63 70);
  background: rgb(24 24 27 / 0.95);
  color: rgb(212 212 216);
  padding: 6px 12px;
  font-size: 0.875rem !important;
  line-height: 1;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.sound-toggle:hover {
  border-color: rgb(113 113 122);
}

.sound-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.sound-toggle-track {
  position: relative;
  width: 38px;
  height: 22px;
  background: rgb(63 63 70);
  border-radius: 9999px !important;
  transition: background-color 160ms ease;
}

.sound-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 9999px !important;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sound-toggle.is-on .sound-toggle-track {
  background: rgb(16 185 129);
}

.sound-toggle.is-on .sound-toggle-thumb {
  transform: translateX(16px);
}

.sound-toggle-label {
  min-width: 66px;
  text-align: left;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width 280ms ease;
}

.word-slot {
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.word-slot:focus-within {
  transform: translateY(-1px);
}

.word-slot.is-selected {
  border-color: rgba(16, 185, 129, 0.8);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.literal-translation {
  margin-top: 0 !important;
  text-align: center;
}

.question-german,
.question-prompt {
  margin-top: 15px !important;
}

.question-german,
.question-prompt {
  text-align: center;
}

.answer-chip {
  height: 50px;
  min-height: 50px;
  max-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm) !important;
}

.correct-idiom-text {
font-size: 20px !important;
    font-weight: 600 !important;
    text-align: center;
}

.correct-idiom-label {
  text-align: center;
}

.spectrum-track {
  position: relative;
  height: 14px;
  border-radius: 9999px;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 45%, #22c55e 100%);
}

.spectrum-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.02));
  transition: none;
}

.spectrum-marker {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 20px;
  height: 26px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background:
    radial-gradient(circle at 28% 26%, rgba(255, 255, 255, 0.95) 0 18%, rgba(255, 255, 255, 0) 38%),
    radial-gradient(circle at 72% 76%, rgba(0, 0, 0, 0.35) 0 20%, rgba(0, 0, 0, 0) 52%),
    linear-gradient(160deg, #f8fafc 0%, #cbd5e1 34%, #64748b 62%, #1f2937 100%);
  transform: translate(-50%, -50%);
  transition: none;
  z-index: 2;
}

.spectrum-marker::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 9999px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 45%),
    linear-gradient(170deg, rgba(71, 85, 105, 0.92), rgba(15, 23, 42, 0.96));
  box-shadow:
    0 1px 1px rgba(255, 255, 255, 0.22) inset,
    0 -2px 4px rgba(0, 0, 0, 0.35) inset;
}

.spectrum-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 5px;
  border-radius: 9999px;
  background: #f8fafc;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.45),
    0 0 8px rgba(255, 255, 255, 0.55);
}

#next-btn {
  position: relative;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

#next-btn.is-guided {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35);
}

.next-pointer {
  position: absolute;
  right: 10px;
  top: -14px;
  font-size: 18px;
  color: rgb(16 185 129);
  animation: pointer-nudge 1100ms ease-in-out infinite;
}

@keyframes pointer-nudge {
  0%, 100% {
    transform: translate(-8px, 8px) scale(1);
    opacity: 0.65;
  }
  50% {
    transform: translate(-2px, 2px) scale(1.08);
    opacity: 1;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background: rgba(24, 24, 27, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f4f4f5;
  padding: 10px 14px;
  border-radius: 9999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.friend-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.friend-modal.hidden {
  display: none;
}

.friend-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}

.friend-modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 540px);
  padding: 24px;
}

.friend-modal-card h3,
.friend-modal-card p {
  margin-bottom: 10px;
}

.score-points {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.12);
  color: rgb(110 231 183);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}

.review-correct {
  margin-top: 20px;
}

.correct-idiom-label {
  font-weight: 400 !important;
  margin-bottom: 10px;
}

.review-actions {
  margin-top: 20px !important;
}

.results-actions .primary-btn {
  white-space: normal;
  text-wrap: balance;
  line-height: 1.25;
}

@media (max-width: 1024px) {
  .app-shell {
    padding: 20px;
  }

  .intro-title {
    font-size: clamp(2rem, 5.6vw, 2.8rem) !important;
    line-height: 1.15;
  }

  #question-card {
    padding: clamp(20px, 3.5vw, 28px);
  }

  #question-card #dropdowns {
    justify-content: stretch;
  }

  #question-card .word-slot {
    flex: 1 1 180px;
    min-width: 170px;
  }

  .result-iq {
    font-size: clamp(4rem, 12vw, 6rem) !important;
    line-height: 1;
  }

  .results-actions {
    flex-wrap: wrap;
  }

  .results-actions button {
    min-width: 220px;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .app-header {
    padding: 14px 16px;
  }

  .app-title {
    font-size: 1.7rem;
    line-height: 1.2;
  }

  .header-tagline {
    font-size: 0.85rem;
  }

  #quiz > .flex.justify-between.items-center.mb-6 {
    gap: 12px;
    flex-wrap: wrap;
  }

  .results-actions {
    flex-direction: row;
  }

  .results-actions button {
    flex: 1 1 calc(50% - 8px);
    width: auto;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 16px;
  }

  .app-header {
    margin-bottom: var(--layout-gap-mobile) !important;
    padding: 10px 12px !important;
  }

  #intro > * + *,
  #results > * + * {
    margin-top: var(--layout-gap-mobile) !important;
  }

  #quiz > * + * {
    margin-top: 14px;
  }

  .app-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    row-gap: 8px;
    column-gap: 10px;
  }

  .header-badge,
  .header-tagline {
    position: static;
  }

  .header-badge {
    grid-column: 1 / -1;
    justify-self: center;
    justify-content: center;
  }

  .app-title {
    grid-column: 1;
    margin: 0;
    text-align: left;
    font-size: 1.2rem;
    line-height: 1.15;
  }

  .header-tagline {
    grid-column: 2;
    width: 100%;
    text-align: right;
    font-size: 0.72rem;
    letter-spacing: 0.01em;
    color: rgb(110 231 183 / 0.9);
  }

  .intro-title {
    font-size: 2rem !important;
    line-height: 1.15;
  }

  #question-card {
    padding: 20px;
  }

  #question-card #dropdowns {
    gap: 8px;
  }

  #question-card .word-slot {
    width: 100%;
  }

  #question-card .word-slot select {
    width: 100%;
    text-align: center;
    font-size: 1rem !important;
    padding: 0 14px !important;
  }

  #question-card #submit-btn {
    font-size: 1.05rem !important;
  }

  .score-points {
    font-size: var(--text-sm) !important;
    padding: 0 12px;
  }

  .result-iq {
    font-size: 4rem !important;
    line-height: 1;
  }

  .results-table-wrap {
    overflow-x: auto;
  }

  .results-actions {
    flex-direction: column;
  }

  .results-actions button {
    width: 100%;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: 14px;
    transform: translateY(16px);
    text-align: center;
  }

  .toast.is-visible {
    transform: translateY(0);
  }

  .heading {
    letter-spacing: -0.01em;
  }
}
