/* screens/settings.css: WP8, SPEC 3.8. Settings inside the menu stall: 3 columns, no tabs, every control visible
   without scrolling at 1440x900 and 1280x720 (including the 2-line confirm steps). 2 columns below a 50rem stall
   body, 1 below 34rem (the body scrolls there). Only transform and opacity animate; no filters.
   Columns: 1 Profile · 2 Keys, Guitar, Display · 3 Timing, Sound. Group icons are inline SVG data URIs (img-src
   'self' data:), drawn in ivory on a coloured coin. */

#settings {
  --ico-profile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8.3' r='4.3' fill='%23F6F0E4'/%3E%3Cpath d='M3.6 21.2c.6-4.7 4.1-7.4 8.4-7.4s7.8 2.7 8.4 7.4z' fill='%23F6F0E4'/%3E%3C/svg%3E");
  --ico-keys: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F6F0E4' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='2.5' y='5' width='19' height='14' rx='3.2'/%3E%3Cpath d='M6.8 9.4h.4M11.8 9.4h.4M16.8 9.4h.4M8 14.6h8'/%3E%3C/svg%3E");
  --ico-display: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.4 6.6 6.6 2.9-6.6 2.6L12 21.5l-2.4-6.9L3 12l6.6-2.9z' fill='%23F6F0E4'/%3E%3C/svg%3E");
  --ico-timing: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F6F0E4' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.2 3h5.6l4.4 18H4.8z'/%3E%3Cpath d='M12 17l5-10.5M7.6 17h8.8'/%3E%3C/svg%3E");
  --ico-sound: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.5 9h4l5.5-4.5v15L7.5 15h-4z' fill='%23F6F0E4'/%3E%3Cpath d='M16.2 9a4.2 4.2 0 0 1 0 6M18.8 6.3a8 8 0 0 1 0 11.4' fill='none' stroke='%23F6F0E4' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  --ico-metro-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232C0F15' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.2 3h5.6l4.4 18H4.8z'/%3E%3Cpath d='M12 17l5-10.5M7.6 17h8.8'/%3E%3C/svg%3E");
  --ico-ticket-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232C0F15' stroke-width='2.2' stroke-linejoin='round'%3E%3Cpath d='M3 7h18v3a2 2 0 0 0 0 4v3H3v-3a2 2 0 0 0 0-4z'/%3E%3Cpath d='M15 7.5v9' stroke-dasharray='1.6 1.6'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- the body: three stitched columns */
#settings .stall__body {
  padding: calc(1.4rem + var(--ow-l)) calc(1.25rem + var(--ow-l)) calc(.4rem + var(--ow-l));
  scrollbar-gutter: auto;
}
#settings .settings-body {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.08fr) minmax(0, .87fr); gap: 0;
  align-items: stretch; min-height: 100%;
}
#settings .settings-col { display: flex; flex-direction: column; gap: .7rem; min-width: 0; padding: 0 1.05rem; }
#settings .settings-col:first-child { padding-left: 0; }
#settings .settings-col:last-child { padding-right: 0; }
#settings .settings-col + .settings-col { border-left: .16rem dashed rgb(91 58 64 / .26); }
#settings .group { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }

/* entrance: groups rise, 25ms apart, all in by 120ms (after a camera move, after --move-at) */
#settings .group { --anim: ff-rise-in var(--t-base) var(--ease-out) var(--at, 0ms) backwards; animation: var(--anim); }
#settings .settings-col:nth-child(1) .group:nth-child(1) { --at: calc(var(--move-at, 0ms) + 0ms); }
#settings .settings-col:nth-child(2) .group:nth-child(1) { --at: calc(var(--move-at, 0ms) + 25ms); }
#settings .settings-col:nth-child(3) .group:nth-child(1) { --at: calc(var(--move-at, 0ms) + 50ms); }
#settings .settings-col:nth-child(2) .group:nth-child(2) { --at: calc(var(--move-at, 0ms) + 75ms); }
#settings .settings-col:nth-child(3) .group:nth-child(2) { --at: calc(var(--move-at, 0ms) + 100ms); }
#settings .settings-col:nth-child(2) .group:nth-child(3) { --at: calc(var(--move-at, 0ms) + 120ms); }

