/* =============================================================
   CTH Diagrammer - stylesheet
   CTH greyscale system: ink on cloud, hairline borders, no color
   accents. Inter only - 500 for content, 800 for titles, headings
   and labels. The diagram is the only color on the page.
   ============================================================= */

:root {
  --ink: #1a1a1a;
  --ink-raised: #3d3d3d;
  --ink-deep: #0b0b0b;
  --graphite: #3a3a3a;
  --mist: #626262;
  --soft: #969696;
  --edge: #e3e3e3;
  --edge-soft: #ededed;
  --sunken: #f2f2f2;
  --cloud: #ffffff;
  --danger: #b42318;
  --select: #3ec1f5;           /* selection chrome - light cyan-blue */
  --select-soft: rgba(62, 193, 245, 0.12);

  --font: 'Inter', -apple-system, 'Helvetica Neue', sans-serif;

  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;

  --shadow-1: 0 1px 2px rgba(11, 11, 11, 0.05), 0 1px 1px rgba(11, 11, 11, 0.03);
  --shadow-2: 0 2px 8px rgba(11, 11, 11, 0.07), 0 1px 2px rgba(11, 11, 11, 0.05);
  --shadow-3: 0 12px 32px rgba(11, 11, 11, 0.12), 0 2px 8px rgba(11, 11, 11, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: var(--cloud);
  -webkit-font-smoothing: antialiased;
}
.app { min-height: 100%; display: flex; flex-direction: column; }
.boot { padding: 48px; color: var(--mist); text-align: center; }

h1, h2, h3, .btn-ink, .ed-title { font-weight: 800; }
button { font: inherit; font-weight: 500; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }

/* ---------------------------------------------------------- buttons */
.btn {
  height: 36px;
  padding: 0 15px;
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  background: var(--cloud);
  color: var(--graphite);
  font-weight: 500;
  box-shadow: var(--shadow-1);
  transition: border-color .12s, color .12s, box-shadow .12s, transform .06s;
  white-space: nowrap;
}
.btn:hover { border-color: #cfcfcf; color: var(--ink); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(1px); }
.btn-ink {
  border: none;
  color: var(--cloud);
  background: linear-gradient(180deg, var(--ink-raised), var(--ink-deep));
  font-weight: 800;
  letter-spacing: 0.01em;
}
.btn-ink:hover { color: var(--cloud); background: linear-gradient(180deg, #4a4a4a, #161616); }
.btn-danger { border-color: rgba(180, 35, 24, .35); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-back { padding: 0 11px; font-weight: 800; }
.btn-back svg { width: 20px; height: 20px; display: block; }

/* ---------------------------------------------------------- library */
.lib-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 26px clamp(20px, 4vw, 48px) 20px;
  border-bottom: 1px solid var(--edge);
  background: var(--cloud);
}
.brand { display: flex; align-items: center; gap: 15px; }
.brand-logo { height: 42px; width: auto; }
.brand-word h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-word p { margin: 2px 0 0; color: var(--mist); font-size: 12px; font-weight: 500; }
.lib-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#libSearch {
  height: 36px;
  width: min(240px, 44vw);
  padding: 0 12px;
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  background: var(--cloud);
  outline: none;
}
#libSearch:focus { border-color: var(--soft); box-shadow: 0 0 0 3px rgba(26, 26, 26, .08); }

.lib-body { flex: 1; display: flex; min-height: 0; background: var(--cloud); }
.lib-side {
  width: 230px;
  flex-shrink: 0;
  padding: 22px 14px 22px clamp(16px, 3vw, 40px);
  border-right: 1px solid var(--edge-soft);
}
.side-title {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--soft);
  margin: 0 10px 8px;
}
.side-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: none;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  color: var(--graphite);
  margin-bottom: 2px;
}
.side-row:hover { background: var(--sunken); color: var(--ink); }
.side-row.on { background: var(--sunken); color: var(--ink); font-weight: 800; }
.side-row.side-drop { border-color: var(--select); background: var(--select-soft); }
.side-ic { width: 16px; height: 16px; flex-shrink: 0; color: var(--soft); }
.side-row.on .side-ic { color: var(--ink); }
.side-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-count { color: var(--soft); font-size: 12px; }
.side-tools { display: none; gap: 2px; }
.side-row:hover .side-tools { display: inline-flex; }
.side-row:hover .side-count { display: none; }
.side-act { display: inline-flex; padding: 3px; border-radius: 6px; color: var(--soft); }
.side-act:hover { background: var(--edge); color: var(--ink); }
.side-act svg { width: 13px; height: 13px; }
.side-new {
  width: 100%;
  text-align: left;
  border: 1px dashed var(--edge);
  background: none;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  color: var(--mist);
  margin-top: 6px;
}
.side-new:hover { border-color: var(--soft); color: var(--ink); }
.side-input {
  width: 100%;
  border: 1px solid var(--soft);
  border-radius: 6px;
  padding: 3px 7px;
  font: inherit;
  outline: none;
  background: var(--cloud);
}
.side-editing { display: block; }

.move-menu {
  position: fixed;
  z-index: 55;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  max-height: 50vh;
  overflow-y: auto;
  background: var(--cloud);
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  padding: 6px;
}
.move-menu button {
  text-align: left;
  border: none;
  background: none;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--graphite);
  white-space: nowrap;
}
.move-menu button:hover { background: var(--sunken); color: var(--ink); }

