/* ============================================================================
   ManiaMapper - local UI stylesheet
   osu!-flavoured dark theme. No frameworks, no external fonts (offline).
   Sections: tokens / base / header / cards / controls / source / difficulty /
             progress / result / toasts / responsive
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --bg:        #12121a;
  --bg-deep:   #0c0c12;
  --surface:   #1c1c28;
  --surface-2: #232333;
  --surface-3: #2a2a3c;
  --border:    #2e2e42;
  --border-2:  #3a3a52;

  --text:      #ecebf4;
  --text-2:    #b9b8cf;
  --muted:     #8e8daa;

  --pink:      #ff66aa;
  --pink-deep: #e0458c;
  --pink-soft: rgba(255, 102, 170, .14);
  --cyan:      #66ccff;
  --cyan-soft: rgba(102, 204, 255, .13);

  --ok:   #5ad6a0;
  --warn: #ffc76b;
  --err:  #ff6b81;

  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  --shadow:    0 18px 40px rgba(0, 0, 0, .38);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, .28);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

/* The UA's [hidden] rule loses to any author `display`, and most panels here are
   flex/grid - so make the attribute authoritative. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.aurora {
  position: fixed;
  inset: -20vh -10vw auto -10vw;
  height: 70vh;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(45vw 40vh at 18% 0%, rgba(255, 102, 170, .18), transparent 70%),
    radial-gradient(40vw 36vh at 82% 6%, rgba(102, 204, 255, .14), transparent 72%);
  filter: blur(6px);
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
p  { margin: 0; }
code { font-family: var(--mono); font-size: .85em; color: var(--text-2); }

a { color: var(--pink); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.hint  { color: var(--muted); font-style: normal; font-weight: 400; font-size: .78rem; }

::selection { background: var(--pink-soft); }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- header ---------- */
.site-header {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 52px 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 44px; height: 44px; flex: none; filter: drop-shadow(0 4px 16px rgba(255, 102, 170, .32)); }