/* ---------------------------------------------------------------- group headers: coin icon + caps label + rule */
#settings .group > .label {
  display: flex; align-items: center; gap: .55rem; min-height: 1.8rem; margin: 0;
  font: 900 var(--fs-small)/1.15 var(--font-body); text-transform: uppercase; letter-spacing: .1em; color: var(--ink);
}
#settings .group > .label::before {
  content: ''; flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--ico, var(--ico-profile)) 50% 50% / 62% auto no-repeat, var(--coin, var(--red));
  box-shadow: 0 0 0 var(--ow-s) var(--ink), 0 .16rem 0 var(--ow-s) var(--ink), inset 0 .14rem 0 rgb(255 255 255 / .28);
  rotate: -6deg;
}
#settings .group > .label::after { content: ''; flex: 1 1 auto; min-width: 1rem; height: 0; border-top: .16rem dotted rgb(91 58 64 / .35); }
#profile-group { --ico: var(--ico-profile); --coin: var(--red); }
#settings .settings-col:nth-child(2) > .group:nth-child(1) { --ico: var(--ico-keys); --coin: var(--cobalt); }
#settings .settings-col:nth-child(2) > .group:nth-child(2) { --ico: var(--ico-keys); --coin: var(--f3); }
#settings .settings-col:nth-child(2) > .group:nth-child(3) { --ico: var(--ico-display); --coin: var(--night-3); }
#settings .settings-col:nth-child(3) > .group:nth-child(1) { --ico: var(--ico-timing); --coin: var(--cobalt-deep); }
#settings .settings-col:nth-child(3) > .group:nth-child(2) { --ico: var(--ico-sound); --coin: var(--red); }

/* the Keys header carries the helper line on its right (2 lines), instead of a rule */
#settings .group > .label:has(small) { align-items: center; }
#settings .group > .label:has(small)::after { display: none; }
#settings .group > .label small {
  flex: 1 1 0; min-width: 0; padding-left: .55rem; border-left: .16rem solid rgb(91 58 64 / .2);
  font: 800 var(--fs-small)/1.25 var(--font-body); color: var(--ink-2); text-transform: none; letter-spacing: 0;
}
#settings .group:has(#keymap .listening) > .label small { color: var(--red-deep); }

/* ---------------------------------------------------------------- column 1: profile */
#settings .field-text { position: relative; display: block; min-width: 0; }
#settings .field-text > span {                    /* the label sits inside the field, top-left (compact 2.9rem field) */
  position: absolute; left: calc(.85rem + var(--ow)); top: calc(.32rem + var(--ow)); z-index: 1; pointer-events: none;
  max-width: calc(100% - 1.7rem); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font: 900 var(--fs-small)/1 var(--font-body); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2);
}
#settings .field-text > span small { margin-left: .25rem; font: 800 var(--fs-small)/1 var(--font-body); text-transform: none; letter-spacing: 0; color: rgb(91 58 64 / .75); }
#settings .field-text input {
  display: block; width: 100%; height: 3.2rem; padding: 1.2rem .85rem 0;
  font: 800 1.12rem/1.2 var(--font-body);
  background: linear-gradient(180deg, rgb(234 223 201 / .55), transparent 1.05rem), var(--paper);
}
#settings .field-text input:focus { border-color: var(--cobalt); }
#settings .field-text:has(input:focus) > span { color: var(--cobalt-deep); }
#settings .field-text:has(input[aria-invalid="true"]) > span { color: var(--red-deep); }

#profile-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .45rem; row-gap: .45rem; }
#profile-form[hidden] { display: none; }
#profile-form > .field-text:first-child { grid-column: 1 / -1; }
#profile-form > .field-text:nth-child(2) { grid-column: 1; grid-row: 2; }
#profile-form .form-row { display: contents; }
#profile-form button[type="submit"] {
  grid-column: 2; grid-row: 2; align-self: stretch; min-height: 0; height: auto; padding: 0 .75rem;
  border-radius: var(--r-s); font-size: 1.05rem;
}
#pf-msg { grid-column: 1 / -1; grid-row: 3; min-height: 1.25rem; margin: -.1rem 0 0 .2rem; }
#pf-msg:empty { min-height: .6rem; }
#pf-msg:not(.err):not(:empty)::before {               /* "Saved." gets the green tick */
  content: ''; flex: none; width: 1.1rem; height: 1.1rem; background: url(../../img/svg/check.svg) 50% 50% / contain no-repeat;
}
#pf-msg:not(.err):not(:empty) { color: #12773C; }

