:root {
  --bg: #fbf4e8; --ink: #3b2a1e; --soft: #7a6552; --line: #e8cfa5; --card: #fffdf8;
  --acc: #e08a3c; --acc2: #c86a22; --ok: #2f8f4e; --okbg: #e6f5ea; --no: #b9b2a8; --nobg: #efebe6; --spot: #8a5a32;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background-color: var(--bg);
  background-image: radial-gradient(ellipse 7px 5px at 12px 12px, #f0dcbc 95%, transparent 100%),
    radial-gradient(ellipse 5px 4px at 38px 34px, #f0dcbc 95%, transparent 100%);
  background-size: 52px 48px;
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 20px;
  line-height: 1.45;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
h1 { font-size: 26px; margin: 0; line-height: 1.25; }
h2 { font-size: 21px; margin: 22px 0 8px; }
p { margin: 8px 0; }
.scr { max-width: 1060px; margin: 0 auto; padding: 10px 16px 16px; }
.card { background: var(--card); border: 3px solid var(--line); border-radius: 20px; }
.loading { text-align: center; padding: 60px 0; color: var(--soft); }
.lead { font-size: 22px; }
.sub { color: var(--soft); font-size: 17px; margin-top: 0; }

/* buttons */
.btn {
  border: 0; border-radius: 16px; padding: 12px 24px; min-height: 56px; cursor: pointer;
  background: #f3e3c8; color: var(--ink); font-weight: 700; font-size: 21px;
  box-shadow: 0 3px 0 #d9bf95; transition: transform .12s, box-shadow .12s, background .2s;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #d9bf95; }
.btn.go {
  background-color: var(--acc); color: #fff; box-shadow: 0 3px 0 var(--acc2);
  background-image: radial-gradient(ellipse 5px 4px at 10px 10px, rgba(138,90,50,.28) 95%, transparent 100%),
    radial-gradient(ellipse 4px 3px at 28px 26px, rgba(138,90,50,.28) 95%, transparent 100%);
  background-size: 36px 34px;
}
.btn.alt { background: #efe6da; box-shadow: 0 3px 0 #d6c8b4; }
.btn.big { font-size: 24px; padding: 14px 40px; min-height: 64px; }
.btn.small { min-height: 44px; padding: 6px 16px; font-size: 18px; }
.btn:focus-visible, .opt:focus-visible, .tab:focus-visible { outline: 3px solid #4a90c8; outline-offset: 2px; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; margin-bottom: 8px; }
.coins {
  display: inline-flex; align-items: center; gap: 8px; background: #fff6dc; border: 2px solid #f0d58a;
  border-radius: 999px; padding: 4px 16px 4px 12px; font-size: 22px; transition: transform .2s;
}
.coins.bump { transform: scale(1.15); }
.coin-i { width: 26px; height: 26px; display: block; flex: 0 0 auto; }
.dots { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.dots .d { width: 16px; height: 16px; border-radius: 50%; background: #eadfcd; border: 2px solid #dccbb0; }
.dots .d.done { background: var(--acc); border-color: var(--acc2); }
.dots .d.now { background: #fff; border-color: var(--acc); box-shadow: 0 0 0 3px #f8d9b6; }

/* riddle */
.s-riddle { display: flex; flex-direction: column; min-height: 100vh; }
.play { margin: auto 0; padding-bottom: 8px; }
.ask { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 14px; align-items: end; }
.cust { align-self: end; }
.cust .animal { width: 140px; height: 163px; display: block; }
.bubble {
  position: relative; background: #fff; border: 3px solid var(--line); border-radius: 22px; padding: 12px 20px 12px;
  min-width: 0;
}
.bubble::after {
  content: ""; position: absolute; right: -14px; bottom: 34px; width: 22px; height: 22px; background: #fff;
  border-right: 3px solid var(--line); border-bottom: 3px solid var(--line); transform: rotate(-45deg);
}
.who { font-size: 17px; color: var(--soft); }
.kind { font-weight: 700; color: var(--acc2); margin-inline-start: 6px; }
.prompt { font-size: 22px; font-weight: 600; margin: 6px 0 4px; overflow-wrap: anywhere; }
.prompt.t-analogy { font-size: 30px; text-align: center; margin: 8px 0; }
.colon { display: inline-block; margin: 0 .45em; color: var(--acc2); font-weight: 800; }
.sep { display: inline-block; margin: 0 .4em; color: var(--soft); }
.blank { display: inline-block; width: 3.2em; border-bottom: 3px solid var(--acc); margin: 0 .15em; vertical-align: -2px; }
.hint { font-size: 17px; color: var(--soft); margin: 2px 0 0; }
.shapes { display: flex; gap: 22px; justify-content: center; margin: 6px 0 2px; }
.fig { flex: 0 1 140px; min-width: 0; }
.fig svg { width: 100%; height: auto; display: block; }
.fig text { font-size: 17px; font-weight: 700; fill: var(--ink); font-family: "Segoe UI", Arial, sans-serif; }
.fig .q { fill: #d0463a; font-size: 22px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.opt {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; cursor: pointer;
  background: var(--card); border: 3px solid var(--line); border-radius: 16px; font-size: 22px; font-weight: 600;
  text-align: right; transition: background .2s, border-color .2s, transform .12s; min-width: 0;
}
.opt:hover:not(:disabled) { border-color: var(--acc); transform: translateY(-1px); }
.opt:disabled { cursor: default; }
.opt .lt {
  flex: 0 0 34px; height: 34px; border-radius: 50%; background: #f3e3c8; display: inline-flex;
  align-items: center; justify-content: center; font-size: 18px; font-weight: 700;
}
.opt .ot { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.opt.yes { background: var(--okbg); border-color: var(--ok); }
.opt.yes .lt { background: var(--ok); color: #fff; }
.opt.no { background: var(--nobg); border-color: var(--no); color: #8a8076; }
.opt:disabled:not(.yes):not(.no) { opacity: .75; }
.fb { min-height: 100px; margin-top: 12px; }
.fbin {
  display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-radius: 18px; border: 3px solid;
  animation: pop .25s ease-out;
}
.fbin.good { background: var(--okbg); border-color: #b9dfc4; }
.fbin.soft { background: #fff6dc; border-color: #f0d58a; }
.fbface { flex: 0 0 64px; }
.fbface svg { width: 64px; height: 72px; display: block; }
.fbtx { flex: 1 1 auto; min-width: 0; font-size: 20px; }
.fbtx .lbl { display: block; font-size: 16px; color: var(--soft); font-weight: 700; }
.gain { display: block; font-size: 16px; color: var(--acc2); font-weight: 700; }
.fbin .btn { flex: 0 0 auto; min-width: 120px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.fly {
  position: fixed; width: 28px; height: 28px; z-index: 50; pointer-events: none;
  transition: transform .8s cubic-bezier(.5, -.3, .6, 1), opacity .8s;
}
.fly .coin-i { width: 28px; height: 28px; }
.fly.go { transform: translate(var(--dx), var(--dy)) scale(.7); opacity: .4; }

/* hello, end */
.hello, .end { text-align: center; padding: 18px 20px 24px; max-width: 760px; margin: 10px auto; }
.cub { width: 64px; height: 72px; }
.cub.big { width: 170px; height: 187px; display: block; margin: 0 auto 6px; }
.cub.mid { width: 110px; height: 121px; display: block; margin: 0 auto; }
.names { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 14px; }
.names .btn { min-width: 140px; }
.hello .go, .end .go, .closed .go { margin-top: 14px; }
.big-line { font-size: 26px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px 0 2px; }
.big-line .coin-i { width: 32px; height: 32px; }

/* shop */
.scene { width: 100%; height: auto; display: block; border-radius: 14px; }
.closed { padding: 12px; text-align: center; max-width: 820px; margin: 0 auto; }
.closed .lead { margin: 10px 0 0; }
.shop { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.stage { padding: 10px; text-align: center; }
.stage .more { margin-top: 10px; }
.cat { padding: 10px 12px; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tab {
  flex: 1 1 0; min-width: 0; border: 0; border-radius: 12px; padding: 8px 6px; min-height: 48px; cursor: pointer;
  background: #f3e9da; font-size: 17px; font-weight: 700;
}
.tab.on { background: var(--acc); color: #fff; }
.items { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 14px; background: #fff; border: 2px solid #f0e3cf; }
.item.own { background: #f4faf5; border-color: #cfe8d6; }
.item .icon { flex: 0 0 64px; width: 64px; height: 52px; }
.iname { flex: 1 1 auto; min-width: 0; font-size: 19px; font-weight: 600; line-height: 1.25; }
.price { display: flex; align-items: center; gap: 4px; font-size: 16px; color: var(--soft); font-weight: 700; }
.price .coin-i { width: 18px; height: 18px; }
.have { color: var(--ok); font-weight: 700; font-size: 18px; padding: 0 8px; }
.miss { color: var(--soft); font-size: 16px; text-align: center; max-width: 92px; line-height: 1.2; }
.modal {
  position: fixed; inset: 0; background: rgba(59, 42, 30, .35); display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 40;
}
.modal[hidden] { display: none; }
.mbox { max-width: 460px; width: 100%; padding: 18px; text-align: center; }
.mbtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* parents */
.parents { padding: 16px 20px 22px; font-size: 18px; max-width: 860px; margin: 0 auto; }
.parents table { border-collapse: collapse; width: 100%; font-size: 17px; }
.parents th, .parents td { border-bottom: 1px solid #eadfcd; padding: 6px 8px; text-align: right; }
.parents th { background: #f6ecdc; }
.note { color: var(--soft); }
.warn { background: #fde4df; border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.wrongq { border: 2px solid #f0e3cf; border-radius: 12px; padding: 6px 12px; margin: 8px 0; background: #fff; }
.wrongq p { margin: 4px 0; }
.wq { font-weight: 600; }
.her { color: #8a8076; }
.ok { color: var(--ok); }
.shapes.sm .fig { flex-basis: 80px; }
.pbtns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* small heights: keep the riddle on one screen */
@media (max-height: 760px) and (min-width: 641px) {
  .cust .animal { width: 124px; height: 145px; }
  .ask { grid-template-columns: 124px minmax(0, 1fr); }
  .fig { flex-basis: 128px; }
  .opt { min-height: 58px; }
}

@media (max-height: 640px) and (min-width: 641px) {
  .scr { padding-top: 6px; padding-bottom: 8px; }
  .topbar { min-height: 44px; margin-bottom: 4px; }
  .cust .animal { width: 104px; height: 121px; }
  .ask { grid-template-columns: 104px minmax(0, 1fr); }
  .bubble { padding: 8px 18px; }
  .prompt { margin: 4px 0 2px; }
  .fig { flex-basis: 108px; }
  .opts { margin-top: 10px; gap: 10px; }
  .opt { min-height: 56px; padding: 6px 14px; }
  .fb { margin-top: 10px; min-height: 92px; }
}

/* phone */
@media (max-width: 640px) {
  .s-riddle { min-height: 0; }
  .play { margin: 0; }
  body { font-size: 18px; }
  .scr { padding: 8px 10px 14px; }
  h1 { font-size: 21px; }
  .topbar { flex-wrap: wrap; }
  .dots { gap: 4px; }
  .dots .d { width: 12px; height: 12px; }
  .ask { grid-template-columns: 64px minmax(0, 1fr); gap: 8px; }
  .cust .animal { width: 64px; height: 75px; }
  .bubble { padding: 10px 12px; }
  .bubble::after { right: -11px; bottom: 20px; width: 16px; height: 16px; }
  .prompt { font-size: 20px; }
  .prompt.t-analogy { font-size: 24px; }
  .shapes { gap: 8px; }
  .opts { grid-template-columns: 1fr; gap: 8px; }
  .opt { font-size: 20px; min-height: 56px; }
  .fbin { flex-wrap: wrap; }
  .fbface { display: none; }
  .fbin .btn { width: 100%; }
  .shop { grid-template-columns: minmax(0, 1fr); }
  .tab { font-size: 15px; }
  .names .btn { min-width: 0; flex: 1 1 40%; }
  .btn.big { padding: 12px 20px; }
}