.lib-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 22px clamp(16px, 3vw, 40px);
  align-content: start;
  background: var(--cloud);
  overflow-y: auto;
}
.card {
  background: var(--cloud);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: box-shadow .15s, transform .15s, border-color .15s;
  outline: none;
}
.card:hover, .card:focus-visible { box-shadow: var(--shadow-3); transform: translateY(-2px); border-color: #d6d6d6; }
.card-thumb { aspect-ratio: 2 / 1.05; background: var(--cloud); overflow: hidden; border-bottom: 1px solid var(--edge-soft); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.card-thumb-blank { width: 100%; height: 100%; background: repeating-linear-gradient(-45deg, var(--sunken), var(--sunken) 10px, #eeeeee 10px, #eeeeee 20px); }
.card-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 13px 16px 4px; }
.card-meta h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-meta span { color: var(--soft); font-size: 12px; flex-shrink: 0; }
.card-tools { display: flex; gap: 6px; padding: 6px 12px 12px; }
.mini {
  border: 1px solid transparent;
  background: none;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--mist);
}
.mini:hover { background: var(--sunken); color: var(--ink); }
.mini-danger { margin-left: auto; }
.mini-danger:hover { color: var(--danger); background: rgba(180, 35, 24, .07); }

.lib-empty {
  grid-column: 1 / -1;
  justify-self: center;
  text-align: center;
  max-width: 460px;
  padding: 56px 24px;
}
.lib-empty-rink {
  width: 190px;
  height: 95px;
  margin: 0 auto 26px;
  border: 2px solid var(--edge);
  border-radius: 40px;
  background:
    linear-gradient(var(--edge), var(--edge)) 50% 0 / 2px 100% no-repeat,
    radial-gradient(circle at 50% 50%, var(--edge) 0 5px, transparent 6px),
    var(--cloud);
}
.lib-empty h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 10px; }
.lib-empty p { color: var(--mist); line-height: 1.55; margin: 0 0 22px; }
.lib-none { grid-column: 1 / -1; color: var(--mist); text-align: center; padding: 60px 0; }
.lib-foot {
  padding: 18px clamp(20px, 4vw, 48px) 26px;
  color: var(--soft);
  font-size: 12px;
  text-align: center;
  background: var(--cloud);
}

/* ---------------------------------------------------------- editor */
.ed { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.ed-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px clamp(12px, 2.5vw, 24px);
  background: var(--cloud);
  border-bottom: 1px solid var(--edge);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.ed-title {
  flex: 1;
  min-width: 140px;
  height: 36px;
  padding: 0 10px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  outline: none;
}
.ed-title::placeholder { font-weight: 500; color: var(--soft); }
.ed-title:hover { border-color: var(--edge); }
.ed-title:focus { border-color: var(--soft); background: var(--cloud); box-shadow: 0 0 0 3px rgba(26, 26, 26, .08); }
.ed-status { color: var(--soft); font-size: 12px; min-width: 52px; text-align: center; }
.ed-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ed-sep { width: 1px; height: 20px; background: var(--edge); margin: 0 2px; }

/* The canvas: pure white, the rink sits directly on it - no card, no
   shadow, no border. Scrolls both ways; pinch to zoom. */
.ed-stagewrap {
  flex: 1;
  min-width: 0;
  overflow: auto;
  position: relative;
  background: var(--cloud);
  padding: clamp(10px, 2vw, 28px) clamp(10px, 3vw, 40px) 120px;
}
.ed-zoom {
  width: 100%;
  min-width: 320px;
  margin: 0 auto;
}
.ed-stage { width: 100%; }
#edSvg { display: block; width: 100%; height: 100%; user-select: none; touch-action: none; }
.ed-rinkchip { cursor: text; }

/* selection chrome inside the SVG */
.ed-selbox { fill: none; stroke: var(--select); stroke-width: 2px; stroke-dasharray: 6 4; }
.ed-grip { fill: #ffffff; stroke: var(--select); stroke-width: 2px; cursor: nwse-resize; }
.ed-anchor { fill: #ffffff; stroke: var(--select); stroke-width: 2px; cursor: grab; }
.ed-anchor.mid { fill: var(--select); }
.ed-band { fill: var(--select-soft); stroke: var(--select); stroke-width: 1.5px; stroke-dasharray: 5 4; }
.ed-guide { stroke: #ff2d55; stroke-width: 1px; stroke-dasharray: 6 4; }

.ed-input {
  position: absolute;
  transform: translate(-4px, -1.15em);
  border: 2px solid var(--select);
  border-radius: 8px;
  background: #ffffff;
  padding: 1px 6px;
  font-weight: 800;
  outline: none;
  min-width: 60px;
  z-index: 5;
  box-shadow: var(--shadow-2);
}
.ed-input-center { text-align: center; transform: translate(-50%, -55%); padding: 1px 4px; min-width: 40px; }

/* The WYSIWYG Title-chip field - identical to the committed chip. */
.ed-input-chip {
  position: absolute;
  box-sizing: border-box;
  border-style: solid;
  border-color: var(--ink);
  background: #ffffff;
  font-weight: 800;
  line-height: 1.3;
  outline: none;
  z-index: 5;
  min-width: 24px;
}

/* Rotation chrome */
.ed-rot { fill: #ffffff; stroke: var(--select); stroke-width: 2px; cursor: grab; }
.ed-rotstem { stroke: var(--select); stroke-width: 1.5px; }

/* Frame strips: the label and ghost controls in the space above each rink
   of a sequence - minimal, Figma-style, never on the ice. */
.ed-flabel { fill: var(--mist); cursor: text; }
.ed-flabel:hover { fill: var(--ink); }
.ed-rctl { cursor: pointer; }
.ed-rctl rect:first-of-type { fill: transparent; stroke: none; }
.ed-rctl g path, .ed-rctl g rect { fill: none; stroke: var(--soft); stroke-width: 8px; stroke-linecap: round; stroke-linejoin: round; }
.ed-rctl:hover rect:first-of-type { fill: var(--sunken); }
.ed-rctl:hover g path, .ed-rctl:hover g rect { stroke: var(--ink); }

/* Renaming a rink is seamless: the field sits exactly on the label, same
   font, no box - just a thin editing underline. */
.ed-input-flabel {
  transform: translate(-2px, -0.14em);
  text-align: left;
  font-weight: 800;
  color: var(--ink);
  background: var(--cloud);
  border: none;
  border-bottom: 2.5px solid var(--select);
  border-radius: 6px 6px 0 0;
  box-shadow: none;
  padding: 2px 6px 3px 4px;
  min-width: 240px;
  letter-spacing: -0.01em;
}
.ed-flabelwrap { cursor: text; }
.ed-flabelwrap:hover .ed-flabel { fill: var(--ink); }

/* ---------------------------------------------- in-editor diagram tree */
.ed-main { flex: 1; display: flex; min-height: 0; }
.ed-side {
  width: 220px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 14px 10px 90px;
  background: var(--cloud);
  border-right: 1px solid var(--edge-soft);
}
#esideSearch {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  background: var(--cloud);
  outline: none;
  margin-bottom: 8px;
  font-size: 13px;
}
#esideSearch:focus { border-color: var(--soft); }
.eside-new {
  width: 100%;
  text-align: left;
  border: 1px dashed var(--edge);
  background: none;
  border-radius: var(--r-sm);
  padding: 7px 10px;
  color: var(--mist);
  font-size: 13px;
  margin-bottom: 10px;
}
.eside-new:hover { border-color: var(--soft); color: var(--ink); }
.eside-folder {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--soft);
  margin: 12px 8px 4px;
}
.eside-row {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--graphite);
  font-size: 13px;
}
.eside-row:hover { background: var(--sunken); color: var(--ink); }
.eside-row.on { background: var(--ink); color: var(--cloud); font-weight: 800; }
.eside-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eside-empty { color: var(--soft); font-size: 12px; padding: 4px 10px; }

/* the cone art reads oversized next to the flat glyphs - pull it in */
.tb-btn img.ic-cone { width: 19px; height: 19px; }

/* The + Add Rink / Duplicate Rink bars under the bottom rink */
.ed-addrow { display: flex; gap: 12px; }
.ed-addbar {
  display: block;
  flex: 1;
  width: 100%;
  margin: 18px 0 4px;
  padding: 13px 0;
  border: 1.5px dashed var(--edge);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--soft);
  font-size: 14px;
  font-weight: 800;
  transition: border-color .12s, color .12s, background .12s;
}
.ed-addbar:hover { border-color: var(--soft); color: var(--ink); background: var(--sunken); }

/* The player preset menu (fixed, so the toolbar's overflow can never clip
   it) */
/* Right-click menus: the object menu on the ice and the customize menu on a
   colour preset. Same glass treatment as .pmenu, laid out as a list. */
.ctxmenu {
  position: fixed;
  z-index: 70;
  min-width: 190px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--edge);
  border-radius: 12px;
  box-shadow: var(--shadow-3);
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.ctx-item:hover { background: var(--sunken); }
.ctx-label { flex: 1; }
.ctx-hint { color: var(--soft); font-size: 11px; }
.ctx-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--c);
  border: 1px solid rgba(0, 0, 0, 0.22);
  flex: none;
}
.ctx-sep { height: 1px; margin: 5px 6px; background: var(--edge); }