/* recovery-code actions: a ticket perforation above, compact full-width buttons */
#settings .profile-actions {
  display: flex; flex-direction: column; gap: .45rem; margin-top: .1rem; padding-top: .65rem;
  border-top: .16rem dashed rgb(91 58 64 / .3);
}
#settings .profile-actions button {
  justify-content: flex-start; width: 100%; min-height: 2.35rem; padding: .15rem .8rem .2rem .6rem; gap: .5rem;
  border-radius: var(--r-s); font-size: 1.08rem; text-align: left;
}
#settings .profile-actions button[hidden] { display: none; }
#settings .profile-actions button:not(.danger, .confirm)::before {
  content: ''; flex: none; width: 1.25rem; height: 1.25rem; background: var(--ico-ticket-ink) 50% 50% / contain no-repeat;
}
#settings .profile-actions button.danger:not(.confirm) { justify-content: center; }
/* the confirm step: solid red question, up to 2 lines, plain text, countdown strip (components 2.2) */
#settings .profile-actions button.confirm {
  justify-content: center; text-align: center; padding: .35rem .8rem .6rem; font: 900 var(--fs-small)/1.25 var(--font-body);
  box-shadow: 0 .22rem 0 var(--ink), 0 0 0 .2rem rgb(232 32 47 / .25);
}
/* guest (no profile, online): a hint card above "Use a recovery code" */
#profile-group:has(#profile-form[hidden]):has(#pf-offline[hidden]) .profile-actions {
  border-top: 0; padding-top: 0;
}
#profile-group:has(#profile-form[hidden]):has(#pf-offline[hidden]) .profile-actions::before {
  content: 'Playing as a guest. Have a recovery code? Load your profile here.';
  padding: .6rem .8rem; border: .16rem dashed rgb(91 58 64 / .4); border-radius: var(--r-s);
  background: rgb(255 250 240 / .6); font: 800 var(--fs-small)/1.35 var(--font-body); color: var(--ink-2);
}
/* offline: night note with the bichito's meh face */
#pf-offline:not([hidden]) {
  display: flex; align-items: center; gap: .7rem; margin: 0; padding: .7rem .8rem;
  border: var(--ow-s) solid var(--ink); border-radius: var(--r-m);
  background: url(../../img/svg/paper-grain.webp) 0 0 / 16rem, var(--grad-night); color: var(--ivory);
  font: 800 var(--fs-small)/1.4 var(--font-body); box-shadow: 0 .22rem 0 var(--ink);
}
#pf-offline:not([hidden])::before {
  content: ''; flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  background: url(../../img/mascot/face-meh.svg) 50% 62% / 72% auto no-repeat, var(--f4);
  box-shadow: 0 0 0 var(--ow-s) var(--ink), inset 0 .25rem 0 rgb(255 255 255 / .25);
}

