:root {
  --green: #8dc63f;
  --green-25: #e5f2d6;
  --orange: #FFB800;
  --orange-25: #fff4d6;
  --grey: #6C6F71;
  --grey-25: #e0e1e1;
  --bg: #eeeeee;
  --white: #ffffff;
  --black: #000000;
  --radius: 28px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--black);
  user-select: none;
}

.app {
  height: 100dvh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(20px, 4vw, 48px) 0;
  flex-shrink: 0;
}

.brand-logo {
  height: clamp(28px, 4vw, 40px);
  width: auto;
}

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

.progress .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--grey-25);
  transition: background .25s, transform .25s;
}

.progress .dot.done {
  background: var(--green);
}

.progress .dot.active {
  background: var(--orange);
  transform: scale(1.25);
}

main#screens {
  flex: 1;
  position: relative;
  min-height: 0;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px clamp(20px, 4vw, 60px);
  text-align: center;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity .25s ease, transform .25s ease;
}

.screen.active {
  display: flex;
  opacity: 1;
  transform: translateX(0);
}

h1 {
  font-size: clamp(28px, 4.2vw, 48px);
  line-height: 1.2;
  margin: 0 0 clamp(16px, 3vw, 36px);
  font-weight: 700;
}

.hint {
  margin: -8px 0 24px;
  color: var(--grey);
  font-size: clamp(15px, 1.6vw, 20px);
}

.grid {
  display: grid;
  gap: clamp(14px, 2vw, 28px);
  width: 100%;
  max-width: 1100px;
}

.grid-4 {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 760px) and (orientation: landscape) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.grid-3 {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 620px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.option-btn {
  background: var(--white);
  border: 3px solid var(--green-25);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 32px) 12px;
  min-height: clamp(120px, 16vw, 190px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 600;
  color: var(--black);
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}

.option-btn:active {
  transform: scale(.95);
  background: var(--green-25);
  border-color: var(--green);
}

.option-btn.selected {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}

.option-btn .emoji {
  font-size: clamp(38px, 5vw, 60px);
  line-height: 1;
}

.option-btn.logo-btn img {
  max-width: 78%;
  max-height: 56px;
  object-fit: contain;
}

.option-btn.logo-btn {
  min-height: clamp(110px, 14vw, 150px);
}

.skip-btn {
  margin-top: clamp(22px, 4vw, 40px);
  background: none;
  border: none;
  color: var(--grey);
  font-size: clamp(15px, 1.6vw, 19px);
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: underline;
}

.result-card {
  max-width: 640px;
}

.result-emoji {
  font-size: clamp(56px, 8vw, 96px);
  margin-bottom: 8px;
}

.result-card h1 {
  color: var(--black);
}

.result-card p {
  font-size: clamp(18px, 2.2vw, 26px);
  color: var(--grey);
  line-height: 1.5;
  margin: 0;
}

.restart-btn {
  margin-top: clamp(28px, 5vw, 48px);
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 16px 40px;
  font-size: clamp(16px, 1.8vw, 20px);
  font-weight: 700;
  cursor: pointer;
}

.restart-btn:active {
  transform: scale(.96);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.loading-overlay.visible {
  display: flex;
}

.spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 6px solid var(--green-25);
  border-top-color: var(--green);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes confetti-pop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.result-emoji {
  animation: confetti-pop .5s ease;
}
