/* Quick Maths — a wooden abacus rod for a clock, a chalk slate and four clay answer tiles. */
.vm-wrap {
  display: flex; flex-direction: column; gap: 12px;
  width: min(100%, 480px); height: 100%; max-height: 700px;
  padding: 8px 12px 8px; box-sizing: border-box; margin: 0 auto;
}

/* ---- the abacus clock ---- */
.vm-abacus {
  flex: none; direction: ltr; padding: 7px 12px; border-radius: 14px;
  background: linear-gradient(180deg, #C98A3C, #9A5A1E 55%, #7A4315);
  box-shadow: 0 4px 0 #4E2A0C, 0 10px 16px rgba(0, 0, 0, 0.38), inset 0 2px 0 rgba(255, 229, 170, 0.45);
}
.vm-rod {
  position: relative; height: 32px; border-radius: 8px;
  background:
    linear-gradient(180deg, transparent 14px, #F6E3B4 14px, #B9975A 18px, transparent 18px),
    #260813;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6);
}
.vm-bead {
  position: absolute; top: 3px; width: 6.1%; height: 26px; border-radius: 46%;
  background: radial-gradient(60% 45% at 38% 28%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 70%), var(--c);
  box-shadow: inset 0 -4px 5px rgba(38, 8, 19, 0.42), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.vm-bead.is-spent { filter: saturate(0.45) brightness(0.62); }
.vm-bead.is-moving { box-shadow: inset 0 -4px 5px rgba(38, 8, 19, 0.42), 0 0 8px var(--c); }

/* ---- the slate ---- */
.vm-slate {
  position: relative; flex: 1 1 auto; min-height: 150px; display: flex; flex-direction: column;
  padding: 10px 14px 20px; border-radius: 16px; box-sizing: border-box;
  color: #FFF4E0;
  background:
    radial-gradient(90% 70% at 30% 20%, rgba(255, 244, 224, 0.07), rgba(255, 244, 224, 0) 70%),
    radial-gradient(60% 50% at 80% 85%, rgba(255, 244, 224, 0.05), rgba(255, 244, 224, 0) 70%),
    #1D2B2C;
  border: 9px solid #9A5A1E;
  border-color: #C08638 #8A4D18 #74400F #A9692A;
  box-shadow: 0 6px 0 #4E2A0C, 0 14px 22px rgba(0, 0, 0, 0.42), inset 0 0 22px rgba(0, 0, 0, 0.55);
}
.vm-head { display: flex; align-items: center; gap: 8px; min-height: 24px; font-size: 0.82rem; font-weight: 700; }
.vm-lvl { flex: 1 1 auto; min-width: 0; color: #F4C430; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.vm-streak { display: flex; gap: 4px; direction: ltr; }
.vm-streak i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid rgba(255, 244, 224, 0.55); box-sizing: border-box; }
.vm-streak i.on { background: #FF9933; border-color: #FF9933; box-shadow: 0 0 6px rgba(255, 153, 51, 0.7); }
.vm-time { direction: ltr; font-variant-numeric: tabular-nums; font-size: 0.95rem; color: #FFF4E0; opacity: 0.9; }
.vm-slate.is-hurry .vm-time { color: #FF7FB8; }

.vm-body { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; min-height: 0; }
.vm-q {
  margin: 0; direction: ltr; unicode-bidi: isolate; font-family: var(--font-display);
  font-size: clamp(2.6rem, min(19vw, 12vh), 6rem); line-height: 1.05; letter-spacing: 0.02em;
  color: #FFF8EA; text-shadow: 0 0 1px #FFF8EA, 2px 2px 0 rgba(255, 244, 224, 0.14), -1px 0 0 rgba(255, 244, 224, 0.2);
}
.vm-tag {
  padding: 2px 12px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: #260813; background: #F4C430;
}
html[lang="ar"] .vm-tag { letter-spacing: 0; font-size: 0.8rem; }
.vm-tip { margin: 0; max-width: 30ch; font-size: clamp(0.98rem, 2.4vh + 0.3rem, 1.2rem); line-height: 1.4; color: #FFF4E0; }
.vm-ex {
  margin: 0; direction: ltr; unicode-bidi: isolate; font-family: var(--font-display);
  font-size: clamp(1.05rem, min(5.6vw, 3.6vh), 1.6rem); color: #8FE3E0;
  padding-top: 6px; border-top: 2px dashed rgba(255, 244, 224, 0.28);
}
.vm-slate.is-paused .vm-body { filter: blur(14px); }

/* chalk sticks resting on the ledge */
.vm-tray {
  position: absolute; left: 14px; right: 14px; bottom: 5px; height: 7px; direction: ltr; pointer-events: none;
  background:
    linear-gradient(#FFF4E0, #D9CDB4) 6% 0 / 34px 7px no-repeat,
    linear-gradient(#FF9FCB, #D81B78) 22% 0 / 22px 7px no-repeat,
    linear-gradient(#FFE27A, #F4C430) 92% 0 / 28px 7px no-repeat;
  border-radius: 3px; opacity: 0.9;
}
.vm-pop {
  position: absolute; top: 34px; right: 16px; direction: ltr; font-family: var(--font-display); font-size: 1.5rem;
  color: #9BE38A; opacity: 0; pointer-events: none;
}
.vm-pop.is-bad { color: #FF7FB8; }
.vm-pop.is-on { animation: vm-pop 0.8s ease-out; }
@keyframes vm-pop { 0% { opacity: 0; transform: translateY(8px) scale(0.8); } 20% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-16px); } }
.vm-in > * { animation: vm-in 0.2s ease-out; }
@keyframes vm-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }

/* ---- answers ---- */
.vm-answers { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; direction: ltr; }
.vm-ans, .vm-go {
  appearance: none; border: 0; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  min-height: clamp(54px, 10.5vh, 84px); border-radius: 18px 18px 14px 14px;
  font-family: var(--font-display); font-size: clamp(1.5rem, min(7.5vw, 5vh), 2.2rem); font-variant-numeric: tabular-nums;
  color: #260813; background: linear-gradient(180deg, #FFF8EA, #FFE4B0);
  box-shadow: 0 5px 0 #B0245A, 0 9px 14px rgba(0, 0, 0, 0.35), inset 0 0 0 2px rgba(255, 153, 51, 0.55);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.vm-ans:active, .vm-go:active { transform: translateY(4px); box-shadow: 0 1px 0 #B0245A, 0 3px 6px rgba(0, 0, 0, 0.35), inset 0 0 0 2px rgba(255, 153, 51, 0.55); }
.vm-ans:focus-visible, .vm-go:focus-visible { outline: 3px solid #1FA2A6; outline-offset: 2px; }
.vm-ans.is-right { color: #FFF4E0; background: linear-gradient(180deg, #56B863, #3F9B4B); box-shadow: 0 5px 0 #24632D, 0 9px 14px rgba(0, 0, 0, 0.35); }
.vm-ans.is-wrong { color: #FFF4E0; background: linear-gradient(180deg, #E8408F, #B0245A); box-shadow: 0 5px 0 #6E1238, 0 9px 14px rgba(0, 0, 0, 0.35); animation: vm-shake 0.3s; }
@keyframes vm-shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.vm-go { display: none; grid-column: 1 / -1; color: #260813; background: linear-gradient(180deg, #FFC766, #FF9933); box-shadow: 0 5px 0 #A8480E, 0 9px 14px rgba(0, 0, 0, 0.35); }
.vm-go:active { box-shadow: 0 1px 0 #A8480E, 0 3px 6px rgba(0, 0, 0, 0.35); }
.vm-answers.is-tip .vm-ans { visibility: hidden; }
.vm-answers.is-tip { position: relative; }
.vm-answers.is-tip .vm-go { display: block; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); }
.vm-answers.is-tip .vm-go:active { transform: translateY(calc(-50% + 4px)); }

/* short screens: tighten; landscape phones: slate and answers side by side */
@media (max-height: 600px) {
  .vm-wrap { gap: 8px; padding-top: 4px; }
  .vm-rod { height: 26px; } .vm-bead { height: 20px; }
  .vm-rod { background: linear-gradient(180deg, transparent 11px, #F6E3B4 11px, #B9975A 15px, transparent 15px), #260813; }
  .vm-slate { border-width: 7px; padding: 6px 12px 16px; min-height: 120px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .vm-wrap { display: grid; grid-template-columns: 1.15fr 1fr; grid-template-rows: auto 1fr; width: min(100%, 760px); gap: 8px 12px; }
  .vm-abacus { grid-column: 1 / -1; padding: 4px 10px; }
  .vm-answers { align-self: center; }
  .vm-ans, .vm-go { min-height: 46px; }
  .vm-tip { font-size: 0.9rem; } .vm-q { font-size: clamp(2rem, 14vh, 3.4rem); }
}
@media (prefers-reduced-motion: reduce) {
  .vm-in > *, .vm-ans.is-wrong { animation: none; }
  .vm-pop.is-on { animation-duration: 0.01s; }
}
