:root { 
  --bg: #0b0b0b; 
  --fg: #f3f3f3; 
  --sub: #a0a0a0; 
  --card: #151515; 
  --border: #262626; 
  --title-max-ch: 42ch; 
}
@media (max-width: 600px) {
  :root { --title-max-ch: 34ch; }
}
* { 
  box-sizing: border-box; 
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; 
}

html, body { 
  margin: 0; 
  padding: 0; 
  background: var(--bg); 
  color: var(--fg); 
}
header { 
  padding: 24px 16px; 
  border-bottom: 1px solid var(--border); 
  max-width: 1200px; 
  margin: 0 auto; 
}

main {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
}
.card { 
  background: var(--card); 
  border: 1px solid var(--border); 
  border-radius: 12px; 
  padding: 16px; 
}

h2 { 
  margin: 0 0 12px; 
  font-size: 16px; 
  cursor: default;
  user-select: none;
}

h3 { 
  margin: 0 0 12px; 
  font-size: 14px; 
  color: var(--sub); 
  cursor: default;
  user-select: none;
}

h4 { 
  margin: 0 0 8px; 
  font-size: 13px; 
  color: var(--sub); 
  cursor: default;
  user-select: none;
}

.grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
  gap: 12px; 
}

label { 
  display: flex; 
  flex-direction: column; 
  gap: 6px; 
  font-size: 13px; 
  color: var(--sub); 
  margin-top: 12px; /* Consistent spacing between form elements */
  cursor: default;
  user-select: none;
}

/* First label shouldn't have top margin */
label:first-child {
  margin-top: 0;
}

label.inline { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
}
input, select, button { 
  padding: 10px 12px; 
  border-radius: 10px; 
  border: 1px solid var(--border); 
  background: #0f0f0f; 
  color: var(--fg);
  transition: background 0.2s ease, border-color 0.2s ease;
}

input[type="text"]:hover {
  background: #1a1a1a;
  border-color: #404040;
}

