/* ============================================================
   Lesson Studio — Phase 1 styling (on-brand, presentation-grade)
   ============================================================ */
#view-studio { padding: 0; }
.studio-wrap {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 280px;
  gap: 14px;
  padding: 16px clamp(14px, 2.5vw, 32px);
  align-items: start;
}

/* ---- left rail ---- */
.studio-rail { display: flex; flex-direction: column; gap: 18px; }
.st-group { display: flex; flex-direction: column; gap: 8px; }
.st-grouph {
  font-family: var(--f-disp, 'Sora', sans-serif); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint, #9a8c7d);
}
.st-tools { display: flex; flex-direction: column; gap: 6px; }
.st-tool, .st-btn {
  font-family: var(--f-body, 'Inter', sans-serif); font-size: 13px; text-align: left;
  padding: 9px 12px; border-radius: 9px; cursor: pointer;
  background: #241c15; color: #e7dccb; border: 1px solid #3a2e23; transition: .12s;
}
.st-tool:hover, .st-btn:hover { background: #2e241b; border-color: #57452f; }
.st-tool.on { background: #3a2c1c; border-color: #E8C36B; color: #fff; }
.st-btn.primary { background: #EC6A43; border-color: #EC6A43; color: #fff; font-weight: 600; text-align: center; }
.st-btn.primary:hover { background: #f07a55; }

.st-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.st-sw {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.st-sw.on { border-color: #fff; transform: scale(1.08); }

/* ---- canvas ---- */
.studio-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.studio-board {
  background: #17110b; border: 1px solid #33281d; border-radius: 14px;
  padding: 10px 14px; overflow: hidden;
}
.studio-board svg { width: 100%; height: auto; display: block; }
.studio-board[data-tool="add"] { cursor: crosshair; }
.studio-board[data-tool="remove"] { cursor: not-allowed; }

.studio-bctrls {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #1d160f; border: 1px solid #33281d; border-radius: 11px; padding: 10px 14px;
}
.st-inl { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #c9bdae; }
.st-inl input[type="number"] { width: 46px; }
.studio-bctrls input, .studio-bctrls select {
  background: #241c15; color: #e7dccb; border: 1px solid #3a2e23; border-radius: 6px; padding: 4px 6px; font-size: 12.5px;
}
.st-spacer { flex: 1; }
.st-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---- inspector ---- */
.studio-inspector { background: #1d160f; border: 1px solid #33281d; border-radius: 14px; padding: 16px; min-height: 200px; }
.st-insp-empty h3, .st-insp h3 { font-family: var(--f-disp, 'Sora', sans-serif); font-size: 14px; margin: 0 0 10px; color: #f2e9d8; }
.st-insp-empty p { font-size: 12.5px; color: #b3a695; line-height: 1.5; margin: 6px 0; }
.st-dim { color: #7d7061 !important; }
.st-field { margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.st-field > span { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #9a8c7d; }
.st-lbl-preview {
  font-family: var(--f-disp, 'Sora', sans-serif); font-weight: 800; font-size: 18px; color: #fff;
  background: #100b07; border: 1px solid #33281d; border-radius: 8px; padding: 6px 10px; text-align: center;
}
.st-seg { display: flex; gap: 6px; }
.st-seg button {
  flex: 1; font-size: 12px; padding: 7px 6px; border-radius: 7px; cursor: pointer;
  background: #241c15; color: #d8ccbb; border: 1px solid #3a2e23;
}
.st-seg button.on { background: #3a2c1c; border-color: #E8C36B; color: #fff; }
.st-insp input[type="text"] {
  background: #100b07; color: #f2e9d8; border: 1px solid #3a2e23; border-radius: 7px; padding: 8px 10px; font-size: 13px; width: 100%;
}
.st-insp .st-check { font-size: 12.5px; color: #c9bdae; margin: 10px 0; }
.st-danger {
  margin-top: 12px; width: 100%; padding: 9px; border-radius: 8px; cursor: pointer;
  background: transparent; color: #d98b6a; border: 1px solid #6a4030; font-size: 12.5px;
}
.st-danger:hover { background: #2a1a12; }

/* ---- export modal ---- */
.studio-modal { position: fixed; inset: 0; background: rgba(8,5,3,.72); display: flex; align-items: center; justify-content: center; z-index: 200; }
.studio-modal[hidden] { display: none; }
.st-modal-card { background: #1d160f; border: 1px solid #43362a; border-radius: 14px; width: min(680px, 92vw); padding: 18px; }
.st-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.st-modal-head h3 { font-family: var(--f-disp, 'Sora', sans-serif); font-size: 15px; margin: 0; color: #f2e9d8; }
.st-x { background: none; border: none; color: #b3a695; font-size: 22px; cursor: pointer; line-height: 1; }
#stExportText { width: 100%; height: 320px; background: #100b07; color: #cfead0; border: 1px solid #33281d; border-radius: 9px; padding: 12px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; resize: vertical; }
.st-modal-foot { display: flex; justify-content: flex-end; margin-top: 12px; }

/* ============================================================
   Map Edit mode — floating toolbar + editing cursor
   ============================================================ */
#editModeBtn.on { background: #EC6A43; border-color: #EC6A43; color: #fff; }
.fretboard.map-editing { cursor: crosshair; }
.map-edit-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #1d160f; border: 1px solid #43362a; border-radius: 11px;
  padding: 8px 12px; margin: 0 0 10px;
}
.meb-group { display: flex; align-items: center; gap: 6px; }
.meb-tool, .meb-btn, .meb-mini {
  font-family: var(--f-body, 'Inter', sans-serif); font-size: 12.5px; cursor: pointer;
  padding: 6px 11px; border-radius: 8px; background: #241c15; color: #e7dccb; border: 1px solid #3a2e23;
}
.meb-tool:hover, .meb-btn:hover, .meb-mini:hover { background: #2e241b; }
.meb-tool.on { background: #3a2c1c; border-color: #E8C36B; color: #fff; }
.meb-swatches { gap: 5px; }
.meb-sw { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.meb-sw.on { border-color: #fff; transform: scale(1.1); }
.meb-spacer { flex: 1; }
.meb-sel { gap: 8px; }
.meb-seltag { font-size: 12px; color: #c9bdae; font-family: 'IBM Plex Mono', monospace; }
.meb-mini { padding: 4px 9px; font-size: 11.5px; }
.meb-del { color: #d98b6a; border-color: #6a4030; }

/* Map Edit — label toggle, pen, collapse cards */
.meb-lbl { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #9a8c7d; }
.meb-check { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: #c9bdaf; cursor: pointer; white-space: nowrap; }
.meb-check input { accent-color: #E8C36B; cursor: pointer; }
.meb-seg { display: inline-flex; gap: 4px; }
.meb-seg button { font-size: 11.5px; padding: 5px 9px; border-radius: 7px; cursor: pointer; background: #241c15; color: #d8ccbb; border: 1px solid #3a2e23; }
.meb-seg button.on { background: #3a2c1c; border-color: #E8C36B; color: #fff; }
.chord-cards-head { display: flex; padding: 2px 0 6px; }
.cards-collapse {
  font-family: var(--f-body, 'Inter', sans-serif); font-size: 11.5px; cursor: pointer;
  padding: 4px 11px; border-radius: 7px; background: #241c15; color: #b3a695; border: 1px solid #3a2e23;
}
.cards-collapse:hover { background: #2e241b; color: #e7dccb; }
.chord-cards-row.collapsed { display: none; }

/* Map Edit — per-tool cursors, no text-selection, thickness presets */
.fretboard, .fretboard text, .fretboard tspan { -webkit-user-select: none; user-select: none; }
.fretboard[data-tool="add"], .fretboard[data-tool="line"], .fretboard[data-tool="arrow"], .fretboard[data-tool="dashed"] { cursor: crosshair; }
.fretboard[data-tool="select"] { cursor: default; }
.fretboard[data-tool="pen"] { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="M3 19 L5.5 13 L15 3.5 L18.5 7 L9 16.5 Z" fill="white" stroke="black" stroke-width="1.1"/><path d="M3 19 L5.5 13 L8 15.5 Z" fill="black"/></svg>') 3 19, crosshair; }
.fretboard[data-tool="eraser"] { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M4 4 L16 16 M16 4 L4 16" stroke="black" stroke-width="4.5" stroke-linecap="round"/><path d="M4 4 L16 16 M16 4 L4 16" stroke="white" stroke-width="2.5" stroke-linecap="round"/></svg>') 10 10, cell; }
.meb-thick[hidden] { display: none; }
.meb-w { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 26px; padding: 0; border-radius: 7px; cursor: pointer; background: #241c15; border: 1px solid #3a2e23; }
.meb-w span { display: block; width: 16px; border-radius: 3px; background: #cdbfa9; }
.meb-w.on { border-color: #E8C36B; background: #3a2c1c; }
.meb-w.on span { background: #fff; }

/* Map Edit — hide the bar when off (class beats [hidden] otherwise), + new controls */
.map-edit-bar[hidden] { display: none !important; }
.meb-shapes { gap: 4px; }
.meb-shape { width: 28px; height: 26px; padding: 0; font-size: 13px; border-radius: 7px; cursor: pointer; background: #241c15; color: #cdbfa9; border: 1px solid #3a2e23; }
.meb-shape.on { background: #3a2c1c; border-color: #E8C36B; color: #fff; }
.meb-fill { font-size: 11.5px; padding: 5px 9px; border-radius: 7px; cursor: pointer; background: #241c15; color: #d8ccbb; border: 1px solid #3a2e23; }
.meb-fill.on { background: #3a2c1c; border-color: #E8C36B; color: #fff; }
.meb-select { background: #241c15; color: #e7dccb; border: 1px solid #3a2e23; border-radius: 7px; padding: 5px 6px; font-size: 12px; }

/* chord-card collapse icon (next to "Chord 1") — collapses all card bodies */
.cards-collapse-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-left: 6px; padding: 0; vertical-align: middle;
  border-radius: 5px; cursor: pointer; font-size: 11px; line-height: 1;
  background: rgba(255,255,255,.06); color: #cdbfa9; border: 1px solid rgba(255,255,255,.12);
  transition: transform .15s;
}
.cards-collapse-ico:hover { background: rgba(255,255,255,.12); color: #fff; }
.chord-cards-row.body-collapsed .cards-collapse-ico { transform: rotate(-90deg); }
/* Compact-chip: whole-row collapse keeps only the identity header (.cc-head);
   hides the quality row, summary strip, and body. */
.chord-cards-row.body-collapsed .chord-card > *:not(.cc-head):not(.chord-card-label):not(.chord-card-actions) { display: none; }
.chord-cards-row.body-collapsed .chord-card { min-height: 0; padding-top: 8px; padding-bottom: 8px; }

/* Map Edit — stable toolbar (no reflow on toggles) + dashed control */
.meb-fill { min-width: 60px; text-align: center; }
.meb-sel { min-width: 208px; }
.meb-dash { font-size: 13px; line-height: 1; color: #cdbfa9; }
.meb-dash.on { background: #3a2c1c; border-color: #E8C36B; color: #fff; }

/* Compact vertical Clear-All so the Key Center bar never grows a row */
.clear-btn-stack {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0; line-height: 1; padding: 3px 9px; min-width: 0;
}
.clear-btn-stack .x { font-size: 15px; line-height: 1; margin: 0; }
.clear-btn-stack .cl-l { font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; line-height: 1.1; }

/* Map Edit — text tool input + text cursor */
.fretboard[data-tool="text"] { cursor: text; }
.meb-textedit {
  position: fixed; z-index: 300; background: rgba(23,16,10,.96);
  border: 1px solid #E8C36B; border-radius: 6px; padding: 4px 9px;
  font-family: 'Sora', sans-serif; font-weight: 700; font-size: 16px;
  min-width: 130px; outline: none;
}
/* Map Edit — text label editor popover */
.meb-textpop { position: fixed; z-index: 320; width: 300px; background: #1b1510; border: 1px solid #4a3d2e; border-radius: 12px; padding: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.55); display: flex; flex-direction: column; gap: 9px; }
.meb-textpop .meb-textedit { position: static; z-index: auto; width: 100%; box-sizing: border-box; min-width: 0; color: #F5F1E8; background: #100b07; border-color: #6a583f; }
.meb-textpop .meb-textedit::placeholder { color: #8a7d6b; font-weight: 500; }
.meb-tp-sw { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.meb-tp-c { width: 22px; height: 22px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.meb-tp-c.on { border-color: #fff; }
.meb-tp-pick { width: 26px; height: 24px; padding: 0; border: 1px solid #4a3d2e; border-radius: 6px; background: none; cursor: pointer; }
.meb-tp-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.meb-tp-step { background: #2a2118; color: #e7dccb; border: 1px solid #4a3d2e; border-radius: 6px; padding: 0; width: 27px; height: 26px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.meb-tp-step svg { display: block; }
.meb-tp-step:hover { border-color: #E8C36B; }
.meb-tp-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #9a8c7d; margin-right: 2px; }
.meb-tp-sz, .meb-tp-bg, .meb-tp-del, .meb-tp-done { background: #2a2118; color: #e7dccb; border: 1px solid #4a3d2e; border-radius: 6px; padding: 4px 9px; font-size: 12px; cursor: pointer; font-family: 'Mulish', sans-serif; }
.meb-tp-sz.on, .meb-tp-bg.on { background: #E8C36B; color: #1b1510; border-color: #E8C36B; font-weight: 700; }
.meb-tp-sz:hover, .meb-tp-bg:hover, .meb-tp-del:hover, .meb-tp-done:hover { border-color: #E8C36B; }
.meb-tp-spacer { flex: 1; }
.meb-tp-done { background: #C25A38; color: #fff; border-color: #C25A38; font-weight: 700; }
.meb-tp-del { color: #d98a6a; }

/* Map Edit — text background swatches in the selection area */
.meb-bgs { display: inline-flex; gap: 4px; align-items: center; }
.meb-bg { width: 20px; height: 20px; border-radius: 5px; cursor: pointer; border: 1px solid #3a2e23; font-size: 11px; color: #b3a695; background: #241c15; line-height: 1; padding: 0; }
.meb-bg.on { border-color: #fff; transform: scale(1.1); }

/* Map Edit — image export preview modal */
.exp-modal { position: fixed; inset: 0; background: rgba(8,5,3,.78); display: none; align-items: center; justify-content: center; z-index: 6500; }   /* above a hover-raised chord card (6000) */
.exp-card { background: #1d160f; border: 1px solid #43362a; border-radius: 14px; width: min(920px, 94vw); max-height: 92vh; overflow: auto; padding: 18px; }
.exp-preview { margin: 12px 0; text-align: center; background: #0e0a06; border: 1px solid #33281d; border-radius: 8px; padding: 12px; }
.exp-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
/* export filename field (left of the download buttons) */
.exp-name-lbl { display: inline-flex; align-items: center; gap: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: #9a8b7a; }
.exp-name { background: #140f0a; border: 1px solid #43362a; border-radius: 7px; color: #e7dccb; font-family: 'IBM Plex Mono', monospace; font-size: 12px; padding: 6px 9px; min-width: 240px; }
.exp-name:focus { outline: none; border-color: #7a6446; }
.exp-name:focus-visible { outline: 2px solid #E8C36B; outline-offset: 1px; }
.exp-foot-spacer { flex: 1; }

/* Map Edit — keep the toolbar clickable above the full-screen draw layer */
#mapEditBar { position: relative; z-index: 160; }

/* ============================================================
   Beat-timeline animation authoring
   ============================================================ */
.tl-modal { position: fixed; inset: 0; background: rgba(8,5,3,.8); display: none; align-items: center; justify-content: center; z-index: 420; }
.tl-card { background: #1d160f; border: 1px solid #43362a; border-radius: 14px; width: min(1120px, 96vw); max-height: 94vh; overflow: auto; padding: 18px; }
.tl-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; margin: 8px 0; }
.tl-preview { background: #17110b; border: 1px solid #33281d; border-radius: 10px; padding: 8px; }
.tl-preview svg { width: 100%; height: auto; display: block; }
.tl-caption { min-height: 34px; margin: 8px 2px; font-size: 14px; line-height: 1.45; color: #e7dccb; }
.tl-caption b { color: #fff; }
.tl-controls { display: flex; gap: 8px; margin-bottom: 12px; }
.tl-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 12.5px; color: #c9bdae; }
.tl-fields input[type="number"] { width: 58px; background: #241c15; color: #e7dccb; border: 1px solid #3a2e23; border-radius: 6px; padding: 4px 6px; }
.tl-check { display: inline-flex; align-items: center; gap: 6px; }
.tl-beats-h { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #9a8c7d; margin-bottom: 8px; }
.tl-beats { display: flex; flex-direction: column; gap: 5px; max-height: 420px; overflow: auto; }
.tl-beat { display: flex; align-items: center; gap: 6px; background: #241c15; border: 1px solid #33281d; border-radius: 8px; padding: 5px 7px; }
.tl-num { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: #7d7061; width: 18px; text-align: right; }
.tl-dot { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: 'Sora', sans-serif; font-weight: 800; font-size: 11px; flex: none; }
.tl-cap { flex: 1; min-width: 0; background: #100b07; color: #f2e9d8; border: 1px solid #3a2e23; border-radius: 6px; padding: 5px 8px; font-size: 12.5px; }
.tl-mini { width: 24px; height: 24px; padding: 0; border-radius: 6px; cursor: pointer; background: #2a2118; color: #cdbfa9; border: 1px solid #3a2e23; font-size: 12px; flex: none; }
.tl-mini.on { background: #3a2c1c; border-color: #E8C36B; color: #fff; }
.tl-del { color: #d98b6a; }
.tl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.tl-hint { font-size: 12px; color: #8f8272; }
#tlExpText { width: 100%; height: 340px; background: #100b07; color: #cfead0; border: 1px solid #33281d; border-radius: 9px; padding: 12px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

/* Map Edit — exit trap fixes + timeline drag/number polish */
#tlExportModal { z-index: 460; }               /* board-block modal sits above the timeline modal */
.tabs { position: relative; z-index: 200; }     /* nav stays clickable even while a draw tool captures the screen */
#editModeBtn { position: relative; z-index: 161; }
.meb-exit { background: #6a3423 !important; border-color: #8a4a30 !important; color: #ffd9c8 !important; font-weight: 600; }
.meb-exit:hover { background: #7d3f2a !important; }
.tl-grip { cursor: grab; color: #6f6252; font-size: 13px; user-select: none; }
.tl-num { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 700; color: #b3a695; width: 20px; text-align: right; }
.tl-beat.dragging { opacity: .5; }
.tl-beat.drop-to { border-color: #E8C36B; box-shadow: 0 -2px 0 #E8C36B inset; }

/* App chrome not text-selectable (so the pen doesn't grab menu labels); inputs + lessons stay selectable */
body { -webkit-user-select: none; user-select: none; }
input, textarea, [contenteditable="true"], #view-learn, #learnContent { -webkit-user-select: text; user-select: text; }

/* Timeline — order toggle, add-to-lesson picker, quick-guide modal */
.tl-order { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tl-addrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; }
.tl-addrow select { background: #241c15; color: #e7dccb; border: 1px solid #3a2e23; border-radius: 6px; padding: 5px 7px; font-size: 12px; max-width: 230px; }
#mapGuideModal { z-index: 470; }
.guide-tbl { width: 100%; border-collapse: collapse; margin: 8px 0; }
.guide-tbl td { padding: 5px 8px; font-size: 13px; color: #d8ccbb; border-bottom: 1px solid #2a2118; }
.guide-tbl .guide-h td { font-size: 10.5px; letter-spacing: .12em; color: #9a8c7d; padding-top: 13px; border: none; }
.guide-k { font-family: 'IBM Plex Mono', monospace; font-weight: 700; color: #E8C36B; width: 132px; white-space: nowrap; }
.guide-note { font-size: 12px; color: #8f8272; margin-top: 10px; }

/* timeline shape items (arrows/boxes/text as reveal steps) */
.tl-dot.tl-shape { background: transparent; border: 1.5px solid; font-size: 13px; font-weight: 700; }

/* Timeline — larger window + title/legend/ms/custom/publish controls */
.tl-card { width: min(1380px, 97vw); max-height: 96vh; }
.tl-beats { max-height: 44vh; }
.tl-preview { min-height: 260px; }
.tl-ms { width: 52px; background: #100b07; color: #f2e9d8; border: 1px solid #3a2e23; border-radius: 6px; padding: 5px 3px; font-size: 11.5px; text-align: center; flex: none; }
.tl-titlefield { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tl-titlefield input { flex: 1; background: #100b07; color: #f2e9d8; border: 1px solid #3a2e23; border-radius: 6px; padding: 6px 9px; font-size: 13px; }
.tl-legend-ed { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.tl-legrow { display: flex; align-items: center; gap: 8px; }
.tl-legdot { width: 16px; height: 16px; border-radius: 50%; flex: none; border: 1px solid rgba(255,255,255,.25); }
.tl-leg { flex: 1; background: #100b07; color: #f2e9d8; border: 1px solid #3a2e23; border-radius: 6px; padding: 5px 8px; font-size: 12px; }
.tl-custom { font-size: 11px; color: #7d7061; padding: 3px 9px; border: 1px dashed #4a3d2e; border-radius: 6px; }
.tl-custom.on { color: #E8C36B; border-color: #E8C36B; background: #2a2013; }
.tl-boardinfo { font-size: 11.5px; color: #8f8272; }
.tl-introf { flex: 1; min-width: 220px; background: #100b07; color: #f2e9d8; border: 1px solid #3a2e23; border-radius: 6px; padding: 6px 9px; font-size: 12.5px; }
.tl-foot { flex-direction: column; align-items: stretch; gap: 8px; }

/* Timeline — header/intro/outro rich-text fields */
.tl-textrow { display: flex; gap: 14px; margin-bottom: 4px; }
.tl-textcol { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tl-rich { border: 1px solid #3a2e23; border-radius: 8px; overflow: hidden; background: #100b07; }
.tl-rich-bar { display: flex; align-items: center; gap: 4px; padding: 4px 6px; background: #241c15; border-bottom: 1px solid #33281d; }
.tl-rich-bar button { width: 24px; height: 24px; padding: 0; border-radius: 5px; background: #2a2118; color: #cdbfa9; border: 1px solid #3a2e23; cursor: pointer; font-size: 13px; }
.tl-rich-bar button:hover { background: #37291b; }
.tl-rich-bar [data-rt="b"] { font-weight: 800; }
.tl-rich-bar [data-rt="i"] { font-style: italic; }
.tl-rich-bar select { background: #2a2118; color: #cdbfa9; border: 1px solid #3a2e23; border-radius: 5px; font-size: 11.5px; padding: 3px 4px; }
.tl-rich-bar input[type="color"] { width: 26px; height: 24px; padding: 0; border: 1px solid #3a2e23; border-radius: 5px; background: none; cursor: pointer; }
.tl-rich-ta { width: 100%; box-sizing: border-box; background: #100b07; color: #f2e9d8; border: 0; padding: 8px 10px; font-size: 12.5px; font-family: inherit; resize: vertical; min-height: 60px; line-height: 1.5; }

/* My lesson edits / load-a-board panel */
#tlEditsModal { z-index: 465; }
.me-sec { margin: 12px 0; }
.me-load { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.me-load select { background: #241c15; color: #e7dccb; border: 1px solid #3a2e23; border-radius: 6px; padding: 6px 8px; font-size: 12.5px; max-width: 250px; }
.me-hint { font-size: 11.5px; color: #8f8272; margin-top: 6px; }
.me-list { display: flex; flex-direction: column; gap: 5px; max-height: 210px; overflow: auto; margin: 6px 0; }
.me-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #241c15; border: 1px solid #33281d; border-radius: 8px; padding: 6px 10px; }
.me-lbl { font-size: 12.5px; color: #e7dccb; }
.me-lbl em { color: #8f8272; font-style: normal; font-size: 11px; }
.me-btns { display: flex; gap: 6px; flex: none; }
.me-empty { font-size: 12.5px; color: #8f8272; padding: 8px; }
.me-foot { display: flex; gap: 8px; margin-top: 8px; }
#meText { width: 100%; height: 200px; box-sizing: border-box; background: #100b07; color: #cfead0; border: 1px solid #33281d; border-radius: 9px; padding: 12px; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; margin-top: 6px; }

/* WYSIWYG paragraph editor (grows downward with content) */
.tl-rich-ed { min-height: 62px; max-height: 44vh; overflow-y: auto; box-sizing: border-box; background: #100b07; color: #f2e9d8; padding: 9px 11px; font-size: 13px; line-height: 1.55; outline: none; }
.tl-rich-ed:empty:before { content: attr(data-ph); color: #6f6252; }
.tl-rich-ed:focus { box-shadow: inset 0 0 0 1px #6b5636; }
.tl-rich-bar [data-cmd="underline"] { text-decoration: underline; }

/* Full "as in lesson" preview */
#tlPreviewModal .tl-card { width: min(940px, 96vw); max-height: 93vh; display: flex; flex-direction: column; }
#tlPreviewModal .tp-scroll { overflow-y: auto; background: var(--surface-1, #17110b); border: 1px solid var(--line, #33281d); border-radius: 12px; margin-top: 6px; }
#tlPreviewModal .tp-body { padding: 10px 6px 26px; }

/* rich-text toolbar: active-state indicators, brand presets, separator */
.tl-rich-bar button.active { background: #6b5636; color: #fff; border-color: #E8C36B; }
.tl-rich-sep { width: 1px; height: 18px; background: #3a2e23; margin: 0 3px; flex: none; }
.tl-preset { width: 26px !important; font-weight: 800 !important; font-size: 10.5px !important; }
.me-note { font-size: 11.5px; color: #a2937f; margin: 8px 0 4px; line-height: 1.5; }
.me-note code { background: #100b07; border: 1px solid #33281d; border-radius: 4px; padding: 0 4px; font-size: 11px; }

/* Import + caption-editor modals */
#tlImportModal, #tlCapModal { z-index: 468; }
#tiText { width: 100%; height: 300px; box-sizing: border-box; background: #100b07; color: #cfead0; border: 1px solid #33281d; border-radius: 9px; padding: 12px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; margin-bottom: 4px; }
.tl-cap { cursor: text; }

/* Stage map — see & clean up all blocks in a stage */
.me-map { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow: auto; margin-top: 4px; }
.me-mrow { display: flex; align-items: center; gap: 9px; background: #201a13; border: 1px solid #33281d; border-left: 3px solid #4a3d2e; border-radius: 7px; padding: 5px 8px; }
.me-mrow.is-board { border-left-color: #E8C36B; background: #241c15; }
.me-mrow.is-head { border-left-color: #EC6A43; }
.me-mtype { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #a2937f; width: 62px; flex: none; }
.me-mrow.is-board .me-mtype { color: #E8C36B; }
.me-msnip { flex: 1; min-width: 0; font-size: 12px; color: #d8ccbb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-mdel { flex: none; padding: 2px 8px; color: #d98b6a; }

/* Stage map — drag to reorder */
.me-mgrip { cursor: grab; color: #6f6252; font-size: 12px; flex: none; user-select: none; }
.me-mrow.dragging { opacity: .5; }
.me-mrow.drop-to { border-top-color: #E8C36B; box-shadow: 0 -2px 0 #E8C36B inset; }

/* Stage map — read-only stage concept row */
.me-crow { display: flex; align-items: center; gap: 9px; background: #1a1610; border: 1px dashed #4a3d2e; border-radius: 7px; padding: 5px 8px; }
.me-crow .me-mtype { color: #8f8272; width: 62px; flex: none; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.me-crow .me-msnip { flex: 1; min-width: 0; font-size: 12px; color: #b3a695; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-cnote { flex: none; font-size: 10px; color: #6f6252; font-style: italic; }

/* Stage map — inline edit buttons */
.me-medit, .me-cedit { flex: none; padding: 2px 8px; color: #cdbfa9; }

/* Edit-text modal above the Lessons panel */
#tlTextModal { z-index: 484; }
/* WYSIWYG editor renders like the lesson: Mulish body, bold/em in accent gold, lblock-lead header */
.tl-rich-ed { font-family: 'Mulish', 'Inter', sans-serif; color: #e7dccb; }
.tl-rich-ed b, .tl-rich-ed strong, .tl-rich-ed em { color: #E8C36B; font-weight: 600; font-style: normal; }
.tl-rich-ed .lblock-lead { color: #E8C36B; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 17px; display: inline-block; }
.me-tedit, .me-cedit { flex: none; padding: 2px 8px; color: #cdbfa9; }

/* ============================================================
   Studio — full-page lesson editor
   ============================================================ */
.studio-ed { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 520px; }
.sed-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 2px 12px; }
.sed-bar .sed-lbl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #9a8c7d; }
.sed-bar select { background: #241c15; color: #e7dccb; border: 1px solid #3a2e23; border-radius: 7px; padding: 7px 9px; font-size: 13px; max-width: 380px; }
.sed-status { font-size: 12px; color: #86B37A; margin-left: auto; }
.sed-status.bad { color: #e08a63; }
.sed-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px; flex: 1; min-height: 0; }
.sed-col { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border-subtle, #33281d); border-radius: 12px; overflow: hidden; background: var(--surface-1, #1d1712); }
.sed-colh { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: #9a8c7d; padding: 9px 12px; border-bottom: 1px solid #33281d; background: #241c15; flex: none; }
#sedText { flex: 1; min-height: 0; width: 100%; box-sizing: border-box; resize: none; background: #100b07; color: #cfead0; border: 0; padding: 12px; font-family: 'IBM Plex Mono', 'IBM Plex Mono', monospace; font-size: 12px; line-height: 1.5; }
.sed-pvcol { background: var(--bg-warm, #221D1A); }
.sed-pv { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 18px 30px; }
.sed-pv h1 { font-family: var(--f-head, 'Sora'); font-weight: 800; font-size: 26px; margin: 8px 0 4px; color: var(--ink, #F5F1E8); }
.sed-pv .sed-stage { border-top: 1px solid var(--line, #433730); margin-top: 18px; padding-top: 10px; }
.sed-pv .sed-stage:first-of-type { border-top: 0; }
.sed-pv .sed-stage-h { font-family: var(--f-head, 'Sora'); font-weight: 700; font-size: 15px; color: var(--ink, #F5F1E8); margin: 4px 0 6px; }
.sed-pv .sed-stage-h .tag { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--accent, #E8C36B); border: 1px solid var(--accent-deep, #C99B45); border-radius: 99px; padding: 2px 8px; margin-right: 6px; }
.sed-empty, .sed-err { color: #8f8272; font-size: 13px; }
@media (max-width: 900px) { .sed-body { grid-template-columns: 1fr; } }

/* Studio — insert-board modal */
#sedInsModal { z-index: 470; }
#sedInsModal .me-load { margin-bottom: 8px; }
#siText { width: 100%; height: 260px; box-sizing: border-box; background: #100b07; color: #cfead0; border: 1px solid #33281d; border-radius: 9px; padding: 12px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

/* Studio Phase 2 — inline-editable preview blocks */
.sed-pv .sed-blk { position: relative; }
.sed-pv .sed-blk:hover { outline: 1px dashed rgba(232,195,107,.45); outline-offset: 3px; border-radius: 6px; }
.sed-blk-tools { position: absolute; top: 3px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; z-index: 6; }
.sed-pv .sed-blk:hover > .sed-blk-tools { opacity: 1; }
.sed-mini { background: #2a2118; color: #e7dccb; border: 1px solid #4a3d2e; border-radius: 6px; padding: 2px 8px; font-size: 11px; line-height: 1.5; cursor: pointer; font-family: 'Mulish', sans-serif; white-space: nowrap; }
.sed-mini:hover { background: #37291b; border-color: #E8C36B; color: #fff; }
.sed-stage-h .sed-mini { margin-left: 6px; }
.sed-addrow { display: flex; gap: 6px; padding: 8px 24px 4px; }
.sed-addrow .sed-mini { opacity: .55; }
.sed-addrow:hover .sed-mini { opacity: 1; }
#tlTextModal { z-index: 486; }

/* Guitar Toolbag — floating diagram-tool palette in Map edit mode */
.meb-btn.meb-toolbag.on, #mebToolbag.on { background: #C25A38; color: #fff; border-color: #C25A38; }
.meb-toolbag-panel { position: fixed; right: 24px; bottom: 96px; z-index: 320; width: 232px; background: #1b1510; border: 1px solid #4a3d2e; border-radius: 14px; box-shadow: 0 16px 44px rgba(0,0,0,.55); display: flex; flex-direction: column; overflow: hidden; }
.mtb-head { display: flex; align-items: center; justify-content: space-between; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 14px; color: #E8C36B; padding: 10px 12px; border-bottom: 1px solid #33281d; background: #241c15; cursor: grab; touch-action: none; }
.mtb-x { background: none; border: 0; color: #b3a695; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.mtb-x:hover { color: #fff; }
.mtb-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; }
.mtb-tool { display: flex; align-items: center; gap: 7px; background: #2a2118; color: #e7dccb; border: 1px solid #4a3d2e; border-radius: 8px; padding: 8px 9px; font-size: 13px; cursor: pointer; font-family: 'Mulish', sans-serif; }
.mtb-tool:hover { border-color: #E8C36B; }
.mtb-tool.on { background: #C25A38; color: #fff; border-color: #C25A38; }
.mtb-tool .mtb-g { font-size: 16px; line-height: 1; width: 16px; text-align: center; }
.mtb-hint { font-size: 11.5px; line-height: 1.45; color: #a99b8a; padding: 0 12px 12px; }

/* ============================================================
   Map Edit round 3 — icon undo/redo, custom colour + hex, black
   swatch ring, off-board per-tool cursors, export hint
   ============================================================ */
/* icon-only Undo/Redo — glyph buttons, tooltip carries the shortcut, ≥24px hit target */
.meb-icon { width: 32px; min-width: 32px; height: 30px; padding: 0; text-align: center; font-size: 16px; line-height: 1; }
/* the black swatch reads on the dark toolbar */
.meb-sw[data-brush="#141414"] { box-shadow: 0 0 0 1px rgba(255,255,255,.55); }
/* custom-colour circle: rainbow ring, current colour in the middle, native picker on click */
.meb-swatches .meb-custom {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; padding: 0;
  border: 2px solid transparent; border-radius: 50%; cursor: pointer; overflow: hidden;
  background: conic-gradient(#EC6A43, #E8C36B, #43B681, #4FA0EC, #C56BD0, #EC6A43);
}
.meb-swatches .meb-custom.on { border-color: #fff; transform: scale(1.1); }
.meb-custom::-webkit-color-swatch-wrapper { padding: 4px; }
.meb-custom::-webkit-color-swatch { border: none; border-radius: 50%; }
/* single hex field — types #RRGGBB, applies to the tool colour and current selection */
.meb-hex { width: 66px; background: #140f0a; border: 1px solid #3a2e23; border-radius: 7px; color: #e7dccb; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; padding: 4px 7px; }
.meb-hex:focus { outline: none; border-color: #7a6446; }
.meb-hex:focus-visible { outline: 2px solid #E8C36B; outline-offset: 1px; }
/* per-tool cursors OFF the board (the draw layer is pointer-events:none, so the cursor
   comes from the page; interactive UI keeps its own cursor — it can't be drawn on/erased) */
body.meb-cur-eraser { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M4 4 L16 16 M16 4 L4 16" stroke="black" stroke-width="4.5" stroke-linecap="round"/><path d="M4 4 L16 16 M16 4 L4 16" stroke="white" stroke-width="2.5" stroke-linecap="round"/></svg>') 10 10, cell; }
body.meb-cur-pen { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="M3 19 L5.5 13 L15 3.5 L18.5 7 L9 16.5 Z" fill="white" stroke="black" stroke-width="1.1"/><path d="M3 19 L5.5 13 L8 15.5 Z" fill="black"/></svg>') 3 19, crosshair; }
body.meb-cur-draw { cursor: crosshair; }
/* export foot — no-save-dialog hint */
.exp-hint { font-size: 11px; color: #8f8272; }

/* Guitar Toolbag — arrow/head options row */
.mtb-opts { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 0 10px 8px; }
.mtb-olbl { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #9a8c7d; margin-right: 2px; }
.mtb-opt { background: #241c15; color: #cdbfa9; border: 1px solid #3a2e23; border-radius: 7px; padding: 4px 8px; font-size: 11.5px; cursor: pointer; font-family: 'Mulish', sans-serif; }
.mtb-opt:hover { border-color: #E8C36B; }
.mtb-opt.on { background: #E8C36B; color: #1b1510; border-color: #E8C36B; font-weight: 700; }

/* ============================================================
   THE INNER FRETBOARD STUDIO — customer product, Phase 0 shell
   Activated by body.studio-app (set only under ?studio=app). This is the
   FREE-tier standalone tool: Map only, Edit mode always on, a reduced markup
   toolbar. Purely a hiding layer over the existing app — nothing structural.
   Do NOT confuse with the internal "Lesson Builder" (#view-studio) above.
   ============================================================ */

/* Strip the course chrome: tab nav, resume chip, version pill. Keep the brand
   lockup (the fretboard fragment feeds the export watermark) and the header. */
body.studio-app nav.tabs,
body.studio-app #resumeChip,
body.studio-app #versionPill { display: none !important; }

/* No "enter/exit Edit mode" affordance in a standalone tool — Edit is always on. */
body.studio-app #editModeBtn,
body.studio-app #mebExit { display: none !important; }

/* Tier gating — STYLING ONLY. The classes are derived by js/00-entitlements.js
   from the capability service; the real authorization is Entitlements.can()
   inside 13-map-edit (tool activation, keyboard shortcuts, toolbag). These
   rules just remove the dead buttons from view. The old
   body.studio-app:not(.composer-on) hack (which re-exposed every paid tool
   whenever the composer opened) is gone — tier is tier, everywhere. */
/* Pro tools stay VISIBLE for free users (so they're discoverable) but dimmed
   with a gold Pro dot; clicking one shows the "Try Pro free" nudge (js/13 edNudge).
   During an active trial the body is tier-pro, so these rules don't apply. */
/* Line is free since 2026-09-28, so it is not in these lists. */
/* Circle + Box are free since 2026-09-30, so they are not in these lists either.
   The Guitar Toolbag is free since 2026-09-30 too (Robert: basic diagram marks). */
/* Map redesign v3 §8: the Pro tools read as ONE cluster (Spot · Darken
   after a divider) plus the three non-circle note shapes; locked
   controls keep readable labels at 70% (was 50%). */
body.tier-free #mapEditBar [data-tool="spotlight"],
body.tier-free #mapEditBar [data-tool="darken"],
body.tier-free #mapEditBar .meb-shape:not([data-shape="circle"]) { opacity: .7; position: relative; }
body.tier-free #mapEditBar [data-tool="spotlight"]::after,
body.tier-free #mapEditBar [data-tool="darken"]::after,
body.tier-free #mapEditBar .meb-shape:not([data-shape="circle"])::after {
  content: ""; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px;
  border-radius: 50%; background: #E8C36B; box-shadow: 0 0 0 1.5px #26201A;
}

/* Internal authoring tools: Animate (beat-timeline lesson authoring) and
   Lessons (add-to-lesson override panel) are AUTHORING-only — hidden for both
   customer tiers, and absent from public builds entirely. */
body.tier-free #mapEditBar #mebAnimate,
body.tier-free #mapEditBar #mebEdits,
body.tier-pro #mapEditBar #mebAnimate,
body.tier-pro #mapEditBar #mebEdits { display: none !important; }

/* ============================================================
   Map Edit bar v3 (redesign spec §8): three fixed rows grouped by function,
   in the settings bar's slot under the board. Row 1 Sets · Root · Actions;
   row 2 Tools (free, then the Pro cluster); row 3 Shape · Stroke · Color ·
   Selection · History. Words + 16px icons, 32px controls, gold selection.
   ============================================================ */
@media (min-width: 741px) { #mapEditBar.map-edit-bar {
  display: flex; flex-direction: column; align-items: stretch; gap: 10px; flex-wrap: nowrap;
  padding: 12px 16px 14px; margin: 10px 0 0; border-radius: 14px;
  background: #1d160f; border: 1px solid #43362a; } 
}
.meb-row { display: flex; align-items: flex-end; gap: 18px; min-width: 0; }
.meb-row .meb-group { flex-wrap: wrap; row-gap: 6px; column-gap: 6px; align-items: center; }
.meb-h {
  flex-basis: 100%; display: block; white-space: nowrap;
  font: 600 10.5px 'IBM Plex Mono', monospace; letter-spacing: .14em; text-transform: uppercase;
  color: color-mix(in srgb, #E8C36B 45%, #8F7F72);
}
.meb-h-sub { letter-spacing: .06em; opacity: .75; text-transform: none; font-weight: 500; }
.meb-lbl { font: 600 13px Mulish, sans-serif; letter-spacing: 0; text-transform: none; color: #8F7F72; }
#mapEditBar .meb-tool, #mapEditBar .meb-btn, #mapEditBar .meb-fill, #mapEditBar .meb-seg button {
  height: 32px; box-sizing: border-box; display: inline-flex; align-items: center; gap: 7px;
  font: 600 13px Mulish, sans-serif; padding: 0 12px 0 11px; border-radius: 999px; white-space: nowrap;
  background: transparent; color: #C9BDAF; border: 1px solid #43362a;
}
#mapEditBar .meb-seg button { border-radius: 7px; padding: 0 11px; }
#mapEditBar .meb-tool:hover, #mapEditBar .meb-btn:hover, #mapEditBar .meb-fill:hover { color: #F5F1E8; border-color: #5A4A41; background: transparent; }
#mapEditBar .meb-tool.on { background: #E8C36B; border-color: #E8C36B; color: #1A1614; }
#mapEditBar .meb-btn.on, #mapEditBar .meb-fill.on { background: rgba(232,195,107,.14); border-color: #E8C36B; color: #F5F1E8; }
#mapEditBar .meb-exit { background: transparent !important; border-color: color-mix(in srgb, #E85D4E 60%, transparent) !important; color: #F5B7AB !important; }
#mapEditBar .meb-exit:hover { background: rgba(232,93,78,.12) !important; }
.meb-kbd { font: 600 10.5px 'IBM Plex Mono', monospace; opacity: .6; margin-left: 2px; }
#mapEditBar .meb-danger { color: #F08A7C; }
#mapEditBar .meb-div { width: 1px; height: 22px; background: #43362a; margin: 0 4px; }
#mapEditBar .meb-shape, #mapEditBar .meb-w { width: 34px; height: 32px; border-radius: 8px; position: relative; }
#mapEditBar .meb-select { height: 32px; font: 600 13px Mulish, sans-serif; border-radius: 8px; padding: 0 8px; min-width: 92px; }
#mapEditBar .meb-sw { width: 22px; height: 22px; }
#mapEditBar .meb-hex { height: 30px; box-sizing: border-box; font-size: 12.5px; width: 80px; }
#mapEditBar .meb-icon { width: 34px; padding: 0; justify-content: center; }
#mapEditBar .meb-selgrp { flex: 0 1 auto; min-width: 0; }
#mapEditBar .meb-sel { min-width: 240px; height: 32px; flex-wrap: nowrap; border: 1px solid #3a2e23; border-radius: 8px; padding: 0 4px 0 10px; background: rgba(0,0,0,.2); }
#mapEditBar .meb-sel .meb-mini { height: 24px; font: 600 12.5px Mulish, sans-serif; padding: 0 9px; border-radius: 6px; }
#mapEditBar .meb-seltag { font: 500 12.5px 'IBM Plex Mono', monospace; white-space: nowrap; }
#mapEditBar .meb-none { color: #8F7F72; font-family: Mulish, sans-serif; }
#mapEditBar .meb-spacer { flex: 1 1 auto; }
#mapEditBar .kb-caret { width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-2px) rotate(45deg); }
@media (max-width: 1399px) {
  #mapEditBar .meb-tool, #mapEditBar .meb-btn { padding: 0 9px; gap: 6px; }
  .meb-row { gap: 14px; }
  #mapEditBar .meb-sel { min-width: 200px; }
  .meb-h-sub { display: none; }
}
@media (max-width: 1200px) { #mapEditBar .meb-tool.ib::before, #mapEditBar .meb-btn.ib::before { display: none; } }
@media (max-width: 1024px) { .meb-row { flex-wrap: wrap; row-gap: 8px; } }
@media (max-width: 740px) {
  #mapEditBar .meb-row { display: contents; }
  #mapEditBar .meb-h, #mapEditBar .meb-div { display: none; }
  #mapEditBar .meb-group { flex-wrap: nowrap; }
}
body.tier-free .meb-internal, body.tier-pro .meb-internal { display: none !important; }
.meb-row .meb-group { flex: none; }
.meb-row .meb-group:not(:has(> .meb-h)) { flex-wrap: nowrap; }
#mapEditBar .meb-swatches { flex-wrap: wrap; max-width: 420px; }
@media (min-width: 741px) { #mapEditBar .meb-more-btn { display: none; } }
@media (max-width: 1399px) { #mapEditBar .meb-internal .meb-btn { font-size: 0; gap: 0; width: 34px; padding: 0; justify-content: center; } }
#mapEditBar .meb-selgrp { flex: 0 1 auto !important; min-width: 150px; }
#mapEditBar .meb-sel { overflow: hidden; }
@media (max-width: 1399px) {
  .meb-row { gap: 12px; }
  #mapEditBar .meb-swatches { column-gap: 4px; }
  #mapEditBar .meb-sw { width: 20px; height: 20px; }
  #mapEditBar .meb-hex { width: 72px; }
  #mapEditBar .meb-sel { min-width: 150px; }
  #mapEditBar .meb-shape, #mapEditBar .meb-w { width: 30px; }
  #mapEditBar .meb-seg button { padding: 0 9px; }
}
#mapEditBar .meb-selgrp { flex: 1 1 0 !important; max-width: 560px; }
#mapEditBar .meb-sel { min-width: 0 !important; width: 100%; }
#mapEditBar .meb-sel > * { flex: none; }
#mapEditBar .meb-sel > .meb-seltag { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* 13" laptops (Robert 2026-10-04: at 1280–1440 the Selection field clipped
   "36 selected — pick a color, or Aa Auto · Delete all" and "○ Make root ·
   ∅ No label…", and Clear all could run off the right edge). Desktop rows now
   WRAP instead of clipping, and below 1500px the Selection field takes its own
   full-width line at the end of row 3 — always there (no height jump when you
   select something), with room for every action. */
@media (min-width: 741px) {
  #mapEditBar .meb-row { flex-wrap: wrap; row-gap: 8px; }
}
@media (min-width: 741px) and (max-width: 1499px) {
  #mapEditBar .meb-row3 .meb-selgrp { order: 10; flex: 1 1 100% !important; max-width: none; min-width: 0; }
  #mapEditBar .meb-row3 .meb-sel { width: auto; height: auto; min-height: 32px; flex-wrap: wrap; row-gap: 4px; padding: 3px 4px 3px 10px; overflow: visible; }
  #mapEditBar .meb-row3 .meb-sel > .meb-seltag { overflow: visible; text-overflow: clip; }
}
/* Free tier: Sets 3 and 4 carry the Pro dot like the other locked tools (audit L4) */
body.tier-free #mebLayer button.meb-locked { position: relative; }
body.tier-free #mebLayer button.meb-locked::after { content: ""; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: #E8C36B; box-shadow: 0 0 0 1.5px #26201A; }

/* ============================================================
   Edit round 4 (Robert 2026-09-30) — Sets: tab + visibility meter
   Each Set is one joined control: the number (click = edit this Set)
   and a three-bar meter (click = Full → Dim → Off). Three lit bars =
   Full, one = Dim, none + a strike = Off. Solo sits in the same group
   and names the Set it will solo.
   ============================================================ */
#mapEditBar .meb-setrow { display: inline-flex; gap: 6px; }
/* A wrapping group counts its heading's full text width into its own width,
   so a short heading over wide controls added ~50px of dead space per group.
   Row 1 needs that room back for the fourth Set (nothing wraps at 1280). */
#mapEditBar .meb-sets > .meb-h, #mapEditBar .meb-actions > .meb-h, #mapEditBar .meb-rootgrp > .meb-h { contain: inline-size; }
#mapEditBar .meb-rootgrp .meb-select { min-width: 118px; }   /* as wide as its "ROOT OF SET 1" heading */
#mapEditBar .meb-set { display: inline-flex; height: 32px; box-sizing: border-box; border: 1px solid #43362a; border-radius: 8px; overflow: hidden; background: transparent; }
#mapEditBar .meb-set.on { border-color: #E8C36B; box-shadow: 0 0 0 1px #E8C36B; }
/* Locked (Free: Sets 3 and 4) — Robert 2026-10-03: "items in Pro could just be
   more dim and keep the dot". The buttons dim; the gold Pro dot (drawn on the
   joined control, not inside a dimmed button) stays full strength. */
#mapEditBar .meb-set.locked::before { content: ""; position: absolute; inset: 0; background: rgba(17, 13, 10, .55); pointer-events: none; z-index: 1; transition: background .12s; }
#mapEditBar .meb-set.locked:hover::before { background: rgba(17, 13, 10, .38); }
#mapEditBar .meb-settab { width: 30px; height: 100%; padding: 0; border: 0; border-radius: 0; cursor: pointer; font: 700 13px Mulish, sans-serif; color: #C9BFB2; background: transparent; }
#mapEditBar .meb-set:not(.on) .meb-settab { opacity: .78; }
#mapEditBar .meb-vis { width: 26px; height: 100%; padding: 0; border: 0; border-left: 1px solid #43362a; border-radius: 0; cursor: pointer; background: rgba(0,0,0,.18); color: #E8C36B; display: inline-flex; align-items: center; justify-content: center; }
#mapEditBar .meb-vis:hover { background: rgba(255,255,255,.07); }
#mapEditBar .meb-vis:focus-visible, #mapEditBar .meb-settab:focus-visible { outline: 2px solid #E8C36B; outline-offset: -2px; }
.meb-bars { position: relative; display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.meb-bars i { display: block; width: 3px; border-radius: 1px; background: currentColor; opacity: .2; }
.meb-bars i:nth-child(1) { height: 5px; } .meb-bars i:nth-child(2) { height: 8px; } .meb-bars i:nth-child(3) { height: 12px; }
.meb-bars[data-lv="full"] i { opacity: 1; }
.meb-bars[data-lv="dim"] i:nth-child(1) { opacity: 1; }
.meb-bars[data-lv="hidden"] { color: #8F7F72; }
.meb-bars[data-lv="hidden"]::after { content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 1.5px; background: #F08A7C; transform: rotate(-35deg); border-radius: 1px; }
/* Solo latched (round 6): a Set's own saved setting under Solo, drawn faint */
.meb-bars[data-saved="full"] i { opacity: .7; }
.meb-bars[data-saved="dim"] i:nth-child(1) { opacity: .7; }
.meb-bars[data-lv="hidden"][data-saved] { color: #E8C36B; }
.meb-bars[data-lv="hidden"][data-saved]::after { opacity: .55; }
.meb-bars[data-saved="hidden"]::after { content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 1.5px; background: #F08A7C; transform: rotate(-35deg); border-radius: 1px; opacity: .5; }
/* the locked Set's Pro dot sits on the joined control's corner */
#mebLayer .meb-set { position: relative; }
/* Guitar Toolbag round 4: 16 tools in three labelled groups, 16px stroked
   icons in the Edit bar's family, 3 columns. Free for every tier. */
.meb-toolbag-panel { width: 318px; max-height: calc(100vh - 24px); overflow-y: auto; }
.mtb-title { display: inline-flex; align-items: center; gap: 8px; }
.mtb-tools { grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 6px 10px 10px; }
.mtb-grp { grid-column: 1 / -1; font: 600 10px 'IBM Plex Mono', monospace; letter-spacing: .12em; text-transform: uppercase; color: color-mix(in srgb, #E8C36B 45%, #8F7F72); padding: 6px 2px 0; }
.mtb-tool { flex-direction: column; justify-content: center; gap: 4px; padding: 7px 4px 6px; font: 600 11.5px Mulish, sans-serif; text-align: center; line-height: 1.15; min-height: 50px; }
.mtb-tool .mtb-i { flex: none; }
.mtb-tool.on .mtb-i { color: #fff; }
body.hw-ui .meb-toolbag-panel { border: none; border-radius: var(--hw-r-panel, 14px); background: var(--hw-panel-grad, #1b1510); box-shadow: 0 18px 50px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.07); }
body.hw-ui .mtb-tool { border: none; background: var(--hw-key-grad, #2a2118); box-shadow: 0 2px 0 #100c0a, inset 0 1px 0 rgba(255,255,255,.07); color: #C9BDAF; }
body.hw-ui .mtb-tool.on { background: var(--hw-key-lit-grad, #E8C36B); color: #1A1614; box-shadow: 0 0 10px rgba(232,195,107,.4), 0 2px 0 #8a6a2e; }
body.hw-ui .mtb-tool.on .mtb-i { color: #1A1614; }
/* Eraser: js/13 syncEraserCursor injects #mebEraserCursor — a native cursor
   image of the ring-with-× sized to the eraser (the × above is the fallback
   until it runs); real UI keeps its cursor. A finger/pen gets the ring drawn
   on the draw layer instead (drawEraserPreview). */
body.meb-cur-eraser :is(.map-edit-bar, header, nav, .tabs, .meb-toolbag-panel, .meb-textpop, .exp-modal, .tl-modal, .studio-modal, #ifb-popover-layer > *) { cursor: default !important; }
body.meb-cur-eraser :is(.map-edit-bar, .meb-toolbag-panel) :is(button, input[type="range"], input[type="color"], select) { cursor: pointer !important; }
#mapEditBar .meb-sel > .meb-keep { flex: none; }
#mapEditBar .meb-range { width: 92px; accent-color: #E8C36B; cursor: pointer; margin: 0 2px; }
/* Spot / Darken "lit": the effect is on the board while another tool is armed —
   gold outline + a small lamp; click Spot again to turn the spotlight off. */
#mapEditBar .meb-tool.meb-lit { border-color: #E8C36B; background: rgba(232,195,107,.14); color: #F5F1E8; position: relative; }
#mapEditBar .meb-tool.meb-lit::after { content: ""; position: absolute; top: 3px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: #F3D489; box-shadow: 0 0 6px rgba(243,212,137,.9); }
#mapEditBar #mebLayer .meb-settab.meb-locked { opacity: 1; }   /* the joined control dims as one (.locked) */
body.tier-free #mebLayer button.meb-locked { position: static; }
body.tier-free #mebLayer button.meb-locked::after { content: none; }
body.tier-free #mebLayer .meb-set.locked::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: #E8C36B; box-shadow: 0 0 0 1.5px #26201A, 0 0 6px rgba(232,195,107,.55); pointer-events: none; z-index: 2; }