.wordmark {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -.035em;
  background: linear-gradient(100deg, #fff 8%, var(--pink) 48%, var(--cyan) 108%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-line {
  max-width: 46ch;
  color: var(--text-2);
  font-size: 1.04rem;
  line-height: 1.5;
}
.hero-line strong { color: var(--text); font-weight: 650; }

.hero-beta {
  /* a block, not a flex row: the pill should sit in the text like a word, not get pushed onto a
     line of its own the moment the sentence wraps */
  max-width: 46ch;
  font-size: .82rem;
  line-height: 1.7;
  color: var(--muted);
}
.hero-beta a { color: var(--pink); font-weight: 650; }
.hero-beta a:hover { text-decoration: underline; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; margin-bottom: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: .76rem;
  font-weight: 550;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(142, 141, 170, .15);
}
.chip--ok::before   { background: var(--ok);   box-shadow: 0 0 0 3px rgba(90, 214, 160, .16); }
.chip--bad::before  { background: var(--err);  box-shadow: 0 0 0 3px rgba(255, 107, 129, .16); }
.chip--bad { color: var(--muted); }
.chip--pending { opacity: .6; }

/* ---------- layout & cards ---------- */
.layout {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: linear-gradient(180deg, var(--surface) 0%, #191926 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-sub { color: var(--muted); font-size: .84rem; margin-top: 2px; }

.step {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: .78rem;
  font-weight: 700;
  color: var(--pink);
  background: var(--pink-soft);
  border: 1px solid rgba(255, 102, 170, .25);
  margin-top: 1px;
}

/* ---------- generic controls ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.span-2 { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .78rem; font-weight: 600; color: var(--text-2); letter-spacing: .01em; }
.field-label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-2); letter-spacing: .01em; margin-bottom: 6px; }

/* "saved" flash next to a remembered field */
.saved-hint {
  font-style: normal; font-weight: 600; font-size: .72rem;
  color: var(--ok);
  opacity: 0;
  transition: opacity .25s ease;
  margin-left: 4px;
}
.saved-hint.is-visible { opacity: 1; }

.link-btn {
  border: none; background: transparent; padding: 4px 2px;
  color: var(--muted); font: inherit; font-size: .78rem; font-weight: 600;
  cursor: pointer; text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: 3px; white-space: nowrap; flex: none; align-self: flex-start;
  transition: color .14s ease, text-decoration-color .14s ease;
}
.link-btn:hover { color: var(--pink); text-decoration-color: var(--pink); }

.input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.input::placeholder { color: #5f5f7a; }
.input:hover { border-color: var(--border-2); }
.input:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px var(--pink-soft);
}
select.input { appearance: none; cursor: pointer; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .1s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.btn:hover { background: var(--surface-3); border-color: #48486a; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }

.btn-accent {
  background: linear-gradient(180deg, var(--pink) 0%, var(--pink-deep) 100%);
  border-color: transparent;
  color: #1a0d15;
}
.btn-accent:hover { filter: brightness(1.07); background: linear-gradient(180deg, var(--pink) 0%, var(--pink-deep) 100%); }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding: 7px 10px;
}
.btn-quiet:hover { background: var(--surface-2); color: var(--text); }

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 2px;
  font-size: .88rem;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.check input { accent-color: var(--pink); width: 16px; height: 16px; cursor: pointer; flex: none; }
.check:hover { color: var(--text); }

/* the upload size limit: check mark + an inline MB field that follows it */
.size-limit-row { align-items: center; margin-top: 2px; }
.size-limit-input { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--text-2); }
.size-limit-input .input-mb { width: 84px; padding: 6px 9px; text-align: right; font-variant-numeric: tabular-nums; }
.size-limit-input .unit { font-weight: 600; font-size: .78rem; }
.size-limit-input.is-disabled { opacity: .45; }
.input:disabled { cursor: not-allowed; color: var(--muted); }
#size-limit-hint { margin-top: 4px; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.badge-locked { background: var(--cyan-soft); color: var(--cyan); border: 1px solid rgba(102, 204, 255, .28); }

.note {
  margin-top: 4px;
  padding: 11px 13px;
  border-radius: var(--radius-xs);
  background: rgba(102, 204, 255, .06);
  border: 1px solid rgba(102, 204, 255, .16);
  color: var(--text-2);
  font-size: .84rem;
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.tab {
  flex: 1 1 0;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-sm); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.segmented.small { margin-bottom: 0; }
.seg {
  padding: 7px 16px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.seg:hover { color: var(--text); }
.seg.is-active { background: var(--pink-soft); color: var(--pink); }

/* ---------- dropzone ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 30px 20px;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, .18);
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.dropzone:hover { border-color: var(--pink); background: var(--pink-soft); }
.dropzone.is-over { border-color: var(--pink); background: var(--pink-soft); transform: scale(1.005); }
.dz-icon { width: 30px; height: 30px; color: var(--pink); margin-bottom: 4px; }
.dz-title { font-weight: 650; color: var(--text); font-size: .95rem; }
.dz-hint { font-size: .8rem; color: var(--muted); }
.dz-hint u { text-decoration-color: var(--pink); }

/* ---------- inline progress ---------- */
.inline-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.inline-progress-label { font-size: .8rem; color: var(--muted); white-space: nowrap; }

.bar {
  flex: 1 1 auto;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  overflow: hidden;
}
.bar.big { height: 9px; }
.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  transition: width .28s ease;
}

/* ---------- youtube preview ---------- */
.yt-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-deep);
}
.yt-thumb { width: 110px; height: 62px; object-fit: cover; border-radius: var(--radius-xs); background: var(--surface-2); flex: none; }
.yt-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.yt-meta strong, .yt-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- selected source + recent ---------- */
.selected-source {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 102, 170, .3);
  background: linear-gradient(100deg, var(--pink-soft), rgba(102, 204, 255, .05));
}
.sel-thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; }
.sel-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.sel-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--pink); font-weight: 700; }
.sel-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-facts { display: flex; gap: 7px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.sel-facts span { display: inline-flex; align-items: center; gap: 5px; }
.sel-facts span + span::before { content: "·"; color: #6f6e8c; margin-right: 5px; }

.recent { margin-top: 14px; }
.recent > summary {
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 2px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.recent > summary::-webkit-details-marker { display: none; }
.recent > summary::before {
  content: "›";
  display: inline-block;
  transition: transform .16s ease;
  font-size: 1.1rem;
  line-height: 1;
}
.recent[open] > summary::before { transform: rotate(90deg); }
.recent > summary:hover { color: var(--text); }
.count {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: .72rem;
}

.recent-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: var(--bg-deep);
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.recent-item:hover { border-color: var(--border-2); background: var(--surface-2); }
.recent-item.is-selected { border-color: var(--pink); background: var(--pink-soft); }
.ri-thumb { width: 44px; height: 30px; border-radius: 5px; object-fit: cover; background: var(--surface-2); flex: none; }
.ri-thumb.placeholder { display: grid; place-items: center; color: var(--muted); font-size: .68rem; font-weight: 700; }
.ri-body { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.ri-name { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-meta { font-size: .74rem; color: var(--muted); }
.ri-del {
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 1rem; line-height: 1; padding: 5px 7px; border-radius: 6px;
}
.ri-del:hover { background: rgba(255, 107, 129, .14); color: var(--err); }
.empty-note { color: var(--muted); font-size: .82rem; padding: 10px 2px; }

/* ---------- style picker ---------- */
.style-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.style-card {
  text-align: left;
  padding: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, transform .1s ease;
}
.style-card:hover { border-color: var(--border-2); transform: translateY(-1px); }
.style-card.is-active {
  border-color: var(--pink);
  background: linear-gradient(160deg, var(--pink-soft), rgba(102, 204, 255, .05));
  color: var(--text);
}
.style-card strong { display: block; font-size: .9rem; margin-bottom: 4px; }
.style-card span { font-size: .77rem; color: var(--muted); line-height: 1.35; }
.style-card.is-active span { color: var(--text-2); }

/* ---------- sliders ---------- */
.slider-row { margin-bottom: 6px; }
.slider-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.slider-head label { font-size: .82rem; font-weight: 600; color: var(--text-2); }
.slider-value { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--pink); font-size: 1rem; }
.slider-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink) var(--fill, 50%), var(--surface-3) var(--fill, 50%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--pink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
input[type="range"]::-moz-range-track { height: 5px; border-radius: 999px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 5px; border-radius: 999px; background: var(--pink); }
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 3px solid var(--pink);
}

.tier-pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  background: var(--pink-soft);
  color: var(--pink);
  border: 1px solid rgba(255, 102, 170, .25);
}
.keys-lock { display: flex; align-items: center; gap: 9px; align-self: end; padding-bottom: 8px; flex-wrap: wrap; }

/* single / spread */
.diff-toggles { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.diff-toggles .segmented { margin-bottom: 0; }
.spread-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.spread-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-deep);
  transition: border-color .14s ease, background .14s ease, opacity .14s ease;
}
.spread-chip.is-on { border-color: var(--tier-color, var(--pink)); background: var(--tier-soft, var(--pink-soft)); }
.spread-chip:not(.is-on) { opacity: .62; }
.spread-chip .sc-name {
  border: none; background: transparent; padding: 4px 10px; border-radius: 999px;
  color: var(--muted); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer;
  transition: color .14s ease, background .14s ease;
}
.spread-chip.is-on .sc-name { color: var(--tier-color, var(--pink)); }
.spread-chip .sc-name:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.spread-chip .sc-stars.input { width: 62px; padding: 4px 6px; font-size: .84rem; text-align: right; font-variant-numeric: tabular-nums; }
.spread-chip .sc-stars:disabled { opacity: .5; cursor: not-allowed; }
.spread-chip .sc-star { color: var(--tier-color, var(--pink)); font-size: .8rem; }
.spread-chip:not(.is-on) .sc-star { color: var(--muted); }

.advanced { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.advanced > summary {
  cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--muted);
  list-style: none; display: flex; align-items: center; gap: 8px; padding: 2px;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: "›"; font-size: 1.1rem; line-height: 1; transition: transform .16s ease; }
.advanced[open] > summary::before { transform: rotate(90deg); }
.advanced > summary:hover { color: var(--text); }
.advanced .grid-3, .advanced .grid-4 { margin-top: 12px; }
.advanced p { margin-top: 8px; }
.advanced p:empty { display: none; }
input[type="number"].input { -moz-appearance: textfield; appearance: textfield; }

/* ---------- background picker ---------- */
.bg-picker { margin-bottom: 6px; }
.bg-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.bg-row .segmented { margin-bottom: 0; }
.bg-preview { display: flex; align-items: center; gap: 10px; margin: 0; }
.bg-thumb {
  width: 96px; height: 54px; object-fit: cover; flex: none;
  border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface-2);
  opacity: .55; transition: opacity .16s ease, border-color .16s ease;
}
.bg-preview.is-active .bg-thumb { opacity: 1; border-color: var(--pink); }
#bg-hint { margin-top: 8px; }

