:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
  color: #2e292b;
  background: #fcf9f5;
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body { min-height: 100svh; }

button { font: inherit; cursor: pointer; }

button:focus-visible, a:focus-visible {
  outline: 3px solid #8066a8;
  outline-offset: 4px;
}

.app-shell {
  min-height: 100svh;
  max-width: 1100px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

.topbar { display: flex; justify-content: space-between; align-items: center; height: 46px; }

.brand { color: #393034; font-size: 24px; font-weight: 800; letter-spacing: -.075em; text-decoration: none; }
.brand-mark { font-size: 21px; font-weight: 500; color: #d7838d; letter-spacing: normal; margin-right: 3px; }
.brand-dot { color: #db929b; }

.sound-button { width: 44px; height: 44px; display: grid; place-items: center; background: #fff; color: #6b5c62; border: 1px solid #eee5e1; border-radius: 50%; }
.sound-button svg { width: 23px; height: 23px; }
.sound-button svg[hidden] { display: none; }

.game { width: 100%; max-width: 860px; flex: 1; margin: auto; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 18px 0 14px; }

.eyebrow { color: #b18d91; font-size: 10px; letter-spacing: .19em; font-weight: 850; text-align: center; }
.sparkle { font-size: 16px; vertical-align: -1px; margin-right: 4px; color: #d69d79; }

.question { text-align: center; margin: 17px 0 0; font-size: clamp(29px, 5vw, 48px); line-height: 1.17; letter-spacing: -.055em; font-weight: 800; text-wrap: balance; }
.question .animal-name { color: #c87886; }
.subtext { margin: 9px 0 0; color: #a39799; text-align: center; font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: clamp(12px, 3vw, 24px); margin-top: clamp(30px, 4vh, 45px); }

.animal-card {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  height: clamp(200px, 46vw, 354px);
  border: 3px solid #eee8e2;
  border-radius: clamp(22px, 4vw, 34px);
  background: #fff;
  box-shadow: 0 14px 35px rgba(104, 74, 69, .035);
  padding: clamp(14px, 4.3vw, 46px);
  touch-action: manipulation;
  transition: border-color 170ms ease, background 170ms ease, transform 170ms ease, box-shadow 170ms ease;
  -webkit-user-select: none;
  user-select: none;
}

.animal-card:disabled { cursor: default; }
.animal-card:not(:disabled):active { transform: scale(.97); }
.animal-card img { width: 100%; height: 100%; max-height: 245px; max-width: 245px; display: block; object-fit: contain; pointer-events: none; }
.animal-card.correct { border-color: #61b489; background: #e9f7ec; box-shadow: 0 10px 28px rgba(43, 131, 88, .09); }
.animal-card.wrong { border-color: #df7b7e; background: #fff0ef; box-shadow: 0 10px 28px rgba(173, 68, 74, .07); }

.card-label { position: absolute; bottom: 12px; left: 8px; right: 8px; text-align: center; font-weight: 750; font-size: clamp(14px, 3.3vw, 21px); letter-spacing: -.035em; opacity: 0; transform: translateY(4px); transition: opacity 170ms ease, transform 170ms ease; }
.correct .card-label, .wrong .card-label { opacity: 1; transform: translateY(0); }
.correct .card-label { color: #22774f; }
.wrong .card-label { color: #ac545b; }
.card-indicator { position: absolute; top: 13px; right: 13px; width: 30px; height: 30px; border-radius: 50%; display: none; place-items: center; font-size: 19px; font-weight: 850; }
.correct .card-indicator { display: grid; background: #60b586; color: white; }
.correct .card-indicator::after { content: '✓'; }
.wrong .card-indicator { display: grid; background: #de7c7c; color: white; }
.wrong .card-indicator::after { content: '×'; }

.response-space { min-height: 46px; display: grid; place-items: center; padding-top: 10px; }
.response { font-size: clamp(16px, 2.7vw, 20px); font-weight: 650; color: #94858a; letter-spacing: -.02em; margin: 0; text-align: center; }
.response.success { color: #288358; }
.response.gently-corrected { color: #aa6168; }
.actions { height: 42px; display: grid; place-items: center; }
.text-button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; background: transparent; border: 0; color: #8b7e85; font-size: 13px; font-weight: 600; border-radius: 13px; }
.text-button svg { width: 17px; height: 17px; }
.text-button:disabled { opacity: .5; }

.bottom-bar { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 16px; }
.mode-switch { display: inline-flex; background: #f3eeeb; padding: 4px; border-radius: 16px; gap: 3px; }
.mode-button { border: none; color: #93888b; background: transparent; font-size: 12px; font-weight: 720; padding: 12px 15px; border-radius: 12px; white-space: nowrap; }
.mode-button.active { background: white; color: #5a4c53; box-shadow: 0 2px 8px rgba(60, 39, 30, .05); }
.credit { font-size: 10px; text-decoration: none; color: #b9b0ad; line-height: 1.25; text-align: center; }

.welcome-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(252, 249, 245, .93); backdrop-filter: blur(12px); }
.welcome-backdrop[hidden] { display: none; }
.welcome-card { width: min(100%, 435px); text-align: center; background: #fff; border: 1px solid #f0e7e4; border-radius: 34px; padding: 38px 26px 30px; box-shadow: 0 22px 80px rgba(75, 45, 45, .08); }
.welcome-animals { display: flex; justify-content: center; gap: 7px; margin: 0 auto 26px; }
.welcome-animals span { background: #faf1ed; border-radius: 20px; width: 78px; height: 78px; display: grid; place-items: center; font-size: 42px; }
.welcome-animals span:nth-child(2) { background: #f4ecef; transform: translateY(-10px); }
.welcome-card h2 { font-size: 32px; letter-spacing: -.065em; line-height: 1.15; margin: 12px 0; }
.welcome-card p { color: #968b91; line-height: 1.55; font-size: 14px; margin: 0 0 25px; }
.start-button { width: 100%; min-height: 60px; background: #d98695; border: none; border-radius: 18px; color: #fff; font-size: 17px; font-weight: 780; display: flex; align-items: center; justify-content: center; gap: 8px; }
.start-button:active { transform: scale(.985); }
.welcome-card .welcome-footnote { margin: 16px 0 0; font-size: 11px; }

@media (min-width: 760px) {
  .app-shell { padding-left: 36px; padding-right: 36px; }
  .cards { max-width: 790px; }
  .animal-card { height: min(36vh, 345px); min-height: 270px; }
}

@media (max-width: 430px) {
  .question { font-size: clamp(30px, 8vw, 37px); }
  .cards { gap: 12px; }
  .animal-card { height: clamp(194px, 58vw, 280px); padding: 12px; border-width: 3px; }
  .animal-card img { padding-bottom: 14px; }
  .card-indicator { top: 9px; right: 9px; width: 25px; height: 25px; font-size: 16px; }
  .card-label { bottom: 10px; }
}

@media (max-height: 720px) {
  .game { padding: 10px 0; }
  .question { margin-top: 9px; }
  .cards { margin-top: 17px; }
  .animal-card { height: clamp(170px, 38vh, 270px); }
  .response-space { min-height: 38px; }
  .bottom-bar { padding-top: 5px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
