@font-face { font-family: 'Fredoka'; font-weight: 400; font-display: swap; src: url('../fonts/fredoka-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap; src: url('../fonts/fredoka-latin-600-normal.woff2') format('woff2'); }

/* candlelight on a plum evening */
:root { --c0: #2a1a2c; --c1: #6e3d5c; --c2: #f2b47e; --ink: #fff6ec; --dim: rgba(255, 246, 236, .65);
  --glass: rgba(255, 255, 255, .11); --line: rgba(255, 255, 255, .2);
  --row0: #f6b979; --row1: #ee9a9a; --row2: #b6a0e6;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; color: var(--ink); font-family: 'Fredoka', ui-rounded, system-ui, sans-serif;
  background: var(--c0); user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
#glow { position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  background: radial-gradient(ellipse at 50% 110%, color-mix(in srgb, var(--c2) 22%, var(--c0)) 0%, var(--c0) 60%), var(--c0); }
#app { position: relative; height: 100%; height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 10px) 14px calc(var(--safe-b) + 10px); gap: 10px; }
#app > * { flex-shrink: 0; }

#top { display: flex; align-items: center; gap: 8px; }
#top h1 { flex: 1 1 auto; min-width: 0; overflow: hidden; margin: 0; font-size: clamp(16px, 5vw, 21px); font-weight: 600; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
#top h1 .dot { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--c2) 45%, var(--c1)); box-shadow: 0 0 12px var(--c2); }
.chip { height: 36px; padding: 0 13px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.chip.small { height: 30px; font-size: 13px; padding: 0 11px; }
.chip.icon { width: 36px; padding: 0; justify-content: center; font-size: 17px; }
.chip.on { background: rgba(255, 255, 255, .3); border-color: rgba(255, 255, 255, .6); }
#key, #voice { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

#bar { display: flex; align-items: center; gap: 8px; }
#bar .grow { flex: 1; }
#reclen.on { background: rgba(255,107,122,.28); border-color: #ff6b7a; }
#bar .chip { flex: 0 1 auto; min-width: 0; padding: 0 11px; }
#beat.on { background: color-mix(in srgb, var(--c2) 40%, transparent); border-color: var(--c2); }
.round { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: var(--glass); border: 1px solid var(--line); font-size: 18px; }
#play.on { background: var(--ink); color: var(--c0); }
#rec { color: #ff6b7a; }
#rec.on { background: #ff6b7a; color: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .65; } }

/* the chords above, the strings below (side by side on a wide screen) */
#stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
#chords { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 1fr); gap: 10px; place-items: center; }

/* a chord: a cocoa mug with two marshmallows, and a sleepy face */
.chord { position: relative; width: var(--b, 80px); height: var(--b, 80px); touch-action: none; --c: var(--row0); transition: transform .08s; }
.chord.r1 { --c: var(--row1); } .chord.r2 { --c: var(--row2); }
.chord > * { pointer-events: none; }
.chord .cup { position: absolute; left: 4%; width: 76%; top: 26%; bottom: 3%; border-radius: 16% 16% 34% 34% / 12% 12% 30% 30%;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 68%, #3a2030), var(--c) 28%, color-mix(in srgb, var(--c) 55%, #fff) 44%, var(--c) 62%, color-mix(in srgb, var(--c) 68%, #3a2030));
  box-shadow: inset 0 -6px 12px rgba(0,0,0,.16), 0 6px 14px rgba(0,0,0,.32); }
/* the cocoa, and the handle */
.chord .cup::before { content: ''; position: absolute; left: 7%; right: 7%; top: 3%; height: 15%; border-radius: 50%; background: radial-gradient(ellipse at 50% 40%, #7a4a30, #4a2618); box-shadow: inset 0 2px 4px rgba(0,0,0,.45); }
.chord .cup::after { content: ''; position: absolute; left: 96%; top: 20%; width: 24%; height: 42%; border: calc(var(--b, 80px) * .07) solid color-mix(in srgb, var(--c) 85%, #3a2030); border-left: 0; border-radius: 0 50% 50% 0 / 0 50% 50% 0; box-sizing: border-box; }
/* two marshmallows floating in the cocoa. They sit in a frame that ends at
   the cocoa's front edge (the lower half of its oval), so whatever sinks
   below the surface is hidden, as if under the cocoa. */
.chord .float { position: absolute; left: 9.3%; width: 65.4%; top: 0; height: 38.7%; overflow: hidden;
  border-radius: 0 0 50% 50% / 0 0 13.7% 13.7%; }
.chord .m { position: absolute; width: 33.6%; height: 43.9%; border-radius: 30%;
  background: linear-gradient(180deg, #fffdf8 0%, #fff3e6 55%, #f0c9a0 100%); box-shadow: 0 2px 3px rgba(60,20,10,.3); }
.chord .m1 { left: 11.8%; top: 49%; transform: rotate(-14deg); }
.chord .m2 { left: 48.5%; top: 41.3%; transform: rotate(10deg); background: linear-gradient(180deg, #fffdf8 0%, #ffe6ee 55%, #efc0b8 100%); }
.chord svg { position: absolute; left: 20%; top: 22%; width: 60%; height: 22%; overflow: visible; }
.chord b { position: absolute; left: 0; right: 0; bottom: 21%; text-align: center; font-size: calc(var(--b, 80px) / 5.6); font-weight: 600; color: rgba(40,10,20,.78); white-space: nowrap; }
.chord small { position: absolute; left: 0; right: 0; bottom: 7%; text-align: center; font-size: calc(var(--b, 80px) / 10); color: rgba(40,10,20,.5); }
/* steam rising from the chord that is on */
.chord .steam { position: absolute; left: 22%; width: 40%; top: -4%; height: 24%; opacity: 0; }
.chord.cur .steam { opacity: 1; }
.chord .steam path { fill: none; stroke: rgba(255,246,236,.55); stroke-width: 3; stroke-linecap: round; animation: steam 2.2s ease-in-out infinite; }
.chord .steam path:nth-child(2) { animation-delay: -1.1s; }
@keyframes steam { 0% { transform: translateY(6px); opacity: 0; } 40% { opacity: 1; } 100% { transform: translateY(-6px); opacity: 0; } }
.chord .open, .chord .o { display: none; }
.chord.down { transform: scale(.92, .88); }
.chord.sing .o { display: inline; } .chord.sing .smile { display: none; }
/* the marshmallows bob down into the cocoa while it sings */
.chord .m { transition: transform .18s cubic-bezier(.3, 1.6, .5, 1); }
.chord.sing .m1 { transform: translateY(48%) rotate(-4deg); }
.chord.sing .m2 { transform: translateY(56%) rotate(3deg); }
.chord.cur .cup { box-shadow: inset 0 -6px 12px rgba(0,0,0,.16), 0 0 0 3px var(--ink), 0 0 22px var(--c); }
/* the mug whose chord the looping take is playing: steam and a warm glow (your own chord keeps its ring) */
.chord.lit .steam { opacity: 1; }
.chord.lit .cup { filter: brightness(1.08); box-shadow: inset 0 -6px 12px rgba(0,0,0,.16), 0 0 26px var(--c); }
.chord.lit.cur .cup { box-shadow: inset 0 -6px 12px rgba(0,0,0,.16), 0 0 0 3px var(--ink), 0 0 26px var(--c); }
.chord.cur .shut { display: none; } .chord.cur .open { display: inline; }

/* the strum strip: strings to swipe across */
#strip { position: relative; flex: 0 0 auto; height: clamp(110px, 22vh, 190px); border-radius: 22px; background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid var(--line); touch-action: none; overflow: hidden; cursor: pointer; }
#strings { position: absolute; inset: 0 10px; display: flex; justify-content: space-between; pointer-events: none; }
#strings i { width: 3px; height: 100%; border-radius: 2px; background: linear-gradient(180deg, transparent, rgba(255,246,236,.55) 15%, rgba(255,246,236,.55) 85%, transparent); transition: background .3s, box-shadow .3s; }
#strip-name { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 30px; font-weight: 600; color: rgba(255,246,236,.13); pointer-events: none; white-space: nowrap; }
/* sideways strings when the strip stands tall */
#strip.tall #strings { inset: 10px 0; flex-direction: column-reverse; }
#strip.tall #strings i { width: 100%; height: 3px; background: linear-gradient(90deg, transparent, rgba(255,246,236,.55) 15%, rgba(255,246,236,.55) 85%, transparent); }
#hint { margin: 0; text-align: center; font-size: 13px; color: var(--dim); min-height: 1.2em; }
#hint.count { color: var(--ink); font-size: 18px; font-weight: 600; }

body.wide #app { max-width: 1100px; }
body.wide #stage { flex-direction: row; }
body.wide #chords { flex: 1 1 60%; }
body.wide #strip { flex: 0 0 34%; height: auto; }

/* menus (the bubble apps' sheets) */
#scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 10; animation: fade .2s; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-width: 560px; margin: 0 auto; max-height: 86%; max-height: 86dvh;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c0) 85%, #000), color-mix(in srgb, var(--c0) 94%, #000)); color: var(--ink);
  border: 1px solid var(--line); border-bottom: 0; border-radius: 28px 28px 0 0; padding: 8px 16px calc(var(--safe-b) + 16px); overflow-y: auto;
  overscroll-behavior: contain; touch-action: pan-y; box-shadow: 0 -10px 40px rgba(0,0,0,.5); animation: rise .26s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
#sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.35); margin: 2px auto 10px; }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
#sheet h3 { margin: 0 0 12px; font-size: 18px; }
#sheet h4 { margin: 16px 0 8px; font-size: 14px; color: var(--dim); }
#sheet p.note { margin: 0 0 10px; color: var(--dim); font-size: 13px; }
#sheet .row { display: flex; gap: 8px; flex-wrap: wrap; }
#sheet .keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
#sheet .keys .chip { justify-content: center; padding: 0; }
#sheet .big { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); text-align: left; font-weight: 600; }
#sheet .big small { display: block; font-weight: 400; color: var(--dim); font-size: 13px; }
#sheet .big.on { border-color: var(--ink); background: rgba(255,255,255,.2); }
#sheet .big:disabled { opacity: .45; }
.tempo { display: flex; align-items: center; justify-content: center; gap: 18px; font-size: 44px; font-weight: 600; }
.tempo button { width: 52px; height: 52px; border-radius: 50%; background: var(--glass); border: 1px solid var(--line); font-size: 26px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 27px; background: none; margin: 8px 0 0; touch-action: none; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,.25); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--c2) 60%); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,.25); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--c2); }

#toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 26px); transform: translateX(-50%); z-index: 20; background: var(--ink); color: var(--c0);
  padding: 9px 16px; border-radius: 20px; font-weight: 600; font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap; }
#toast.on { opacity: 1; }

/* changing chords: the mugs wiggle gently, waiting to be picked */
body.editing .chord { animation: wiggle 1.4s ease-in-out infinite; }
body.editing .chord:nth-child(2n) { animation-delay: -.7s; }
@keyframes wiggle { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
#hint .chip { margin-left: 6px; vertical-align: middle; }