/* ---------- go ---------- */
.go-bar { display: flex; align-items: center; gap: 14px; margin: 6px 0 2px; flex-wrap: wrap; }
.btn-go {
  flex: 1 1 260px;
  padding: 15px 26px;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: .02em;
  border: none;
  border-radius: 14px;
  color: #1a0d15;
  background: linear-gradient(120deg, var(--pink) 0%, #ff85bb 50%, var(--pink-deep) 100%);
  box-shadow: 0 10px 30px rgba(255, 102, 170, .28);
}
.btn-go:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 14px 38px rgba(255, 102, 170, .36); }
.btn-go:disabled { background: var(--surface-2); color: var(--muted); box-shadow: none; }
.go-hint { color: var(--muted); font-size: .82rem; }

/* ---------- progress card ---------- */
.card-progress { border-color: rgba(102, 204, 255, .25); }
.progress-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.progress-head strong { flex: 1 1 auto; font-size: .95rem; }
.job-pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--cyan); }
.card-progress .muted { margin-top: 10px; }

.spinner {
  width: 15px; height: 15px; flex: none;
  border-radius: 50%;
  border: 2px solid rgba(102, 204, 255, .25);
  border-top-color: var(--cyan);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- result ---------- */
.card-result { border-color: rgba(255, 102, 170, .3); }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.result-kicker { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ok); font-weight: 700; margin-bottom: 3px; }
.result-head h2 { font-size: 1.22rem; line-height: 1.3; }