.pmenu {
  position: fixed;
  z-index: 65;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(92vw, 1040px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--edge);
  border-radius: 14px;
  box-shadow: var(--shadow-3);
}
.pmenu::-webkit-scrollbar { display: none; }
.pmenu-chip {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2.5px solid #1e1e1e;
  background: var(--c);
  color: var(--i);
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pmenu-chip:hover { box-shadow: 0 0 0 3px var(--select-soft), 0 0 0 1.5px var(--select); }
.pmenu-blank {
  flex-shrink: 0;
  width: auto;
  padding: 0 12px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--edge);
  background: var(--cloud);
  color: var(--mist);
  font-size: 12.5px;
  font-weight: 500;
}
.pmenu-blank:hover { color: var(--ink); border-color: var(--soft); box-shadow: none; }

/* ------------------------------------------------- floating toolbar */
.tb {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom, 0px) + 10px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100vw - 20px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--edge);
  border-radius: 18px;
  box-shadow: var(--shadow-3);
  z-index: 20;
  scrollbar-width: none;
}
.tb::-webkit-scrollbar { display: none; }
.tb-sep { width: 1px; align-self: stretch; margin: 4px 3px; background: var(--edge); flex-shrink: 0; }

.tb-btn, .tb-player, .tb-swatch {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--graphite);
  transition: background .12s, color .12s, border-color .12s;
}
.tb-btn svg { width: 20px; height: 20px; stroke-width: 1.8; }
.tb-btn img { width: 25px; height: 25px; object-fit: contain; }
.tb-btn:hover { background: var(--sunken); color: var(--ink); }
.tb-btn.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cloud);
}
.tb-btn.on img { filter: invert(1) brightness(1.6); }
.tb-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.tb-word { width: auto; padding: 0 12px; font-size: 12.5px; font-weight: 800; }
.tb-small svg { width: 18px; height: 18px; }