/* Custom number input spinner buttons */
input[type="number"] {
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: none;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Number input wrapper with custom buttons */
.number-input-wrapper {
  position: relative;
  display: flex;
}

.number-input-wrapper input[type="number"] {
  padding-right: 25px;
  width: 100%;
}

.number-input-wrapper:hover input[type="number"] {
  background: #1a1a1a;
}

.spinner-buttons {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  display: flex;
  flex-direction: column;
  width: 24px;
  border-radius: 0 9px 9px 0;
  overflow: hidden;
}

.spinner-btn {
  flex: 1;
  background: #0f0f0f;
  border: none;
  border-left: 1px solid var(--border);
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  transition: background 0.2s ease;
}

.spinner-btn:first-child {
  border-bottom: 1px solid var(--border);
}

.spinner-btn:hover {
  background: var(--ui-accent, #7c3aed);
}
button { cursor:pointer; }
#stats { margin-bottom:8px; color:var(--sub); font-size:13px; }
ul { margin:0; padding:0; list-style:none; display:grid; gap:6px; }
li { padding:8px 10px; border:1px solid var(--border); border-radius:8px; background:#0f0f0f; }
li.no-tracks { cursor: default; user-select: none; }
small { color:var(--sub); }

/* File Analysis Styles */
.file-analysis { margin-bottom: 20px; }
.analysis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-item { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 11px; color: var(--sub); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 14px; font-weight: 500; cursor: default; user-select: none; }

/* Energy Chart Styles */
.energy-chart { margin-top: 16px; }
.energy-bars { display: grid; gap: 8px; }
.energy-bar { display: flex; align-items: center; gap: 12px; }
.energy-label { width: 50px; font-size: 11px; color: var(--sub); }
.energy-bar-fill { height: 8px; background: linear-gradient(90deg, #4ade80, #fbbf24, #f87171); border-radius: 4px; min-width: 4px; }
.energy-count { font-size: 11px; color: var(--sub); min-width: 20px; text-align: right; }

/* Playlist Stats Styles */
.playlist-stats { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.playlist-info { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; }
.playlist-info span { color: var(--sub); cursor: default; user-select: none; }

/* Track Display Styles */
.track-info { display: flex; justify-content: space-between; align-items: center; }
.track-main { display: grid; grid-template-columns: auto var(--title-max-ch) 1fr; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.track-title { 
  font-weight: 500; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  min-width: 0; 
  width: var(--title-max-ch); 
  grid-column: 2;
  margin-right: 16px;
  max-width: calc(var(--title-max-ch) - 16px);
  padding-right: 12px;
  cursor: default;
}
.track-artist { 
  color: var(--sub); 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  min-width: 0; 
  grid-column: 3; 
  text-align: left;
  padding-right: 16px;
  cursor: default;
}
.track-number { position: relative; color: var(--sub); grid-column: 1; display: inline-flex; align-items: center; justify-content: center; min-width: 36px; padding: 6px 4px; border-radius: 6px; cursor: pointer; }
.track-number:hover { background: rgba(255,255,255,.05); }
.track-details { 
  display: flex; 
  gap: 12px; 
  align-items: center; 
  flex-shrink: 0; 
}

/* Ensure no hover effects on chips */
.track-details:hover .bpm-chip,
.track-details:hover .track-key,
.track-details:hover .track-energy {
  opacity: 1 !important;
  transform: none !important;
}

/* Global override for any chip hover effects */
.bpm-chip:hover,
.track-key:hover,
.track-energy:hover {
  opacity: 1 !important;
  transform: none !important;
  background: var(--ui-card, #151515) !important;
}

/* Nuclear option: Disable ALL hover effects on chips */
.bpm-chip,
.track-key,
.track-energy {
  transition: none !important;
  opacity: 1 !important;
  transform: none !important;
  background: var(--ui-card, #151515) !important;
  filter: none !important;
  box-shadow: none !important;
}

/* Disable hover states completely */
.bpm-chip:hover,
.track-key:hover,
.track-energy:hover,
.track-details:hover .bpm-chip,
.track-details:hover .track-key,
.track-details:hover .track-energy,
li:hover .bpm-chip,
li:hover .track-key,
li:hover .track-energy {
  opacity: 1 !important;
  transform: none !important;
  background: var(--ui-card, #151515) !important;
  transition: none !important;
}






.track-bpm, .track-duration { font-size: 11px; color: var(--sub); }
.track-key { 
  font-size: 11px;
  width: 40px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}


.bpm-chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--ui-card, #151515) !important;
  border: 1px solid var(--ui-border, #262626);
  color: var(--sub);
  cursor: default;
  user-select: none;
}

.track-key {
  font-size: 11px;
  width: 40px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--ui-card, #151515) !important;
  cursor: default;
  user-select: none;
}

.track-energy { 
  font-size: 10px; 
  padding: 4px 8px; 
  border-radius: 4px; 
  font-weight: 600; 
  text-transform: uppercase; 
  letter-spacing: 0.5px;
  background: var(--ui-card, #151515) !important;
  border: 1px solid var(--ui-border, #262626);
  color: var(--sub) !important;
  cursor: default;
  user-select: none;
}

/* Override energy-specific background colors */
.energy-1, .energy-2, .energy-3, .energy-4, .energy-5,
.energy-6, .energy-7, .energy-8, .energy-9, .energy-10 {
  background: var(--ui-card, #151515) !important;
}

/* Swap button (shown on hover) */
.swap-btn {
  position: absolute;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 24px; height: 24px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #141414;
  color: var(--fg);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0; transition: opacity .15s ease, background .15s ease, border-color .15s ease;
}
.swap-btn:hover { background:#1a1a1a; border-color:#404040; }
/* Reveal swap on row hover, showing it over the number */
li:hover .swap-btn,
.track-info:has(.track-number:hover) .swap-btn,
.track-info:has(.track-number:focus) .swap-btn,
.swap-btn:focus { opacity: 1; }

/* Always show swap on touch devices (no hover) */
@media (hover: none), (pointer: coarse) {
  /* On touch devices, reveal on row tap */
  li:active .swap-btn,
  .swap-btn:active { opacity: 1; }
}

/* ------------------------------ */
/* New Song Load Motion (Step 1)  */
/* ------------------------------ */
:root {
  --t-out: 80ms; 
  --t-in: 120ms; 
  --ease-in: cubic-bezier(.4,0,1,1);
  --ease-out: cubic-bezier(0,0,.2,1);
  --ease-io: cubic-bezier(.4,0,.2,1);
}

/* Row container baseline */
li.track-row { position: relative; overflow: hidden; }

/* Empty-state skeleton rows */
.skeleton-row { position: relative; height: 56px; background: rgba(255,255,255,0.008); border: 1px solid rgba(255,255,255,0.015); border-radius: 8px; }
.skeleton-row::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.005) 0%, rgba(255,255,255,0.015) 50%, rgba(255,255,255,0.005) 100%);
  transform: translateX(-100%);
  animation: shimmer 3s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Centered empty overlay */
.empty-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 10; }
.empty-inner { text-align: center; background: none; border: none; padding: 0; border-radius: 0; }
.empty-title { font-weight: 700; color: var(--fg); margin-bottom: 6px; }
.empty-sub { color: var(--sub); font-size: 13px; }

/* 1) Row highlight pulse */
@keyframes rowPulse {
  0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}
li.track-row.is-loading { animation: rowPulse 200ms var(--ease-out); }

/* 2) Text in (we only animate the new content on re-render) */
@keyframes textIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.track-row.is-loading .track-title,
.track-row.is-loading .track-artist,
.track-row.is-loading .track-details { animation: textIn var(--t-in) var(--ease-out) both; }

/* Cascading reveal for freshly generated playlist */
@keyframes rowFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* 3) Icon micro-motion: rotate the SVG, not the button (button uses translate for centering) */
@keyframes spinBump {
  0% { transform: rotate(0deg) scale(1); }
  70% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(180deg) scale(1); }
}
.track-row.is-loading .swap-btn svg { transform-origin: 50% 50%; animation: spinBump 120ms var(--ease-io); }

/* Accessibility: reduced motion → keep a very fast opacity tick */
@media (prefers-reduced-motion: reduce) {
  li.track-row.is-loading { animation: none; }
  .track-row.is-loading .track-title,
  .track-row.is-loading .track-artist,
  .track-row.is-loading .track-details { animation: none; opacity: 1; }
  .track-row.is-loading .swap-btn svg { animation: none; }
}

/* Constraint Status Styles */
.constraint-status { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.constraint-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
.constraint-item { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 6px; border: 1px solid var(--border); }
.constraint-item.active { background: rgba(34, 197, 94, 0.1); border-color: #22c55e; }
.constraint-item.inactive { background: rgba(239, 68, 68, 0.1); border-color: #ef4444; }
.constraint-label { font-size: 10px; color: var(--sub); text-transform: uppercase; letter-spacing: 0.5px; cursor: default; user-select: none; }
.constraint-value { font-size: 12px; font-weight: 500; cursor: default; user-select: none; }
.constraint-count { font-size: 10px; color: var(--sub); }
.constraint-warning { background: rgba(245, 158, 11, 0.1); border: 1px solid #f59e0b; border-radius: 6px; padding: 8px; margin-top: 8px; }
.constraint-warning span { font-size: 12px; color: #fbbf24; }

/* Energy Progression Styles */
.energy-progression { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.progression-flow { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px; }
.progression-step { display: flex; align-items: center; gap: 8px; }
.progression-energy { font-size: 10px; padding: 4px 8px; border-radius: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; min-width: 50px; text-align: center; }
.progression-arrow { color: var(--sub); font-size: 14px; font-weight: bold; }
.progression-description { text-align: center; font-size: 11px; color: var(--sub); font-style: italic; cursor: default; user-select: none; }

/* Export section alignment */
#exportStatus { font-size: 12px; }
section.card label + div { margin-top: 8px; }

/* Responsive adjustments */
@media (max-width: 768px) {
  /* Preserve single-row layout on mobile so title/artist can truncate */
  .track-info { flex-direction: row; align-items: center; gap: 8px; }
  .track-details { gap: 8px; }
  .analysis-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .playlist-info { gap: 8px; }
  .constraint-grid { grid-template-columns: 1fr; }
}

/* App layout grid to match mockup */
/* duplicate 'main' block removed to avoid repetition */

/* Place sections */
.card.import { grid-column: 1; grid-row: 1; }
.card.prefs  { grid-column: 1; grid-row: 2; align-self: start; }
.card.playlist { grid-column: 2; grid-row: 1 / span 2; position: relative; }
.card.diagnostics { grid-column: 1; grid-row: 3; }
.card.export { grid-column: 2; grid-row: 3; }

/* Responsive: stack on small screens */
@media (max-width: 960px) {
  main { grid-template-columns: 1fr; grid-template-rows: auto; }
  .card.import, .card.prefs, .card.playlist, .card.diagnostics, .card.export {
    grid-column: 1; grid-row: auto;
  }
}

/* Custom-styled selects (override native appearance) */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--ui-surface, #121212);
  color: var(--ui-text, #f3f3f3);
  border: 1px solid var(--ui-border, #262626);
  border-radius: var(--ui-radius-sm, 8px);
  padding: 10px 36px 10px 12px;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%23A3A3A3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
  height: var(--control-h);
}

select:hover {
  background-color: #1a1a1a;
  border-color: #404040;
}
select:focus {
  outline: none;
  border-color: var(--ui-accent, #7c3aed);
  box-shadow: 0 0 0 3px rgba(124,58,237,.25);
}
/* Ensure consistent control height */
input[type="number"], input[type="text"], input[type="time"], select {
  min-height: 40px;
}
/* Make selects expand to label width if needed */
label > select { width: 100%; }
/* Windows/legacy fallback: drop chevron if it clips */
@supports (-ms-ime-align:auto) {
  select { padding-right: 12px; background-image: none; }
}

/* Planning overview (compact) */
.planning-overview { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.planning-overview > h3 { margin: 0 0 8px; font-size: 14px; color: var(--sub); }
.planning-overview .analysis-grid { margin-bottom: 8px; }
.planning-overview .constraint-status { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }

/* Typography & readability improvements */
:root {
  --type-title: 24px;
  --type-h2: 16px;
  --type-h3: 14px;
  --type-body: 14px;
  --type-small: 12px;
}

/* Global rhythm */
html, body { font-size: 16px; line-height: 1.5; }

header { padding: 24px; border-bottom: 1px solid var(--border); }
h1 { 
  margin: 0;
}

h1 img {
  height: 32px;
  width: auto;
  display: block;
}

/* Cards: a touch more breathing room */
.card { padding: 20px; }

/* Headings hierarchy */
h2 { margin: 0 0 12px; font-size: var(--type-h2); font-weight: 600; }
h3 { margin: 0 0 10px; font-size: var(--type-h3); font-weight: 600; color: var(--sub); }

/* Labels & inputs */
label { font-size: var(--type-small); color: var(--sub); }
input, select, button { font-size: var(--type-body); }

/* Stat blocks in planning overview */
.analysis-grid { gap: 10px; }
.stat-item { padding: 6px 0; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--sub); }
.stat-value { font-size: 16px; font-weight: 600; color: var(--fg); }

/* Constraint status cards spacing */
.constraint-grid { gap: 10px; }
.constraint-item { padding: 10px; }
.constraint-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.constraint-value { font-size: 13px; font-weight: 500; }
.constraint-count { font-size: 11px; }

/* Planning overview aesthetics */
.planning-overview { margin-bottom: 16px; padding: 12px 0 14px; border-bottom: 1px solid var(--border); }
.planning-overview > summary { list-style: none; cursor: pointer; font-size: var(--type-h3); color: var(--sub); margin-bottom: 8px; }
.planning-overview > summary::-webkit-details-marker { display: none; }

/* Playlist stats row as subtle chips */
.playlist-info { gap: 12px; }
.playlist-info span { background: rgba(255,255,255,.04); border: 1px solid var(--border); padding: 6px 10px; border-radius: 999px; font-size: 12px; color: var(--sub); }

/* Track list readability */
li { line-height: 1.45; }
.track-title { font-weight: 600; }
.track-artist { color: var(--sub); }
.track-details { gap: 10px; font-variant-numeric: tabular-nums; }
.track-bpm, .track-duration { font-size: 12px; color: var(--sub); }



/* Energy tag readability */
.track-energy { font-size: 11px; letter-spacing: .02em; }

/* Details/summary spacing tweak on mobile */
@media (max-width: 960px) {
  .playlist-info span { font-size: 11px; }
  .card { padding: 16px; }
}

/* File uploader - horizontal layout matching mock */
.uploader {
  position: relative;
  display: flex;
  align-items: center;
  padding: 18px 24px;
  border: 1px solid var(--ui-border, #262626);
  border-radius: 24px;
  background: var(--ui-card, #151515);
  cursor: pointer;
  transition: all 0.2s ease;
}

.uploader-content {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

/* duplicate .uploader block removed */

.uploader .tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 28px;
  background: #111;
  color: #fff;
  border: 1px solid var(--border);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}

.uploader:hover .tooltip {
  opacity: 1;
  transform: translateY(0);
}

.uploader-iconbox {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.uploader-iconbox svg {
  color: white;
  width: 24px;
  height: 24px;
}

.uploader-text {
  flex: 1;
}

.uploader-label {
  color: var(--ui-muted, #a3a3a3);
  font-size: 16px;
  font-weight: 500;
}

.uploader:hover {
  background: #1a1a1a;
  border-color: #404040;
}

.uploader.dragover {
  background: rgba(124,58,237,.08);
  border-color: var(--ui-accent, #7c3aed);
}

/* Playlist header */
.playlist-header { margin-bottom:17px; }
.playlist-header .title-wrap { display:flex; flex-direction:column; gap:6px; }
.title-row { display:flex; align-items:center; gap:12px; }
#headerDownloadBtn.inline-icon-btn .label { display:none; }
.meta-row { display:none; }
.title-row { display:flex; align-items:center; gap:12px; }
.title-row .meta { margin-left:auto; color: var(--sub); font-size: 13px; cursor: default; user-select: none; white-space: nowrap; }
#playlistName {
  background: transparent; border: none; outline: none; color: var(--fg);
  font-size: 32px; font-weight: 800; letter-spacing: .3px; padding: 0; width: 100%;
  transition: background 0.2s ease, color 0.2s ease;
  border-radius: 4px;
  padding: 4px 8px;
  margin: -4px -8px;
}
#playlistName:hover {
  background: #1a1a1a;
  color: #ffffff;
}
#playlistName:focus { 
  box-shadow: 0 2px 0 0 var(--ui-accent); 
  background: #1a1a1a;
}
.playlist-header .meta { color: var(--sub); font-size: 13px; cursor: default; user-select: none; }

/* Compact inline download button */
#headerDownloadBtn.inline-icon-btn { display:inline-flex; align-items:center; justify-content:center; padding:6px; border-radius:999px; border:1px solid var(--border); background:transparent; color:var(--fg); cursor:pointer; width:40px; height:40px; }
#headerDownloadBtn.inline-icon-btn:hover { background:#1a1a1a; border-color:#404040; }
#headerDownloadBtn.inline-icon-btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(124,58,237,.25); }
#headerDownloadBtn.inline-icon-btn .label { display:none; }

/* Energy badge palette 1-10 (from provided image) */
.energy-1  { background:#6D7376; color:#0b0b0b; }
.energy-2  { background:#5C6E75; color:#0b0b0b; }
.energy-3  { background:#5A7884; color:#0b0b0b; }
.energy-4  { background:#56737E; color:#0b0b0b; }
.energy-5  { background:#4E7A67; color:#0b0b0b; }
.energy-6  { background:#866E41; color:#0b0b0b; }
.energy-7  { background:#A65A2A; color:#0b0b0b; }
.energy-8  { background:#CE3030; color:#0b0b0b; }
.energy-9  { background:#C81D77; color:#0b0b0b; }
.energy-10 { background:#7F00FF; color:#fff; }

/* Badge shape to match mock */
.track-energy { border-radius: 8px; padding: 6px 10px; font-weight:700; letter-spacing:.02em; }

/* Visually hidden file input but still interactive */
.visually-hidden-file {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}
/* Hide status line visually but keep for a11y */
.visually-hidden { position:absolute !important; height:1px; width:1px; overflow:hidden; clip:rect(1px,1px,1px,1px); white-space:nowrap; }

/* (removed toggle switch styles; feature removed) */

/* Global control height */
:root { --control-h: 44px; }

/* Integrated number input shell */
.number-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0f0f0f;
  height: var(--control-h);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.number-input-wrapper:hover {
  background: #1a1a1a;
  border-color: #404040;
}

/* Make the real input transparent and borderless inside the shell */
.number-input-wrapper input[type="number"] {
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
  flex: 1 1 auto;
  height: 100%;
  border: none !important;
  background: transparent !important;
  color: var(--fg);
  padding: 0 28px 0 12px; /* leave room for spinner */
  font-size: inherit;
}
.number-input-wrapper input[type="number"]:focus {
  outline: none;
}

/* Spinner column fully inside the shell */
.spinner-buttons {
  position: absolute;
  top: 1px; bottom: 1px; right: 1px;
  width: 28px;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);
  border-radius: 0 9px 9px 0;
  overflow: hidden;
  background: transparent;
}
.spinner-btn {
  flex: 1; min-height: 0;
  background: transparent;
  border: 0; color: var(--fg);
  cursor: pointer; display:flex; align-items:center; justify-content:center;
  transition: background .15s ease;
}
.spinner-btn:first-child { border-bottom: 1px solid var(--border); }
.spinner-btn:hover { background: #1a1a1a; }

/* Tiny chevrons using CSS triangles for crispness */
.spinner-btn.up::before, .spinner-btn.down::before {
  content: ""; display:block; width:0; height:0; border-left:6px solid transparent; border-right:6px solid transparent;
}
.spinner-btn.up::before { border-bottom:7px solid #eaeaea; }
.spinner-btn.down::before { border-top:7px solid #eaeaea; }

#stopAllBtn:hover {
  background: var(--ui-hover);
  border-color: var(--ui-border-hover);
}

/* Key progression controls */
#startKeyLabel {
  margin-top: 8px;
  /* Keep label and select vertically spaced consistently */
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#keyPathPreview {
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: monospace;
}

#keyPathText {
  color: var(--accent);
  font-weight: 600;
}

/* Recency controls */
.recency-controls {
  margin-top: 8px;
}

.recency-presets {
  display: flex;
  gap: 0; /* seamless */
  margin-bottom: 8px;
  background: #0f0f0f;
  border: 1px solid var(--ui-border, #262626);
  border-radius: 12px;
  padding: 4px;
}

/* ===== RECENCY BIAS SEGMENT BUTTONS - BULLETPROOF ===== */

/* Button container */
/* remove duplicate container rule (merged above) */

/* Individual button styling - very specific selectors */
.recency-presets .preset-btn { flex: 1 1 0; min-height: 40px; padding: 10px 14px; border-radius: 8px; }

/* Default button state */
.recency-presets .preset-btn {
  background: var(--ui-surface, #121212);
  color: var(--ui-text, #f3f3f3);
  border-color: var(--ui-border, #262626);
}

/* Selected button state: match segmented look (no fill, white ring) */
.recency-presets .preset-btn[aria-pressed="true"] {
  background: var(--ui-surface, #121212);
  color: var(--ui-text, #f3f3f3);
  border-color: #e5e5e5;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}

/* Hover state - ONLY for the specific button being hovered */
.recency-presets .preset-btn:hover { background-color: #1a1a1a; border-color: #404040; }

/* Focus states */
.recency-presets .preset-btn:focus {
  outline: none;
  border-color: #e5e5e5; /* match selected ring */
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}

/* Ensure hover does not override selection ring */
.recency-presets .preset-btn[aria-pressed="true"]:hover {
  background-color: #1a1a1a;
  border-color: #e5e5e5;
}

/* remove duplicate reset and redundant redefinitions */

/* Style the recency section container */
.recency-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}







.recency-info {
  margin-top: 8px; /* Increased from 4px to 6px for better separation */
  text-align: center;
}

.recency-info small {
  color: var(--sub);
  font-size: 11px;
  font-style: italic;
}