.stars-badge {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 9px 15px;
  border-radius: 12px;
  background: var(--tier-soft, var(--pink-soft));
  border: 1px solid var(--tier-color, var(--pink));
  color: var(--tier-color, var(--pink));
  flex-wrap: wrap;
}
.stars-value { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.stars-star { font-size: .95rem; }
.stars-target { font-size: .72rem; color: var(--muted); width: 100%; text-align: right; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 9px; margin-bottom: 18px; }
.stat {
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--bg-deep);
  border: 1px solid var(--border);
}
.stat dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 3px; }
.stat dd { margin: 0; font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
/* the ".osz size" tile: the limit sits under the value; amber when the file is over it */
.stat-limit { display: block; margin-top: 2px; font-size: .68rem; color: var(--muted); }
.stat.is-over { border-color: rgba(255, 199, 107, .45); background: rgba(255, 199, 107, .07); }
.stat.is-over dd, .stat.is-over .stat-limit { color: var(--warn); }
.size-fit-line {
  margin: -10px 0 18px; font-size: .78rem; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.size-fit-line::before { content: "\2193 "; color: var(--warn); font-weight: 700; }

/* every difficulty of a spread */
.diff-list-wrap { margin-bottom: 18px; }
.diff-list-wrap h3 { margin-bottom: 8px; }
.diff-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.diff-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-deep);
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.diff-row:hover { border-color: var(--border-2); background: var(--surface-2); }
.diff-row.is-active { border-color: var(--pink); background: var(--pink-soft); }
.diff-badge {
  flex: none; min-width: 64px; text-align: center;
  padding: 4px 9px; border-radius: 999px;
  font-size: .8rem; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--tier-color, var(--pink));
  background: var(--tier-soft, var(--pink-soft));
  border: 1px solid var(--tier-color, var(--pink));
}
.diff-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.diff-version { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diff-facts { font-size: .76rem; color: var(--muted); }
.diff-flag {
  flex: none; font-size: .7rem; font-weight: 700; color: var(--warn);
  background: rgba(255, 199, 107, .1); border: 1px solid rgba(255, 199, 107, .25);
  border-radius: 999px; padding: 2px 8px;
}
.diff-preview-hint { flex: none; font-size: .72rem; color: var(--muted); font-weight: 600; }
.diff-row.is-active .diff-preview-hint { color: var(--pink); }

.result-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 18px; }
.result-col { min-width: 0; }
.result-col h3 { margin-bottom: 8px; }

.balance-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.balance-list li {
  display: flex; align-items: center; gap: 8px;
  font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--text-2);
  padding: 4px 8px; border-radius: 6px; background: var(--bg-deep);
}
.balance-list .bi-n { color: var(--muted); width: 16px; }
.balance-list .bi-d { color: var(--cyan); }
.balance-list .bi-arrow { color: #6f6e8c; }
.balance-list .bi-s { color: var(--pink); font-weight: 700; margin-left: auto; }

.warn-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.warn-list li {
  font-size: .78rem; color: var(--warn);
  background: rgba(255, 199, 107, .08);
  border: 1px solid rgba(255, 199, 107, .2);
  border-radius: 6px; padding: 6px 9px;
}
.result-actions { margin-top: 4px; }
.feedback-line {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  line-height: 1.55;
  max-width: 68ch;
}

/* ---------- error ---------- */
.card-error { border-color: rgba(255, 107, 129, .35); }
.card-error h2 { color: var(--err); margin-bottom: 10px; }
.error-text {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--text-2);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 12px;
  margin: 0 0 14px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
}