.tb-key {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: 8px;
  font-weight: 800;
  color: var(--soft);
  pointer-events: none;
}
.tb-btn.on .tb-key { color: rgba(255, 255, 255, .7); }

.tb-player {
  border-radius: 50%;
  width: 34px;
  height: 34px;
  margin: 3px;
  background: var(--c);
  border: 2.5px solid #1e1e1e;
}
.tb-player.on, .tb-player:hover { box-shadow: 0 0 0 3px var(--select-soft), 0 0 0 1.5px var(--select); }

.tb-swatch {
  border-radius: 50%;
  width: 26px;
  height: 26px;
  margin: 7px 2px;
  background: var(--c);
  border: 1px solid rgba(26, 26, 26, .25);
}
.tb-swatch.on { box-shadow: 0 0 0 3px var(--select-soft), 0 0 0 1.5px var(--select); }

/* ---------------------------------------------------------- overlays */
#toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: var(--cloud);
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 60;
  max-width: min(520px, 88vw);
  text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--danger); }

.sheet-veil {
  position: fixed;
  inset: 0;
  background: rgba(11, 11, 11, .38);
  display: grid;
  place-items: center;
  z-index: 50;
  backdrop-filter: blur(2px);
}
.sheet {
  background: var(--cloud);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: 24px 26px;
  width: min(420px, calc(100vw - 40px));
}
.sheet-wide { width: min(560px, calc(100vw - 40px)); }
.sheet h3 { margin: 0 0 8px; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.sheet p { margin: 0 0 4px; color: var(--mist); line-height: 1.5; }
.sheet-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.keys-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 16px;
  margin-top: 14px;
  max-height: 55vh;
  overflow-y: auto;
}
.keys-k { font-size: 12px; font-weight: 800; color: var(--graphite); background: var(--sunken); border: 1px solid var(--edge); border-radius: 6px; padding: 3px 8px; justify-self: start; white-space: nowrap; }
.keys-v { color: var(--mist); align-self: center; }

