/* Array Workshop (teddy/arrays.html) — 390px-first */
.aw-app { max-width: 620px; padding-bottom: calc(40px + var(--safe-b)); }
.aw-page .app::before { display: none; }
.aw-sound-tip { text-align: center; font-size: 13px; color: var(--ink-soft); margin: 0 16px 80px; }
.aw-page button, .aw-tray { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.aw-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.aw-top .back-link { margin: 0; }
.aw-title { font-weight: 900; font-size: 16px; white-space: nowrap; }
.aw-title small { color: #fde047; font-weight: 800; }
.aw-stars { margin-left: auto; color: #fde047; font-weight: 900; text-shadow: 0 0 10px rgba(253, 224, 71, .6); }
.aw-stars.bump { animation: aw-bump .4s; }
@keyframes aw-bump { 50% { transform: scale(1.35); } }
.mute-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: rgba(20, 31, 69, .85); font-size: 20px; flex: none; }

.aw-rail { display: flex; align-items: center; margin: 0 0 14px; padding: 8px 6px; border-radius: 18px; background: rgba(7, 13, 34, .6); border: 1px solid var(--line); }
.aw-node { display: grid; justify-items: center; gap: 2px; text-decoration: none; min-width: 44px; }
.aw-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; background: rgba(20, 31, 69, .95); border: 2px solid rgba(165, 243, 252, .25); }
.aw-lab { font-size: 10px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }
.aw-node.done .aw-dot { border-color: #34d399; background: rgba(52, 211, 153, .2); }
.aw-node.on .aw-dot { border-color: #fb923c; box-shadow: 0 0 0 3px rgba(251, 146, 60, .35), 0 0 16px rgba(251, 146, 60, .5); }
.aw-node.on .aw-lab { color: #fed7aa; }
.aw-link { flex: 1; height: 3px; min-width: 4px; margin-bottom: 14px; background: rgba(165, 243, 252, .2); border-radius: 2px; }

.aw-step { display: grid; gap: 12px; }
.aw-kicker { margin: 0; font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: #fde047; }
.aw-h { margin: -6px 0 0; font-size: clamp(24px, 7vw, 32px); line-height: 1.08; font-weight: 900; letter-spacing: -.01em; }
.aw-fast { justify-self: start; min-height: 40px; padding: 6px 12px; border-radius: 99px; border: 1px solid rgba(253, 224, 71, .45); background: rgba(253, 224, 71, .08); color: #fde68a; font-weight: 800; font-size: 13px; }

.aw-bubble { display: grid; grid-template-columns: 40px 1fr 44px; gap: 8px; align-items: start; padding: 12px; border-radius: 20px;
  background: linear-gradient(140deg, rgba(251, 146, 60, .16), rgba(20, 31, 69, .9)); border: 1px solid rgba(251, 146, 60, .35); }
.aw-chef { font-size: 32px; line-height: 1; animation: aw-bob 3s ease-in-out infinite; }
@keyframes aw-bob { 50% { transform: translateY(-4px) rotate(-6deg); } }
.aw-bubble p { margin: 0; font-size: 15px; color: #fff7ed; }
.aw-replay { width: 44px; height: 44px; border-radius: 14px; border: 1px solid rgba(34, 211, 238, .55); background: transparent; font-size: 18px; }
.aw-replay.inline { width: 40px; height: 40px; vertical-align: middle; }

.aw-card { display: grid; gap: 10px; padding: 14px 10px; border-radius: 24px; background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow); }
.aw-job { margin: 0 4px; font-size: 16px; line-height: 1.35; }
.aw-fighost { display: grid; justify-items: center; min-height: 60px; }
.aw-ctl { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.aw-mini { min-height: 44px; min-width: 64px; padding: 6px 10px; border-radius: 12px; border: 2px solid rgba(34, 211, 238, .6); background: transparent; color: #a5f3fc; font-weight: 800; font-size: 14px; }
.aw-act { min-height: 48px; padding: 8px 16px; border-radius: 14px; border: 2px solid #22d3ee; background: rgba(34, 211, 238, .1); color: #cffafe; font-weight: 900; font-size: 16px; }
.aw-act:active, .aw-mini:active { transform: scale(.96); }
.aw-win { margin: 0; width: 100%; text-align: center; font-size: 19px; font-weight: 900; color: #6ee7b7; }
.aw-hint { margin: 0; text-align: center; font-size: 14px; color: var(--ink-soft); }
.aw-note { margin: 0; font-size: 14px; color: var(--ink-soft); }
.aw-note a { color: #a5f3fc; }
.aw-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.aw-row.wrap { justify-content: center; }
.aw-next-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 10px 20px; border-radius: 16px; border: 0;
  background: linear-gradient(135deg, #fb923c, #f97316); color: #2a1300; font-weight: 900; font-size: 17px; text-decoration: none; box-shadow: 0 8px 22px rgba(249, 115, 22, .35); }
.aw-upnext { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: 20px; background: rgba(251, 146, 60, .12); border: 1px solid rgba(251, 146, 60, .4); }
.aw-upnext > span { font-weight: 900; color: #fed7aa; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.aw-upnext.in, .aw-idea.in { animation: aw-in .45s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes aw-in { from { transform: translateY(14px); opacity: 0; } }
.aw-towel { width: 48px; height: 48px; border-radius: 14px; border: 1px dashed rgba(253, 224, 71, .5); background: transparent; font-size: 22px; opacity: .7; }

/* array figure */
.aw-fig { display: grid; justify-items: center; gap: 8px; width: 100%; }
.aw-tray { position: relative; border-radius: 14px; padding: 0; box-sizing: content-box; border: 6px solid transparent; transition: height .25s; }
.aw-tray.editable, .aw-tray.splittable { touch-action: none; cursor: crosshair; }
.aw-tray.tray-tin { background: linear-gradient(160deg, #94a3b8, #475569); border-color: #64748b; }
.aw-tray.tray-carton { background: #d6b98c; border-color: #b08d57; }
.aw-tray.tray-lego { background: #16a34a; border-color: #15803d; }
.aw-tray.tray-hall { background: #3b0764; border-color: #581c87; }
.aw-tray.tray-tray { background: linear-gradient(160deg, #475569, #1e293b); border-color: #334155; }
.aw-ghost { position: absolute; inset: 0; display: grid; grid-auto-rows: var(--cell); pointer-events: none; }
.aw-ghost i { display: block; margin: 30%; border-radius: 50%; background: rgba(255, 255, 255, .22); }
.aw-cell { position: absolute; left: 0; top: 0; width: var(--cell); height: var(--cell); display: grid; place-items: center; font-size: calc(var(--cell) * .7); line-height: 1;
  transition: transform .55s cubic-bezier(.4, 1.3, .5, 1), filter .2s; pointer-events: none; }
.aw-cell.pop { animation: aw-pop .32s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: var(--d); }
@keyframes aw-pop { from { scale: 0; } }
.tray-lego .aw-cell::after { content: ""; width: 68%; height: 68%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fde047, #eab308 60%, #a16207); box-shadow: 0 2px 0 #713f12; }
.aw-cell.part-a { filter: drop-shadow(0 0 4px #22d3ee); }
.aw-cell.part-b { filter: drop-shadow(0 0 4px #f472b6) hue-rotate(0deg); }
.tray-lego .aw-cell.part-b::after { background: radial-gradient(circle at 35% 30%, #fbcfe8, #ec4899 60%, #9d174d); box-shadow: 0 2px 0 #831843; }
.aw-handle { position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; background: #fb923c; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(251, 146, 60, .35); pointer-events: none; transition: transform .12s; }
.aw-cut { position: absolute; left: -22px; top: 0; height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, #fde047 0 10px, transparent 10px 16px); pointer-events: none; transition: transform .15s; }
.aw-scissors { position: absolute; left: -6px; top: -15px; font-size: 22px; }
.aw-tray.flipping .aw-cell { transition-duration: .7s; }
.aw-eq { font-size: 18px; font-weight: 900; text-align: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; align-items: baseline; min-height: 28px; }
.aw-eq .rc { color: #e0e7ff; }
.aw-eq .tot { color: #fde047; }
.aw-eq .tot.q { color: #fb923c; }
.aw-eq .pa { color: #67e8f9; }
.aw-eq .pb { color: #f9a8d4; }
.aw-eq .op { color: var(--ink-soft); }

.aw-idea { display: grid; gap: 8px; padding: 14px; border-radius: 20px; background: rgba(253, 224, 71, .08); border: 1px solid rgba(253, 224, 71, .35); }
.aw-idea p { margin: 0; font-size: 15px; }
.aw-q { font-size: 17px !important; font-weight: 800; }
.aw-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.aw-choice { min-height: 56px; border-radius: 16px; border: 2px solid rgba(34, 211, 238, .5); background: rgba(7, 13, 34, .6); color: #fff; font-size: 24px; font-weight: 900; }
.aw-choice.right { background: linear-gradient(135deg, #34d399, #22d3ee); color: #062016; border-color: transparent; }
.aw-choice.wrong { background: rgba(248, 113, 113, .2); border-color: #f87171; animation: aw-shake .4s; }
.aw-choice.dim { opacity: .4; }
@keyframes aw-shake { 25%, 75% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }

.aw-tabs { display: flex; gap: 8px; justify-content: center; }
.aw-tab { min-height: 44px; min-width: 70px; border-radius: 99px; border: 2px solid var(--line); background: rgba(7, 13, 34, .6); color: var(--ink-soft); font-weight: 900; font-size: 16px; }
.aw-tab.on { border-color: #fb923c; color: #fed7aa; }
.aw-tab.done::after { content: " ✓"; color: #34d399; }
.aw-hund { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.hn { min-height: 34px; padding: 0; border-radius: 8px; border: 1px solid rgba(165, 243, 252, .15); background: rgba(7, 13, 34, .5); color: #cbd5e1; font-size: 13px; font-weight: 700; position: relative; }
.hn.under::before { content: ""; position: absolute; left: 50%; bottom: 2px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: rgba(103, 232, 249, .7); }
.hn.lit { background: linear-gradient(135deg, #fb923c, #f59e0b); color: #2a1300; font-weight: 900; animation: aw-pop .3s; }
.hn.off { opacity: .3; }
.hn.nope { background: rgba(248, 113, 113, .35); animation: aw-shake .4s; }
.aw-meter { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 800; color: var(--ink-soft); margin: 0 4px; }
.aw-bar { flex: 1; height: 8px; border-radius: 99px; background: rgba(7, 13, 34, .7); overflow: hidden; }
.aw-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #fb923c, #fde047); transition: width .4s; }

/* opener */
.op-stage { position: relative; height: 300px; border-radius: 24px; overflow: hidden; background: radial-gradient(400px 220px at 50% 110%, rgba(251, 146, 60, .25), transparent), linear-gradient(170deg, #1e1b4b, #0b1638); border: 1px solid var(--line); transition: box-shadow .4s; }
.op-stage.glow { box-shadow: 0 0 0 2px #34d399, 0 0 30px rgba(52, 211, 153, .4); }
.op-stage.wonky { box-shadow: 0 0 0 2px #f87171, 0 0 30px rgba(248, 113, 113, .35); }
.op-tin { position: absolute; display: grid; border-radius: 16px; padding: 8px; background: linear-gradient(160deg, #94a3b8, #475569); opacity: 0; transform: scale(.9); transition: opacity .5s, transform .5s; }
.op-tin.show { opacity: 1; transform: none; }
.op-tin i { display: block; margin: 12%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #1e293b, #334155); }
.op-muffins { position: absolute; inset: 0; pointer-events: none; }
.op-m { position: absolute; left: 0; top: 0; line-height: 1; transition: transform .8s cubic-bezier(.4, 1.3, .5, 1); }
.op-count { position: absolute; top: 12px; left: 12px; right: 12px; text-align: center; font-size: 22px; font-weight: 900; color: #fde047; text-shadow: 0 2px 8px #000; }
.op-poster { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 10px; background: rgba(7, 13, 34, .55); text-align: center; z-index: 3; }
.op-poster p { margin: 0; font-weight: 900; font-size: 19px; }
.op-poster small { font-weight: 600; color: var(--ink-soft); font-size: 13px; }
.op-play { width: 84px; height: 84px; border-radius: 50%; border: 0; font-size: 34px; background: linear-gradient(135deg, #fb923c, #f97316); color: #2a1300; box-shadow: 0 0 0 8px rgba(251, 146, 60, .25); animation: aw-bob 2.4s ease-in-out infinite; }
.op-cap { margin: 0; min-height: 64px; font-size: 15px; color: #e0e7ff; }
.op-bar { height: 6px; border-radius: 99px; background: rgba(7, 13, 34, .7); overflow: hidden; }
.op-bar i { display: block; height: 100%; width: 0; background: #fb923c; transition: width .6s; }
.op-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.op-chip { min-height: 44px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: rgba(20, 31, 69, .85); color: var(--ink-soft); font-weight: 800; font-size: 13px; }
.op-chip.on { border-color: #fb923c; color: #fed7aa; }

.aw-badge { display: grid; place-items: center; }
.aw-badge svg { width: 140px; height: 140px; animation: aw-bob 3s ease-in-out infinite; filter: drop-shadow(0 8px 24px rgba(251, 146, 60, .45)); }
.aw-tricks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.aw-tricks div { display: grid; gap: 2px; padding: 10px; border-radius: 16px; background: rgba(20, 31, 69, .9); border: 1px solid var(--line); }
.aw-tricks span { font-size: 13px; color: var(--ink-soft); }
.ghost-btn { display: inline-flex; align-items: center; min-height: 48px; padding: 10px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(20, 31, 69, .8); color: var(--ink-soft); font-weight: 700; font-size: 14px; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .aw-cell, .op-m, .aw-cut, .aw-handle { transition: none; }
  .aw-cell.pop, .hn.lit, .aw-chef, .op-play, .aw-badge svg, .aw-upnext.in, .aw-idea.in { animation: none; }
}