/* ---------- footer ---------- */
.site-footer { margin-top: 10px; text-align: center; color: var(--muted); font-size: .76rem; }

/* ---------- page prose (the part search engines and newcomers read) ---------- */
.prose {
  max-width: 72ch;
  margin: 26px auto 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.7;
}
.prose h2 {
  color: var(--text);
  font-size: 1.05rem;
  margin: 26px 0 10px;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 {
  /* the global h3 is an uppercase UI label; a question set in caps reads as shouting */
  color: var(--text);
  font-size: .92rem;
  margin: 18px 0 4px;
  text-transform: none;
  letter-spacing: -.01em;
}
.prose p { margin: 0 0 10px; }
.prose ol { margin: 0 0 10px; padding-left: 20px; }
.prose li { margin-bottom: 7px; }
.prose strong { color: var(--text); }
.prose-closing { margin-top: 18px; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(380px, calc(100vw - 36px));
}
.toast {
  padding: 11px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font-size: .85rem;
  box-shadow: var(--shadow);
  animation: toast-in .22s ease;
  word-break: break-word;
}
.toast--error { border-color: rgba(255, 107, 129, .5); background: #2a1a22; }
.toast--ok    { border-color: rgba(90, 214, 160, .45); background: #16261f; }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */
/* Five style cards: auto-fit gives 5-up from ~890px; in the band below that it
   would leave a lone fifth card, so use a balanced 3 + 2 there. */
@media (min-width: 761px) and (max-width: 886px) {
  .style-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .site-header { padding: 34px 16px 16px; }
  .layout { padding: 10px 14px 60px; }
  .card { padding: 16px; }
  .grid-2, .grid-3, .result-cols { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .style-grid { grid-template-columns: 1fr 1fr; }
  .card-head { flex-wrap: wrap; }
  .card-head .link-btn { margin-left: 38px; }
  .wordmark { font-size: 1.85rem; }
  .hero-line { font-size: .95rem; }
  .yt-preview { flex-wrap: wrap; }
  .yt-thumb { width: 84px; height: 48px; }
  .yt-preview .btn { width: 100%; }
  .stars-badge { width: 100%; justify-content: flex-start; }
  .stars-target { text-align: left; }
  .toasts { left: 14px; right: 14px; max-width: none; }
}

@media (max-width: 460px) {
  .style-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .chips { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- youtube playlists + batch results ---------- */
.yt-playlist {
  margin-top: 14px; padding: 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-deep);
}
.yt-playlist-head { display: flex; align-items: center; gap: 14px; }
.yt-playlist-head .yt-meta { flex: 1 1 auto; }
.yt-playlist-list {
  list-style: none; margin: 12px 0 8px; padding: 0;
  max-height: 220px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
}
.yt-playlist-list li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 4px 8px; border-radius: var(--radius-xs); font-size: .82rem;
}
.yt-playlist-list li:nth-child(odd) { background: var(--surface-2); }
.yt-playlist-list .ytp-index { flex: none; width: 2.2em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.yt-playlist-list .ytp-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-playlist-list .ytp-dur { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.batch-list { margin-bottom: 18px; max-height: 420px; overflow-y: auto; }
.batch-list .diff-row.is-error { cursor: default; border-color: rgba(255, 120, 120, .35); }
.batch-list .diff-row.is-error:hover { background: var(--bg-deep); }
.batch-list .diff-actions { flex: none; display: flex; gap: 6px; }
.batch-list .diff-actions .btn { padding: 3px 9px; font-size: .74rem; }
.btn.is-disabled { opacity: .45; pointer-events: none; }
.diff-flag.is-error { color: #ff8a8a; background: rgba(255, 120, 120, .1); border-color: rgba(255, 120, 120, .3); }

/* narrow screens: the batch rows and the playlist head wrap instead of squeezing the song name away */
@media (max-width: 640px) {
  .batch-list .diff-row { flex-wrap: wrap; }
  .batch-list .diff-body { flex: 1 1 60%; min-width: 140px; }
  .batch-list .diff-actions { flex: 1 1 100%; justify-content: flex-end; }
  .yt-playlist-head { flex-wrap: wrap; }
  .yt-playlist-head .btn { flex: 1 1 100%; }
}

/* ---------- the beta tag in the hero ---------- */
.beta-tag {
  display: inline-block;
  margin-right: 7px;
  font-size: .66rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  color: var(--pink); background: var(--pink-soft); border: 1px solid rgba(255, 102, 170, .4);
}
body.is-hosted .local-only { display: none !important; }