.rink-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.rink-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  font-weight: 500;
  cursor: pointer;
}
.rink-row:hover { border-color: #cfcfcf; }
.rink-row input { accent-color: var(--ink); width: 15px; height: 15px; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 820px) {
  .ed-head { gap: 8px; }
  .ed-status { display: none; }
  .btn { padding: 0 11px; }
}
@media (max-width: 700px) {
  .lib-body { flex-direction: column; }
  .lib-side {
    width: 100%;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 12px clamp(16px, 3vw, 40px) 10px;
    border-right: none;
    border-bottom: 1px solid var(--edge-soft);
    scrollbar-width: none;
  }
  .lib-side::-webkit-scrollbar { display: none; }
  .side-title { display: none; }
  .side-row { width: auto; flex-shrink: 0; margin: 0; white-space: nowrap; }
  .side-tools { display: none !important; }
  .side-row:hover .side-count { display: inline; }
  .side-new { width: auto; flex-shrink: 0; margin: 0; white-space: nowrap; }
}
@media (max-width: 560px) {
  .lib-head { padding-top: 18px; }
  .brand-logo { height: 34px; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
  .ed-head-actions { gap: 6px; }
  .ed-sep { display: none; }
  #edFlip, #edPrint, #edCopy { display: none; } /* keep Undo / Redo reachable on touch; trim the rest */
  .ed-stagewrap { padding: 8px 8px 110px; }
  .tb { gap: 3px; padding: 7px 8px; border-radius: 15px; }
}

/* ---------------------------------------------- file tree extras */
.eside-actions { display: flex; gap: 6px; margin-bottom: 10px; }
.eside-actions .eside-new { margin-bottom: 0; flex: 1; white-space: nowrap; }
.eside-row { cursor: pointer; user-select: none; }
.eside-folder {
  display: flex; align-items: center; gap: 5px;
  cursor: pointer; user-select: none; border-radius: 7px; padding: 5px 8px;
}
.eside-folder:hover { background: var(--sunken); color: var(--ink); }
.eside-folder.side-drop { background: var(--select-soft); box-shadow: inset 0 0 0 1.5px var(--select); }
.eside-root { margin-top: 2px; }
.eside-caret { width: 12px; height: 12px; transform: rotate(90deg); transition: transform .12s; }
.eside-folder.closed .eside-caret { transform: none; }
.eside-count { margin-left: auto; font-weight: 500; color: var(--soft); font-size: 11px; }
.eside-foot { display: flex; gap: 6px; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--edge-soft); }
.move-menu .ctx-danger { color: var(--danger); }
.move-menu .ctx-danger:hover { background: rgba(180, 35, 24, .08); color: var(--danger); }
.eside-list { min-height: 120px; }
