/* barktones v3: tokens and components from docs/design/mockups/flows.html, scaled from the
   250 px mock phone to a real full-screen layout (about 1.35x). Light only. */
/* Nunito (SIL OFL 1.1, fonts/OFL.txt), served from here so no page asks a third party for a font (issue #57). */
@font-face{font-family:"Nunito";font-style:normal;font-weight:200 1000;font-display:swap;src:url(fonts/Nunito-Variable.woff2) format("woff2")}
*{box-sizing:border-box}
html{--app:ui-rounded,"Nunito",system-ui,-apple-system,"Segoe UI",sans-serif;-webkit-text-size-adjust:100%;background:#F8F6F2}
body{margin:0;background:#F8F6F2;font-family:ui-rounded,"Nunito",system-ui,-apple-system,"Segoe UI",sans-serif;-webkit-tap-highlight-color:transparent}
body.calm{background:#E4EAE2}
button,input,a{font-family:inherit}

.s,.sheet,.calm{--bg:#F8F6F2;--ink:#1C1A24;--mut:#6F6B84;--card:#fff;--acc:#FF5F45;--on:#fff;--ln:#E6E2EE;--bar:#D9D5E4;--hot:#FF5F45;--soft:#FFF1EE;--w:900;--err:#C2412D}
.s.calm,.calm{--bg:#E4EAE2;--ink:#2C3B31;--mut:#566C5D;--card:#F6F8F5;--acc:#4E6A56;--on:#fff;--ln:#CBD6CA;--bar:#C3CFC3;--hot:#4E6A56;--soft:#D6E0D4;--w:700}

.s{min-height:100vh;min-height:100dvh;max-width:520px;margin:0 auto;display:flex;flex-direction:column;gap:14px;
  padding:calc(env(safe-area-inset-top) + 18px) calc(env(safe-area-inset-right) + 18px) calc(env(safe-area-inset-bottom) + 22px) calc(env(safe-area-inset-left) + 18px);
  background:var(--bg);color:var(--ink);font-size:16px;line-height:1.38}
.s.has-tabs{padding-bottom:calc(env(safe-area-inset-bottom) + 96px)}
.s *{min-width:0}
h1,h2,h3{margin:0}
p{margin:0}
:focus-visible{outline:3px solid var(--acc);outline-offset:2px;border-radius:8px}
h1:focus{outline:none}

/* nav row */
.wordmark{display:block;height:28px;width:auto;margin:4px 0 2px}
.nav{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;min-height:44px;font-weight:800;font-size:16px;color:var(--acc)}
.nav .ttl{color:var(--ink);text-align:center}
.nav .l{justify-self:start}.nav .r{justify-self:end}
.navb{background:none;border:0;color:var(--acc);font:800 16px/1 var(--app);min-height:44px;min-width:44px;padding:0 4px;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center}
.nav span.r,.nav span.l{color:var(--acc)}

.ey{font-size:12.5px;font-weight:800;letter-spacing:.07em;text-transform:uppercase;color:var(--mut)}
.t{margin:0;font:var(--w) 30px/1.1 var(--app);letter-spacing:-.01em;text-wrap:balance}
.t.sm{font-size:23px}
.mut{color:var(--mut)}
.c{background:var(--card);border-radius:19px;padding:14px}

/* waveform (static, from the mock) and the wavesurfer host */
.wv{display:flex;align-items:center;gap:2px;height:52px}
.wv i{flex:1;height:var(--h);min-height:2px;border-radius:2px;background:var(--bar)}
.wv i.hot{background:var(--hot)}
.wv.big{width:100%;height:72px;gap:3px}
.wv.big i{border-radius:3px}
.wave{height:76px;position:relative}
.wave ::part(region){border-radius:6px}

/* lists and rows */
.ls{flex:none;display:flex;flex-direction:column;background:var(--card);border-radius:19px;overflow:hidden;margin:0;padding:0;list-style:none}
.ls.memory{background:#E1E7DF}
.ls.memory{--acc:#4E6A56;--soft:#D6E0D4;--ln:#CBD6CA;--mut:#566C5D;--on:#fff}
.r{display:flex;align-items:center;gap:12px;padding:6px 14px;min-height:56px}
.r+.r{border-top:1px solid var(--ln)}
.r.sel{background:var(--soft)}
.rm{flex:1;display:flex;align-items:center;gap:12px;min-height:44px;background:none;border:0;padding:0;margin:0;color:inherit;font:inherit;text-align:left;text-decoration:none;cursor:pointer}
div.rm{cursor:default}
.r .m{flex:1;display:flex;flex-direction:column}
.r .m b{font-size:17.5px;font-weight:800;line-height:1.25}
.calm .r .m b{font-weight:700}
.r .m span{font-size:14px;color:var(--mut)}
.r .x{font-size:14px;font-weight:800;color:var(--mut)}
.r .chev{color:var(--mut);font-size:22px}
.pl{width:44px;height:44px;border-radius:50%;background:var(--acc);display:grid;place-items:center;flex:none;border:0;padding:0;cursor:pointer}
.pl::after{content:"";width:14px;height:16px;background:var(--on);clip-path:polygon(14% 0,100% 50%,14% 100%);margin-left:2px}
.pl.on::after{clip-path:none;width:13px;height:13px;border-radius:2px;margin-left:0}
.pl.big{width:80px;height:80px}.pl.big::after{width:25px;height:28px}.pl.big.on::after{width:24px;height:24px}
.av{width:48px;height:48px;border-radius:50%;display:grid;place-items:center;font:900 20px var(--app);background:#FFD9CF;color:#B23A24;flex:none}
.av.blue{background:#D7ECFF;color:#1E5C8C}
.av.calm{background:#CFDACD;color:#4E6A56}
.av.new{background:var(--soft);color:var(--acc)}
.av.xl{width:96px;height:96px;font-size:38px;justify-self:center}

/* buttons */
.b,.b2{display:block;width:100%;text-align:center;border-radius:999px;min-height:52px;padding:14px 14px;font:800 18px/1.2 var(--app);cursor:pointer;text-decoration:none;border:0}
.b{background:var(--acc);color:var(--on)}
.calm .b,.calm .b2{font-weight:700}
.b2{border:1px solid var(--ln);background:var(--card);color:var(--ink);font-size:17px;font-weight:700}
.b.danger{background:var(--err);color:#fff}
.b2.danger{color:var(--err)}
.b[disabled],.b2[disabled]{opacity:.5;cursor:default}
.lnk{display:block;text-align:center;font-weight:700;font-size:16px;color:var(--acc);background:none;border:0;min-height:44px;padding:0 12px;margin:0 auto;cursor:pointer;text-decoration:none;line-height:44px}
.end{margin-top:auto;display:grid;gap:10px;padding-top:6px}
.fine{font-size:13.5px;color:var(--mut);text-align:center;line-height:1.4}
.pair{display:flex;gap:8px}.pair>*{flex:1}

/* fields */
.fld{display:grid;gap:5px}
.fld label{font-size:12.5px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--mut)}
.inp{width:100%;min-height:48px;background:var(--card);border-radius:14px;padding:11px 13px;font-size:17px;border:1px solid var(--ln);color:var(--ink)}
.inp.bad{border-color:var(--err)}
.inp::placeholder{color:var(--mut)}
.err-text{color:var(--err);font-size:15px;margin:0}
.check{display:flex;gap:12px;align-items:center;font-size:16px;min-height:44px;cursor:pointer}
.check input{appearance:none;-webkit-appearance:none;width:26px;height:26px;border-radius:8px;border:2px solid var(--ln);background:var(--card);flex:none;margin:0;cursor:pointer;display:grid;place-items:center}
.check input:checked{background:var(--acc);border-color:var(--acc)}
.check input:checked::after{content:"";width:12px;height:7px;border-left:3px solid #fff;border-bottom:3px solid #fff;transform:rotate(-45deg) translate(1px,-1px)}

/* segmented control */
.seg{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;border-radius:16px;background:var(--card)}
.seg button{padding:10px 6px;min-height:44px;border-radius:12px;text-align:center;font:700 15px var(--app);color:var(--mut);background:none;border:0;cursor:pointer}
.seg button.on{background:var(--soft);color:var(--ink)}

.chips{display:flex;flex-wrap:wrap;gap:8px}
.chips button{min-height:44px;padding:0 18px;border-radius:999px;border:1px solid var(--ln);background:var(--card);color:var(--ink);font:800 16px var(--app);cursor:pointer}
.calm .chips button{font-weight:700}
.chips button.on{background:var(--acc);border-color:var(--acc);color:var(--on)}
textarea.inp{min-height:104px;resize:none;font-family:inherit;line-height:1.4}
.note-prev{font-size:15px;font-style:italic;color:var(--ink)}
.note small{display:block;margin-top:6px;font-size:14px;color:var(--mut)}
.prose{display:grid;gap:12px}
.prose h2{font:var(--w) 21px/1.2 var(--app);margin-top:10px}
.prose p,.prose li{font-size:16px;line-height:1.5}
.prose ul{margin:0;padding-left:22px;display:grid;gap:6px}
.prose a{color:var(--acc);font-weight:700}
button.fine{background:none;border:0;font-family:inherit;text-decoration:underline;min-height:44px;cursor:pointer;width:100%}

/* progress and steps */
.prog{height:11px;border-radius:9px;background:var(--card);overflow:hidden}
.prog i{display:block;height:100%;background:var(--acc);border-radius:9px}
.steps{display:grid;gap:10px;counter-reset:st;margin:0;padding:0;list-style:none}
.steps li{display:flex;gap:12px;align-items:center;background:var(--card);border-radius:16px;padding:12px 14px;counter-increment:st;font-size:16px}
.steps li::before{content:counter(st);width:28px;height:28px;border-radius:50%;background:var(--soft);color:var(--acc);display:grid;place-items:center;font-weight:900;font-size:14px;flex:none}
.install-steps li{align-items:flex-start}
.install-steps .step-content{display:grid;gap:6px;flex:1;min-width:0}
.install-steps .step-content p{margin:0;font-size:14px;line-height:1.4}
.install-steps .step-actions{display:grid;gap:6px;margin-top:6px}
.accordion{border:1px solid var(--ln);border-radius:14px;padding:10px 12px;background:var(--bg);margin-top:8px}
.accordion summary{cursor:pointer;font-weight:700;font-size:13.5px;color:var(--ink);user-select:none;outline:none}
.accordion[open] summary{margin-bottom:8px;padding-bottom:6px;border-bottom:1px solid var(--ln)}
.gb-step{display:grid;gap:3px;padding:6px 0;border-bottom:1px dashed var(--ln);font-size:13px}
.gb-step:last-child{border-bottom:none}
.gb-step b{color:var(--ink);font-size:13px}
.gb-step span{color:var(--mut);font-size:12.5px;line-height:1.35}

/* centered blocks, balance, notes, icons */
.center{text-align:center;justify-items:center;display:grid;gap:6px}
.center.err{margin-top:26px}
.bal{display:grid;justify-items:center;gap:2px;padding:14px;background:var(--card);border-radius:22px}
.bal b{font:900 52px/1 var(--app)}
.note{font-size:16px;line-height:1.45;padding:14px 16px;border-radius:19px;background:var(--card)}
.ok{width:62px;height:62px;border-radius:50%;background:var(--soft);display:grid;place-items:center;justify-self:center}
.ok::after{content:"";width:22px;height:12px;border-left:4px solid var(--acc);border-bottom:4px solid var(--acc);transform:rotate(-45deg) translate(1px,-3px)}
.erricon{width:62px;height:62px;border-radius:50%;background:#FBE3DD;display:grid;place-items:center;justify-self:center;font:900 28px var(--app);color:#C2412D}
.calm .erricon{background:#D6E0D4;color:#4E6A56}
.beta{font-size:12.5px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;background:#FFF4D6;color:#8A5A00;border-radius:10px;padding:6px 10px;text-align:center}
.sticker-line{font-size:15px;font-weight:700;line-height:1.35;background:var(--soft);color:var(--ink);border-radius:14px;padding:10px 14px;margin:6px 0 2px;text-align:center}
.drop{border:2px dashed var(--ln);border-radius:24px;padding:30px 14px;display:grid;justify-items:center;gap:8px;text-align:center;background:var(--card);cursor:pointer;color:var(--ink);width:100%;font:inherit}
.drop i{width:60px;height:60px;border-radius:19px;background:var(--soft);display:block;position:relative}
.drop i::after{content:"";position:absolute;left:50%;top:50%;width:19px;height:19px;margin:-12px 0 0 -9px;border-left:4px solid var(--acc);border-top:4px solid var(--acc);transform:rotate(45deg)}
.drop b{font-size:18px}
.drop small{font-size:14px;color:var(--mut)}
.linkbox{font:600 14px ui-monospace,Menlo,monospace;background:var(--card);border:1px solid var(--ln);border-radius:14px;padding:12px;word-break:break-all;user-select:all}
.tonepad{display:grid;gap:12px;padding:6px 0 2px}

/* tab bar */
.tabbar{position:fixed;left:50%;transform:translateX(-50%);bottom:0;width:min(100%,520px);display:flex;justify-content:space-around;border-top:1px solid var(--ln);background:var(--card);padding:6px 0 calc(env(safe-area-inset-bottom) + 8px);z-index:5}
.tabbar a{display:grid;justify-items:center;gap:3px;font-size:13px;font-weight:800;color:var(--mut);text-decoration:none;min-width:88px;min-height:44px;align-content:center}
.tabbar a .tabicon{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.tabbar a.on{color:var(--acc)}

/* sheet and scrim (rendered into #overlay) */
.scrim{position:fixed;inset:0;background:rgba(40,36,56,.24);z-index:20}
.sheet{position:fixed;left:50%;transform:translateX(-50%);bottom:var(--kb,0px);width:min(100%,520px);max-height:92dvh;max-height:calc(var(--vvh,100dvh) * .92);overflow:auto;z-index:21;background:var(--bg);color:var(--ink);border-radius:28px 28px 0 0;
  padding:12px 18px calc(env(safe-area-inset-bottom) + 20px);display:grid;gap:12px;box-shadow:0 -10px 30px rgba(0,0,0,.18);font-size:16px;line-height:1.38}
.sheet .grab{justify-self:center;width:42px;height:5px;border-radius:9px;background:var(--ln)}
.sheet *{min-width:0}
.pack{display:flex;align-items:center;justify-content:space-between;background:var(--card);border-radius:16px;padding:14px;border:2px solid var(--ln)}
.pack.on{border-color:var(--acc);background:var(--soft)}
.pack b{font-size:18px}.pack span{font-size:14px;color:var(--mut)}.pack em{font-style:normal;font-weight:900;font-size:17px;color:var(--acc)}

/* toast */
#toasts{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(env(safe-area-inset-bottom) + 14px);width:min(calc(100% - 32px),488px);z-index:30;pointer-events:none}
.toast{pointer-events:auto;background:#2A3042;color:#fff;border-radius:16px;padding:12px 16px;display:flex;justify-content:space-between;align-items:center;gap:12px;font-size:15px}
.calm .toast,.toast.calm{background:#2C3B31}
.tact{background:none;border:0;color:#B9C8F0;font:800 15px var(--app);min-height:44px;padding:0 6px;cursor:pointer}

.hidden{display:none!important}
.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

@media (prefers-reduced-motion:no-preference){
  .prog i{transition:width .35s ease}
  .sheet{animation:up .22s ease-out}
  .scrim{animation:fade .2s ease-out}
  .toast{animation:fade .2s ease-out}
  @keyframes up{from{transform:translate(-50%,24px);opacity:0}to{transform:translate(-50%,0);opacity:1}}
  @keyframes fade{from{opacity:0}to{opacity:1}}
}
a.plain{color:inherit;text-decoration:underline}
input[role=switch]{appearance:none;-webkit-appearance:none;width:52px;height:32px;border-radius:999px;background:var(--bar);position:relative;flex:none;margin:0;cursor:pointer;transition:background .15s}
input[role=switch]::after{content:"";position:absolute;top:3px;left:3px;width:26px;height:26px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:transform .15s}
input[role=switch]:checked{background:var(--acc)}
input[role=switch]:checked::after{transform:translateX(20px)}
@media (prefers-reduced-motion:reduce){input[role=switch],input[role=switch]::after{transition:none}}
body.tabs #toasts{bottom:calc(env(safe-area-inset-bottom) + 92px)}
.lnk.wrap{line-height:1.3;padding:10px 12px}
a.drop{text-decoration:none}

/* sound picker and problem reports */
.lnk.quiet{font-weight:600;font-size:14px;color:var(--mut);min-height:40px;line-height:40px}
.adj{display:grid;gap:10px;margin-top:4px}
.adj .ed{display:flex;align-items:center;gap:5px}
.adj .ed b{width:42px;font-size:14px}
.adj .ed output{flex:1;text-align:center;font-weight:800;font-size:15px;white-space:nowrap}
.adj .ed button{min-width:42px;min-height:44px;padding:0 4px;border-radius:12px;border:1px solid var(--ln);background:var(--bg);color:var(--ink);font:700 14px var(--app);cursor:pointer}
.adj .pair .b2{min-height:46px;font-size:15px}
.seg[aria-label="Kind of sound"]{margin-bottom:2px}

/* keyboard open (#43): the sheet already sits above the keyboard, so drop the home-indicator padding */
.kb-open .sheet{padding-bottom:16px;border-radius:28px}
/* sound lab (beta) */
.lab-row{flex-wrap:wrap}
.lab-act{flex-basis:100%;display:flex;gap:8px;align-items:center;justify-content:space-between;padding:0 0 6px}
.lab-act .b2{flex:1;min-height:44px;padding:8px 14px;font-size:16px}
.lab-act .lnk{margin:0;flex:none}

/* #131: no Safari double-tap zoom or tap delay on controls, and no text-selection callout when tapping them quickly. Scrolling and pinch-zoom still work. */
html,body{touch-action:manipulation}
button,a,[role=button],input[type=checkbox],input[role=switch]{touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}

/* #127: vibration preview. Browsers with navigator.vibrate buzz from haptics.js; iOS has no vibration API, so the playing button pulses while the switch is on. */
.vibe{display:flex;flex-direction:column;align-items:center;gap:2px;margin-top:4px}
body.vib .pl.on{animation:hapt .9s ease-out infinite}
@keyframes hapt{0%{box-shadow:0 0 0 0 rgba(255,95,69,.45)}100%{box-shadow:0 0 0 16px rgba(255,95,69,0)}}
@media (prefers-reduced-motion: reduce){body.vib .pl.on{animation:none}}
.shots{display:flex;gap:10px;flex-wrap:wrap}.shots:empty{display:none}.shot{position:relative;width:72px;height:72px;border-radius:12px;overflow:hidden;background:var(--soft)}.shot img{width:100%;height:100%;object-fit:cover;display:block}.shot-x{position:absolute;top:2px;right:2px;width:28px;height:28px;border-radius:50%;border:0;background:rgba(0,0,0,.6);color:#fff;font-size:18px;line-height:1;cursor:pointer}
.beta-card{background:var(--soft);border-radius:18px;padding:16px;display:grid;gap:10px;margin:8px 0}.beta-pill{justify-self:start;background:#FF5F45;color:#fff;font-weight:800;font-size:12px;letter-spacing:.06em;border-radius:999px;padding:4px 10px}.beta-h{font-size:20px;line-height:1.2;margin:0}.beta-rate{display:grid;gap:10px}.beta-vote{display:grid}