/* ---------------------------------------------------------------- column 2: keycaps (frets, then strum + star) */
#keymap { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem .5rem; padding: 0 0 .1rem; }
#keymap button {
  position: relative; display: inline-grid; place-items: center; min-width: 2.7rem; height: 2.7rem; min-height: 0; margin: 0;
  padding: .42rem .45rem 0; border: var(--ow) solid var(--ink); border-radius: var(--r-s);
  background:
    linear-gradient(180deg, var(--lane, var(--night-4)) 0 .5rem, var(--ink) .5rem calc(.5rem + var(--ow-s)), transparent 0),
    radial-gradient(90% 60% at 50% 100%, rgb(44 15 21 / .08), transparent 70%),
    var(--grad-ivory);
  color: var(--ink); box-shadow: 0 .24rem 0 var(--ink);
  font: 700 1.28rem/1 var(--font-display); font-stretch: 85%; white-space: nowrap; cursor: pointer;
  transition: transform var(--t-quick) var(--ease-snap), opacity var(--t-quick) linear;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { #keymap button:hover:not(.listening) { transform: translateY(-.14rem); } }
#keymap button:is(:active, .is-pressed) { transform: translateY(.22rem); box-shadow: 0 .02rem 0 var(--ink); transition-duration: var(--t-instant); }
#keymap button.strum {
  --lane: var(--night-4);
  background:
    linear-gradient(180deg, var(--lane) 0 .5rem, var(--ivory-3) .5rem calc(.5rem + .1rem), transparent 0),
    url(../../img/svg/paper-grain.webp) 0 0 / 16rem, var(--grad-night);
  color: var(--ivory); border-color: var(--ink);
}
#keymap button.star {
  --lane: var(--cobalt-hi);
  padding-inline: .7rem;
  background:
    linear-gradient(180deg, var(--cobalt-hi) 0 .5rem, var(--ink) .5rem calc(.5rem + var(--ow-s)), transparent 0),
    radial-gradient(90% 70% at 50% 0, rgb(255 255 255 / .3), transparent 70%), var(--grad-blue);
  color: var(--ivory); -webkit-text-stroke: max(1.5px, .1em) var(--ink); paint-order: stroke fill;
}
/* the fret / strum divider becomes the line break: frets on top, strum and Star Power below */
#keymap .sep { flex: 1 0 100%; height: 0; margin: -.12rem 0; border-top: .16rem dashed rgb(91 58 64 / .3); }

/* listening: the cap shows "…", wobbles on the beat inside a dashed ring; the others step back */
#keymap button.listening {
  background:
    linear-gradient(180deg, var(--lane, var(--night-4)) 0 .5rem, var(--ink) .5rem calc(.5rem + var(--ow-s)), transparent 0),
    linear-gradient(180deg, var(--f1), var(--f2));
  color: var(--ink); -webkit-text-stroke: 0;
  outline: .17rem dashed var(--red); outline-offset: .3rem;
  --loop: wp8-wobble calc(var(--beat, .397s) * 2) var(--ease-inout) var(--beat-delay, 0s) infinite alternate; animation: var(--loop);
}
#keymap:has(.listening) button:not(.listening) { opacity: .45; }
@keyframes wp8-wobble { from { transform: rotate(-3deg) translateY(-.1rem); } to { transform: rotate(3deg) translateY(-.1rem); } }
/* captured: stamp; taken from another cap (swap): both shake */
#keymap button[data-fx="stamp"] { --anim: ff-stamp 400ms var(--spring-stamp) backwards; animation: var(--anim); }
#keymap button[data-fx="swap"] { --anim: ff-shake var(--t-base) linear both; animation: var(--anim); }

/* ---------------------------------------------------------------- sliders (label | range | output) */
#settings .slider {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l o" "r r"; align-items: center;
  column-gap: .5rem; row-gap: .1rem;
}
#settings .slider > span { grid-area: l; min-width: 0; font: 900 var(--fs-small)/1.15 var(--font-body); text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#settings .slider input[type="range"] { grid-area: r; width: 100%; height: 1.6rem; }
#settings .slider output { grid-area: o; justify-self: end; min-width: 4.1rem; height: 1.6rem; box-shadow: 0 .12rem 0 var(--ink); }
/* the offset sliders are centred on 0: the fire fills from the middle, a tick marks 0 */
#opt-audio::-webkit-slider-runnable-track, #opt-video::-webkit-slider-runnable-track {
  background:
    linear-gradient(90deg, transparent calc(50% - .07rem), rgb(44 15 21 / .55) 0 calc(50% + .07rem), transparent 0),
    linear-gradient(90deg, transparent 0 min(50%, var(--v, 50%)), var(--f3) 0 max(50%, var(--v, 50%)), transparent 0),
    var(--ivory-2);
}

/* ---------------------------------------------------------------- switch (Reduced graphics) */
#settings .switch { display: flex; align-items: center; gap: .65rem; min-height: 2.2rem; font: 900 .94rem/1.3 var(--font-body); }
#settings .switch > span:last-child { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
/* Reduced graphics + Reduced effects (hype.js) side by side: the Display group keeps its one-row height */
#settings .switch-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
#settings .switch-row .switch { min-width: 0; }

