/* Cali Balances the Seesaw. Colours are the site's own (styles.css --m10-* tokens), as in the other Cali games. */
:root {
	--sw-ink: #1a1a1a;
	--sw-muted: #444746;
	--sw-edge: #b9c0c7;
	--sw-band: #d8e6fc;
	--sw-band-soft: #eef4fc;
	--sw-panel: #caddf6;
	--sw-orange: #ee6600;
	--sw-orange-hover: #ff7a1a;
	--sw-orange-text: #9a4200;
	--sw-orange-soft: #fff1e6;
	--sw-blue: #006699;
	--sw-blue-strong: #004d73;
	--sw-blue-soft: #e6f0f8;
	--sw-lime: #b2df5d;
	--sw-lime-soft: #edf8da;
	--sw-good: #3f7d16;
	--sw-good-text: #2e5e12;
	--sw-bad: #b3261e;
	--sw-wood: #dba463;
	--sw-wood-dark: #8f6230;
	--sw-brown: #3b2a1a;
	--sw-chip: #1f2a37;
	--sw-font: Onest, Verdana, system-ui, -apple-system, "Segoe UI", sans-serif;
	--sw-digits: Arial, "Helvetica Neue", Helvetica, "Liberation Sans", Roboto, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #fff; color: var(--sw-ink); font: 16px/1.4 var(--sw-font); }
*, *::before, *::after { box-sizing: border-box; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sw-app { position: relative; max-width: 1040px; margin: 0 auto; padding: 0 0 8px; }
.sw-app :focus-visible { outline: 3px solid var(--sw-orange); outline-offset: 2px; }
.sw-main { outline: none; }
.sw-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------- header band ---------- */
.sw-top { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 52px; padding: 4px 6px; border-radius: 12px; background: var(--sw-band); }
.sw-title { flex: 1 1 0; min-width: 0; padding-left: 10px; font-weight: 700; font-size: 18px; line-height: 1.2; }
.sw-back:not([hidden]) + .sw-title { padding-left: 2px; }
.sw-stats { order: 3; flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 0 6px 4px; font-size: 16px; }
.sw-stats:empty { display: none; }
.sw-sound { order: 2; }
.sw-iconbtn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--sw-blue); }
.sw-iconbtn:hover { background: var(--sw-panel); }
.sw-iconbtn svg { width: 26px; height: 26px; }
.sw-where { font-weight: 600; }
.sw-score { position: relative; }
.sw-score b { font-family: var(--sw-digits); font-size: 18px; }
.sw-float { position: absolute; left: 100%; top: -6px; margin-left: 6px; color: var(--sw-good-text); font-weight: 700; font-size: 18px; animation: sw-float 1s ease-out forwards; }
@keyframes sw-float { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-22px); } }
.sw-dots { display: inline-flex; gap: 5px; }
.sw-dot { width: 13px; height: 13px; border: 2px solid var(--sw-edge); border-radius: 50%; background: #fff; }
.sw-dot.is-now { border-color: var(--sw-orange); background: var(--sw-orange); }
.sw-dot.is-p2 { border-color: var(--sw-good); background: var(--sw-good); }
.sw-dot.is-p1 { border-color: var(--sw-good); background: var(--sw-lime); }
.sw-dot.is-p0 { border-color: #7d838a; background: #c9ced4; }
/* on a phone a challenge's header is one band: back, "Level 2 · Challenge 3 / 6", score, sound */
@media (max-width: 699px) {
	.sw-app[data-screen="play"] .sw-title, .sw-app[data-screen="done"] .sw-title { display: none; }
	.sw-app[data-screen="play"] .sw-stats, .sw-app[data-screen="done"] .sw-stats { order: 1; flex: 1 1 0; min-width: 0; padding: 2px 4px; gap: 0 12px; line-height: 1.3; }
}
@media (min-width: 700px) {
	/* one line: a long title is cut with an ellipsis before the sound button would wrap */
	.sw-top { flex-wrap: nowrap; }
	.sw-title { flex: 1 1 auto; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.sw-stats { order: 1; flex: 0 0 auto; flex-wrap: nowrap; padding: 0 4px; white-space: nowrap; }
}

/* ---------- buttons, switches ---------- */
.sw-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 9px 22px; border: 2px solid transparent; border-radius: 10px; font-weight: 600; font-size: 17px; line-height: 1.2; touch-action: manipulation; }
.sw-primary { background: var(--sw-orange); color: var(--sw-ink); }
.sw-primary:hover { background: var(--sw-orange-hover); }
.sw-btn-quiet { background: #fff; border-color: var(--sw-blue); color: var(--sw-blue); }
.sw-btn-quiet:hover { background: var(--sw-blue-soft); }
.sw-btn.is-off { border-color: var(--sw-edge); background: #f1f3f5; color: #5a6067; cursor: default; }
.sw-btn.sw-small { min-height: 46px; padding: 6px 14px; font-size: 16px; }
.sw-btn.is-calling { animation: sw-call 1.3s ease-in-out infinite; }
@keyframes sw-call { 0%, 100% { box-shadow: 0 0 0 0 rgba(238, 102, 0, .55); } 50% { box-shadow: 0 0 0 9px rgba(238, 102, 0, 0); } }
.sw-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.sw-switches { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 18px; }
.sw-switch { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; font-size: 16px; line-height: 1.2; cursor: pointer; }
.sw-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw-switch-ui { position: relative; flex: none; width: 48px; height: 28px; border-radius: 999px; background: #7d838a; transition: background-color .15s; }
.sw-switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.sw-switch input:checked + .sw-switch-ui { background: var(--sw-blue); }
.sw-switch input:checked + .sw-switch-ui::after { transform: translateX(20px); }
.sw-switch input:focus-visible + .sw-switch-ui { outline: 3px solid var(--sw-orange); outline-offset: 2px; }

/* ---------- level select ---------- */
.sw-levels-head { display: flex; align-items: center; gap: 14px; padding: 10px 6px 0; }
.sw-levels-head .sw-cali-big { width: 76px; }
.sw-cali-big { width: 140px; }
.sw-cali-big svg { display: block; width: 100%; height: auto; }
.sw-total { font-weight: 700; font-size: 20px; }
.sw-total-star { margin-right: 6px; color: #e8a200; font-size: 24px; }
.sw-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px 0 4px; }
@media (min-width: 760px) { .sw-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sw-tile { display: grid; justify-items: center; align-content: start; gap: 4px; min-height: 132px; padding: 14px 8px 12px; border: 2px solid var(--sw-band); border-radius: 14px; background: #fff; text-align: center; }
.sw-tile:hover { border-color: var(--sw-blue); background: var(--sw-blue-soft); }
.sw-tile-n { color: var(--sw-blue-strong); font-weight: 700; font-size: 20px; }
.sw-tile-d { min-height: 2.6em; font-size: 16px; line-height: 1.3; }
.sw-stars { display: inline-flex; gap: 2px; font-size: 24px; line-height: 1; }
.sw-stars .on { color: #e8a200; }
.sw-stars .off { color: #d5dbe2; }
.sw-stars.is-big { font-size: 46px; }

/* ---------- a challenge ---------- */
.sw-play { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 8px; }
@media (min-width: 700px) { .sw-play { gap: 10px; margin-top: 10px; } }

/* Cali and her bubble */
.sw-cali { display: flex; align-items: center; gap: 12px; }
.sw-cali-pic { flex: none; width: 48px; }
.sw-cali-pic svg { display: block; width: 100%; height: auto; }
.sw-bubble { position: relative; flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 8px 12px; border: 2px solid var(--sw-panel); border-radius: 14px; background: var(--sw-band-soft); font-weight: 600; font-size: 17px; line-height: 1.4; }
.sw-bubble::before { content: ""; position: absolute; left: -8px; top: 50%; width: 13px; height: 13px; margin-top: -7px; border: solid var(--sw-panel); border-width: 0 0 2px 2px; background: inherit; transform: rotate(45deg); }
.sw-bubble.is-good { border-color: var(--sw-good); background: var(--sw-lime-soft); color: var(--sw-good-text); }
.sw-bubble.is-good::before { border-color: var(--sw-good); }
.sw-bubble-note { margin-top: 2px; color: var(--sw-muted); font-weight: 600; font-size: 16px; }
@media (min-width: 700px) {
	.sw-cali-pic { width: 64px; }
	.sw-bubble { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 18px; min-height: 58px; padding: 8px 16px; font-size: 19px; }
	.sw-bubble-note { margin: 0; }
}

/* ---------- the scene ---------- */
.sw-scene { position: relative; width: 100%; min-width: 0; line-height: 0; -webkit-user-select: none; user-select: none; }
.sw-svg { display: block; margin: 0 auto; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.sw-sky { fill: #eef6fd; }
.sw-cloud ellipse { fill: #fff; }
.sw-ground { fill: #e6f4d3; }
.sw-ground-line { fill: none; stroke: #8cc63f; stroke-width: 3; }
.sw-ruler { fill: none; stroke: #5a6067; stroke-width: 1.5; }
.sw-ruler-t { fill: var(--sw-muted); font: 600 14px var(--sw-digits); }
.sw-supports > g { transition: transform .2s ease-in; }
.sw-supports.is-out > g { transform: translateY(var(--sw-drop, 100px)); }
.sw-post { fill: var(--sw-orange); stroke: var(--sw-orange-text); stroke-width: 1.5; }
.sw-post-cap { fill: var(--sw-orange-text); }
.sw-pivot-body { fill: var(--sw-blue); stroke: var(--sw-blue-strong); stroke-width: 2; stroke-linejoin: round; }
.sw-tube { fill: #f4f8fb; stroke: #20262c; stroke-width: 1.5; }
.sw-tube-marks { fill: none; stroke: #20262c; stroke-width: 1; }
.sw-bubble.is-level, circle.sw-bubble { stroke-width: 1.5; }
circle.sw-bubble { fill: #ffd24a; stroke: #8a6200; }
circle.sw-bubble.is-level { fill: #6fcf3a; stroke: var(--sw-good-text); }
.sw-wood { fill: var(--sw-wood); stroke: var(--sw-wood-dark); stroke-width: 2; }
.sw-wood-edge { fill: #b98342; }
.sw-ticks { fill: none; stroke: var(--sw-brown); stroke-width: 2; }
.sw-centre { fill: var(--sw-brown); }
.sw-mark-t { fill: var(--sw-brown); font: 700 16px var(--sw-digits); }
.sw-hit { fill: transparent; pointer-events: all; }
.sw-fig { pointer-events: none; }
.sw-obj { outline: none; }
.sw-obj.is-movable { cursor: grab; touch-action: none; }
.sw-obj:focus-visible .sw-hit { stroke: var(--sw-orange); stroke-width: 3; rx: 6px; }
.sw-chip { pointer-events: none; }
.sw-chip-bg { fill: var(--sw-chip); }
.sw-chip-t { fill: #fff; font: 700 16px var(--sw-digits); }
.sw-badge { fill: #fff; }
.sw-badge-t { fill: var(--sw-chip); font: 700 14px var(--sw-digits); }
.sw-slot { fill: var(--sw-orange); filter: drop-shadow(0 0 5px var(--sw-orange)); pointer-events: none; }
.sw-slot.is-soft { opacity: .6; filter: none; }
.sw-slot.is-bad { fill: var(--sw-bad); filter: none; }
.sw-cursor { fill: rgba(0, 102, 153, .08); stroke: var(--sw-blue-strong); stroke-width: 3; stroke-dasharray: 7 4; pointer-events: none; }
.sw-cursor.is-bad { fill: rgba(179, 38, 30, .08); stroke: var(--sw-bad); }
.sw-cursor-layer { pointer-events: none; }
.sw-arrows { pointer-events: none; }
.sw-arrow { fill: none; stroke: var(--sw-blue-strong); }
.sw-arrow-head { fill: var(--sw-blue-strong); }
.sw-word { pointer-events: none; }
.sw-word-t { fill: var(--sw-good-text); font: 700 20px var(--sw-font); }
.sw-word-bg { fill: var(--sw-lime-soft); stroke: var(--sw-good); stroke-width: 2; }

/* an object in the air */
.sw-ghost { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; line-height: 0; filter: drop-shadow(0 6px 8px rgba(26, 31, 39, .3)); }
.sw-ghost svg { display: block; }
.sw-ghost.is-bad svg { outline: 3px solid var(--sw-bad); outline-offset: 2px; border-radius: 8px; }

/* ---------- feedback ---------- */
.sw-fb { min-height: 46px; padding: 8px 14px; border: 2px solid transparent; border-radius: 12px; font-size: 17px; line-height: 1.4; text-align: center; }
.sw-fb p { margin: 0; }
.sw-fb-msg { font-weight: 600; }
.sw-fb-calc { margin-top: 2px !important; font: 700 19px/1.4 var(--sw-digits); }
.sw-fb.is-good .sw-fb-msg { font: 700 19px/1.4 var(--sw-digits); }
.sw-fb.is-predict-good .sw-fb-msg { font-family: var(--sw-font); }
.sw-fb.is-bad { border-color: var(--sw-blue); background: var(--sw-blue-soft); color: var(--sw-blue-strong); }
.sw-fb.is-note { border-color: var(--sw-orange); background: var(--sw-orange-soft); color: var(--sw-orange-text); }
.sw-fb.is-good { border-color: var(--sw-good); background: var(--sw-lime-soft); color: var(--sw-good-text); }

/* ---------- the shelf, the answer, the buttons ---------- */
.sw-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px; }
.sw-shelf { display: flex; align-items: center; gap: 10px; min-height: 84px; padding: 6px 12px; border: 2px solid var(--sw-panel); border-radius: 14px; background: var(--sw-band-soft); }
.sw-shelf-t { font-weight: 700; font-size: 16px; }
.sw-shelf-items { display: flex; align-items: flex-end; gap: 8px; }
.sw-piece { display: grid; justify-items: center; align-content: end; gap: 2px; min-width: 76px; min-height: 68px; padding: 6px 10px 4px; border: 2px solid var(--sw-edge); border-radius: 12px; background: #fff; cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.sw-piece:hover { border-color: var(--sw-blue); }
.sw-piece.is-picked { border-color: var(--sw-orange); box-shadow: 0 0 0 3px var(--sw-orange); }
.sw-piece.is-empty { cursor: default; border-style: dashed; }
.sw-piece.is-empty .sw-piece-pic { opacity: .22; }
.sw-piece-pic { display: block; line-height: 0; pointer-events: none; }
.sw-piece-t { font: 700 16px/1.2 var(--sw-digits); white-space: nowrap; pointer-events: none; }
.sw-piece-n { margin-left: 6px; color: var(--sw-blue-strong); font-size: 18px; }

.sw-answer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; padding: 6px 12px; border: 2px solid var(--sw-band); border-radius: 12px; background: var(--sw-band-soft); font-weight: 700; font-size: 18px; }
.sw-answer-in { width: 88px; min-height: 46px; padding: 2px 8px; border: 2px solid var(--sw-blue); border-radius: 8px; background: #fff; font: 700 26px/36px var(--sw-digits); text-align: center; }
.sw-answer-box { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.sw-answer-u { font-weight: 600; font-size: 18px; }
.sw-answer.is-bad .sw-answer-in { border-color: var(--sw-blue-strong); background: var(--sw-blue-soft); color: #5a6067; text-decoration: line-through; }
.sw-answer.is-shown .sw-answer-in { border-color: var(--sw-blue-strong); background: var(--sw-blue-soft); color: var(--sw-blue-strong); }
.sw-answer.is-good .sw-answer-in { border-color: var(--sw-good); background: var(--sw-lime-soft); color: var(--sw-good-text); }

/* level 4: the three answers */
.sw-options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; width: 100%; }
@media (min-width: 700px) { .sw-options { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sw-option { justify-content: flex-start; gap: 10px; min-height: 52px; padding: 8px 12px; border-color: var(--sw-blue); background: #fff; color: var(--sw-blue-strong); text-align: left; }
.sw-option:hover { background: var(--sw-blue-soft); }
.sw-option-k { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--sw-band); color: var(--sw-ink); font: 700 16px var(--sw-digits); }
.sw-option-t { flex: 1 1 auto; }
.sw-option-m { flex: none; font-size: 22px; line-height: 1; }
.sw-option[aria-disabled="true"] { cursor: default; }
.sw-option.is-right { border-color: var(--sw-good); background: var(--sw-lime-soft); color: var(--sw-good-text); }
.sw-option.is-wrong { border-color: #5a6067; background: #f1f3f5; color: #3d4248; }
.sw-option.is-dim { border-color: var(--sw-edge); background: #fff; color: #5a6067; }

/* ---------- the "leave this level?" question ---------- */
.sw-overlay { position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 64px 12px 12px; background: rgba(255, 255, 255, .8); }
.sw-dialog { max-width: 460px; padding: 16px 20px; border: 2px solid var(--sw-blue); border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgba(26, 31, 39, .18); }
.sw-dialog p { margin: 0 0 10px; font-weight: 600; font-size: 18px; }

/* ---------- level complete ---------- */
.sw-done { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 28px; padding: 18px 8px 8px; }
.sw-done-body { display: grid; justify-items: start; gap: 10px; max-width: 480px; }
.sw-done-body .sw-actions { justify-content: flex-start; margin-top: 4px; }
.sw-screen-t { font-weight: 700; font-size: 24px; line-height: 1.2; }
.sw-done-score { font-size: 19px; }
.sw-done-score b { font-family: var(--sw-digits); font-size: 22px; }
.sw-newrec { padding: 4px 12px; border-radius: 999px; background: var(--sw-lime); color: var(--sw-ink); font-weight: 700; font-size: 17px; }

@media (prefers-reduced-motion: reduce) {
	.sw-supports > g, .sw-switch-ui, .sw-switch-ui::after { transition: none; }
	.sw-btn.is-calling, .sw-float { animation: none; }
}

/* ---------- the moving arrow that shows a newcomer what to do (it takes no clicks) ---------- */
.sw-play { position: relative; }
.sw-guide { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; line-height: 0; }
.sw-guide svg { display: block; overflow: visible; }
.sw-guide-line { fill: none; stroke: var(--sw-orange); stroke-width: 4; stroke-dasharray: 2 10; stroke-linecap: round; opacity: .8; }
.sw-guide-dot { fill: none; stroke: var(--sw-orange); stroke-width: 3; }
.sw-guide-arrow { fill: var(--sw-orange); stroke: #fff; stroke-width: 3; stroke-linejoin: round; paint-order: stroke; filter: drop-shadow(0 2px 3px rgba(26, 31, 39, .35)); }
.sw-guide-nod { animation: sw-nod .9s ease-in-out infinite; }
.sw-guide-target { border-radius: 10px; outline: 3px solid var(--sw-orange); outline-offset: 3px; animation: sw-call 1.3s ease-in-out infinite; }
@keyframes sw-nod { 0%, 100% { transform: translateX(-12px); } 50% { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) {
	.sw-guide-nod { animation: none; }
	.sw-guide-target { animation: none; }
}