/* ---------------------------------------------------------------- column 3: calibrate button */
#btn-calibrate {
  width: 100%; min-height: 2.4rem; margin-top: 0; border-radius: var(--r-s); font-size: 1.12rem; gap: .5rem;
  background: repeating-linear-gradient(-45deg, transparent 0 .5rem, rgb(44 15 21 / .04) .5rem 1rem);
}
#btn-calibrate::before { content: ''; flex: none; width: 1.3rem; height: 1.3rem; background: var(--ico-metro-ink) 50% 50% / contain no-repeat; }

/* ---------------------------------------------------------------- compact stall body */
@container (max-width: 50rem) {
  #settings .settings-col { gap: .55rem; }                /* the compact stall keeps the tighter sizes (it scrolls) */
  #settings .group { gap: .36rem; }
  #settings .field-text input { height: 2.95rem; font-size: 1.05rem; }
  #settings .profile-actions button { min-height: 2.05rem; font-size: 1rem; }
  #keymap button { min-width: 2.45rem; height: 2.45rem; font-size: 1.15rem; }
  #settings .settings-body { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: .9rem; }
  #settings .settings-col:nth-child(2) { padding-right: 0; }
  #settings .settings-col:nth-child(3) {
    grid-column: 1 / -1; flex-direction: row; gap: 1.05rem; padding: .8rem 0 0;
    border-left: 0; border-top: .16rem dashed rgb(91 58 64 / .26);
  }
  #settings .settings-col:nth-child(3) > .group { flex: 1 1 0; }
}
@container (max-width: 34rem) {
  #settings .settings-body { grid-template-columns: minmax(0, 1fr); }
  #settings .settings-col { padding: .8rem 0 0; border-left: 0 !important; }
  #settings .settings-col + .settings-col { border-top: .16rem dashed rgb(91 58 64 / .26); }
  #settings .settings-col:nth-child(3) { flex-direction: column; }
}

/* ---------------------------------------------------------------- column 2: the guitar (status + setup) */
#pad-actions { display: flex; flex-direction: column; gap: .45rem; }
#pad-actions button {
  justify-content: flex-start; width: 100%; min-height: 2.35rem; padding: .15rem .8rem .2rem .6rem; gap: .5rem;
  border-radius: var(--r-s); font-size: 1.08rem; text-align: left;
}
#pad-actions button[hidden] { display: none; }
#pad-actions button:disabled { opacity: .5; cursor: not-allowed; }
#pad-note { margin: 0; font: 800 var(--fs-small)/1.35 var(--font-body); color: var(--ink-2); }

/* the setup: a sticker centred on the stall body (same place and paper as the Strum question) */
#settings > .pad-setup {
  position: absolute; left: var(--stall-l); right: var(--stall-r); top: var(--stall-body-t); bottom: var(--stall-b); z-index: 2;
  place-items: center; padding: 1rem; pointer-events: none;
}
#settings > .pad-setup:not([hidden]) { display: grid; }
.pad-setup__paper .row { justify-content: flex-end; }
.pad-setup__step { margin-block: 0; text-align: center; font: 900 var(--fs-h3)/1.15 var(--font-body); color: var(--ink); }
.pad-setup__dots { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-block: .1rem; padding: 0; list-style: none; }
.pad-setup__dots li {
  --c: var(--paper); display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border: var(--ow-s) solid var(--ink); border-radius: var(--r-xs);
  background: var(--c); color: var(--ink); font: 900 .95rem/1 var(--font-body); box-shadow: 0 .14rem 0 var(--ink); opacity: .38;
  transition: transform var(--t-quick) var(--ease-out), opacity var(--t-quick) linear;
}
.pad-setup__dots li.now { opacity: 1; transform: translateY(-.22rem); }
.pad-setup__dots li.done { opacity: 1; }
.pad-setup__dots li.done::after { content: '¹3'; }
.pad-setup__dots li.skip { opacity: .18; }
.pad-setup__dots li.skip::after { content: '3'; }
.pad-setup__dots li.sep { width: .15rem; height: 1.2rem; border: 0; border-radius: .1rem; background: var(--ink); box-shadow: none; opacity: .3; }
