.map2d-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}
.map2d-back {
  font-size: .82rem; color: #6b7280; padding: .6rem 0 .1rem;
  display: block; text-decoration: none; text-align: right;
}
.map2d-back:hover { color: #374151; }

/* ── Header ──────────────────────────────────────────────── */
.map2d-header {
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 1.1rem;
  margin-bottom: 1.5rem;
}
.map2d-header-eyebrow {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: .35rem;
  font-size: 1rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: #6b7280; margin-bottom: .55rem;
}
.map2d-done { font-size: .8rem; font-weight: 600; color: #9ca3af; letter-spacing: .03em; text-transform: none; }
.map2d-question {
  font-size: .9rem; color: #4b5563; line-height: 1.6;
  background: #f8f9ff; border-left: 3px solid #c7d2fe;
  padding: .5rem .8rem; border-radius: 0;
  margin-bottom: .7rem; white-space: pre-wrap; word-break: break-word;
}
.map2d-header h1 {
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 700; color: #111827;
}

/* Map card */
.map-card { background: #fff; border-radius: 0;
            padding: 1rem; margin-bottom: 1rem;
            box-shadow: 0 1px 4px rgba(0,0,0,.08); position: relative; }

/* ── Map control overlay ─────────────────────────────────────── */
.map-ctrl-overlay {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 10; font-size: .8rem;
}
.ctrl-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .35rem .65rem; padding: .32rem .5rem;
  background: rgba(255,255,255,.93); backdrop-filter: blur(4px);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.ctrl-row:last-child { border-bottom: none; }
.ctrl-row-1 {
  border-radius: 0;
  box-shadow: 0 1px 5px rgba(0,0,0,.10);
}
.map-ctrl-overlay:hover .ctrl-row-1,
.map-ctrl-overlay.ctrl-open .ctrl-row-1 { border-radius: 0; }
.ctrl-expanded {
  display: none; flex-direction: column;
  border-radius: 0; overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,.13);
  border: 1px solid rgba(0,0,0,.08); border-top: none;
}
.map-ctrl-overlay:hover .ctrl-expanded,
.map-ctrl-overlay.ctrl-open .ctrl-expanded { display: flex; }
.ctrl-expand-arrow {
  margin-left: auto; font-size: .72rem; color: #aaa;
  border: none; background: none; cursor: pointer; padding: 0 .15rem;
  line-height: 1; transition: transform .15s; flex-shrink: 0;
}
.map-ctrl-overlay:hover .ctrl-expand-arrow,
.map-ctrl-overlay.ctrl-open .ctrl-expand-arrow { transform: rotate(180deg); color: #555; }
.ctrl-group   { display: flex; align-items: center; gap: .3rem; white-space: nowrap; }
.ctrl-group input[type=range] { width: 72px; accent-color: #4a90d9; cursor: pointer; }
.ctrl-label   { color: #555; }
.ctrl-label strong { color: #333; min-width: 2.5em; display: inline-block; }
.ctrl-toggles { gap: .55rem; }
.ctrl-toggles label { cursor: pointer; color: #555; }
.ctrl-group select { border: 1px solid #ddd; border-radius: 0;
                     padding: .18rem .35rem; font-size: .79rem; background: #fff; cursor: pointer; }
.ctrl-btn { border: 1px solid #ddd; border-radius: 0; padding: .18rem .55rem;
            font-size: .79rem; background: #fff; cursor: pointer; color: #666; }
.ctrl-btn:hover { background: #f0f0f0; }
.ctrl-btn.active { background: #e8f0fb; border-color: #4a90d9; color: #2a6db5; }

/* ── Map SVG ──────────────────────────────────────────────────── */
#mds-map { display: block; width: 100%; height: auto;
           background: #fafafa; border-radius: 0; cursor: grab;
           overflow: hidden; }

/* ── Map + concept list ───────────────────────────────────────── */
.map-with-list { display: block; position: relative; overflow: hidden; }

/* Fullscreen mode */
.map-card:fullscreen { background: #fff; padding: 0; border-radius: 0; }
.map-card:fullscreen .map-with-list { height: 100vh; }
.map-card:fullscreen #mds-map { width: 100%; height: 100%; }
.map-card:-webkit-full-screen { background: #fff; padding: 0; }
.map-card:-webkit-full-screen .map-with-list { height: 100vh; }
.map-card:-webkit-full-screen #mds-map { width: 100%; height: 100%; }
#btn-fs-2d.active { background: #e8f0fb; border-color: #4a90d9; color: #2a6db5; }

/* ── Concept list right slide panel ──────────────────────────── */
.concept-list-panel {
  position: absolute; right: 0; top: var(--ctrl-bar-h, 0px); bottom: 0;
  display: flex; align-items: center; z-index: 8;
}
.cl-panel-tab {
  pointer-events: auto; align-self: center;
  background: rgba(255,255,255,.85); backdrop-filter: blur(4px);
  border: 1px solid rgba(0,0,0,.11); border-right: none;
  border-radius: 0; cursor: pointer;
  font-size: .7rem; color: #555; padding: .45rem .22rem;
  writing-mode: vertical-rl; transform: rotate(180deg);
  white-space: nowrap; line-height: 1.3;
  transition: background .12s, color .12s;
}
.cl-panel-tab:hover { background: rgba(255,255,255,.97); color: #111; }
.concept-list-clipper {
  pointer-events: auto; align-self: stretch;
  width: 0; overflow: hidden;
  transition: width .2s ease;
  display: flex;
}
.concept-list {
  width: 128px; flex-shrink: 0;
  overflow-y: auto; overflow-x: hidden;
  border-left: 1px solid #eee;
  padding: 0 0 0 .4rem;
  background: rgba(255,255,255,.95);
}
/* Výklady right panel (click only) */
#vykladu-panel.panel-open .concept-list-clipper { width: 308px; }
.cl-item {
  font-size: .76rem; padding: .17rem .3rem; border-radius: 0; cursor: default;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #666; line-height: 1.55; transition: background .1s;
}
.cl-item:hover, .cl-item.cl-active { background: #eef2fb; color: #1a1a2e; font-weight: 600; }
.cl-item.cl-pos { background: rgba(39,174,96,.1); color: #166534; }
.cl-item.cl-neg { background: rgba(231,76,60,.1); color: #991b1b; }
.cl-item.cl-pos:hover, .cl-item.cl-pos.cl-active { background: rgba(39,174,96,.22); color: #166534; font-weight:600; }
.cl-item.cl-neg:hover, .cl-item.cl-neg.cl-active { background: rgba(231,76,60,.22); color: #991b1b; font-weight:600; }
.cl-item.cl-item-clicked { outline: 2px solid #6366f1; outline-offset: -2px; font-weight: 700; }
/* Concept edit (admin) */
.cl-item { display: flex; align-items: center; gap: 2px; }
.cl-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-dot { flex-shrink: 0; width: 5px; height: 5px; border-radius: 50%; margin-right: 2px; }
.cl-menu-btn {
  flex-shrink: 0; margin-left: auto; background: none; border: none; cursor: pointer;
  padding: 0 3px; font-size: .5rem; color: #bbb; opacity: 0; transition: opacity .15s;
  line-height: 1;
}
.cl-item:hover .cl-menu-btn { opacity: .7; }
.cl-menu-btn:hover { opacity: 1 !important; color: #6366f1; }
.cl-edit-input {
  flex: 1; font-size: .76rem; padding: 0 2px; border: 1px solid #6366f1;
  border-radius: 0; outline: none; font-family: inherit; min-width: 0;
}
/* Context menu */
.cl-ctx-menu {
  position: fixed; z-index: 9999; background: #fff; border: 1px solid #ddd;
  border-radius: 0; box-shadow: 0 4px 16px rgba(0,0,0,.18); padding: 4px 0;
  min-width: 140px; font-size: .76rem;
}
.cl-ctx-menu .ctx-label { padding: 3px 10px; color: #999; font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; }
.cl-ctx-menu button {
  display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 4px 10px; cursor: pointer; font-size: .76rem; color: #333;
}
.cl-ctx-menu button:hover { background: #eef2fb; }
.cl-ctx-menu button.ctx-active { font-weight: 700; color: #6366f1; }
.cl-ctx-menu hr { border: none; border-top: 1px solid #eee; margin: 3px 0; }
@media (max-width: 700px) { .concept-list-panel { display: none; } }

/* ── Left info panel (2D) ─────────────────────────────────────────────────── */
#r2d-info-panel {
  position: absolute; left: 0; top: 0; bottom: 0;
  display: flex; align-items: center; z-index: 8; pointer-events: none;
}
.r2d-tab {
  pointer-events: auto; display: flex; align-items: center; justify-content: center;
  width: 28px; height: 90px; margin: 0;
  background: rgba(74,144,217,.82); color: #fff; border: none;
  border-radius: 0; cursor: pointer; font-size: .68rem;
  letter-spacing: .07em; writing-mode: vertical-rl;
  transition: background .12s; flex-shrink: 0;
}
.r2d-tab:hover { background: rgba(74,144,217,1); }
.r2d-body {
  pointer-events: auto; height: 100%;
  width: 0; max-width: 0; transition: max-width .2s, width .2s;
  background: rgba(255,255,255,.97); border-right: 1px solid #e0e0e0;
  box-shadow: 3px 0 14px rgba(0,0,0,.13); order: -1;
  display: flex; flex-direction: column; overflow: hidden;
}
#r2d-info-panel.open .r2d-body { width: 262px; max-width: 262px; }
/* Inner tab bar */
.r2d-inner-tabs {
  display: flex; flex-shrink: 0; border-bottom: 1px solid #e5e7eb; background: #f8f9fa;
}
.r2d-inner-tab-btn {
  flex: 1; border: none; background: none; cursor: pointer; font-size: .72rem;
  padding: .35rem .2rem; color: #6b7280; border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
}
.r2d-inner-tab-btn.active { color: #1d4ed8; border-bottom-color: #1d4ed8; font-weight: 600; }
.r2d-tab-pane { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.r2d-tab-pane.hidden { display: none; }
/* Chapter nav */
.r2d-chapter-nav {
  display: flex; align-items: center; gap: .3rem; padding: .4rem .6rem .3rem;
  font-size: .75rem; color: #6b7280; flex-shrink: 0; border-bottom: 1px solid #f0f0f0;
}
.r2d-chapter-nav button {
  border: 1px solid #ddd; background: #fff; border-radius: 0; cursor: pointer;
  width: 22px; height: 22px; font-size: .9rem; color: #555;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.r2d-chapter-nav button:hover { background: #f0f4fb; }
.r2d-chapter-nav-title {
  flex: 1; text-align: center; font-size: .7rem; font-weight: 600; color: #374151;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.r2d-chapter-counter { font-size: .65rem; color: #9ca3af; flex-shrink: 0; }
/* Chapter list in tab 1 */
.r2d-inner { min-width: 262px; padding: .4rem 0; overflow-y: auto; flex: 1; }
.r2d-chapter-item {
  font-size: .79rem; color: #374151; padding: .22rem .8rem;
  cursor: pointer; transition: background .1s;
}
.r2d-chapter-item:hover { background: #f0f4fb; }
.r2d-chapter-item.r2d-active { background: #fef9c3; font-weight: 700; color: #1a1a2e; }
/* Legacy r2d items (for axes section still rendered) */
.r2d-item {
  font-size: .8rem; color: #1a1a2e; padding: .18rem .6rem;
  border-radius: 0; cursor: pointer; display: flex;
  justify-content: space-between; align-items: center; gap: .3rem;
  transition: background .1s;
}
.r2d-item:hover { background: #f0f4fb; }
.r2d-item.r2d-active { background: #fef9c3; font-weight: 700; }
.r2d-sep { border: none; border-top: 1px solid #f0f0f0; margin: .4rem 0; }
.r2d-section { margin: .5rem 0; }
.r2d-section-title {
  font-size: .62rem; font-weight: 700; color: #aaa;
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: .2rem; padding: 0 .6rem;
}
.r2d-axes { display: flex; flex-direction: column; gap: .1rem; padding: 0 .6rem; }
.r2d-axes label {
  display: flex; align-items: center; gap: .4rem;
  font-size: .8rem; color: #444; padding: .1rem 0; cursor: pointer;
}
.r2d-axes input[type=checkbox] { cursor: pointer; width: 13px; height: 13px; }
/* Pojmy tab — concept list inside left panel */
#r2d-pane-pojmy .concept-list {
  width: 262px; flex-shrink: 0; height: 100%; border-left: none;
  padding: .3rem .4rem; background: none;
}
@media (max-width: 700px) { #r2d-info-panel { display: none; } }

/* Plan badge */
.plan-pill { display:inline-block; font-size:.6rem; font-weight:700; letter-spacing:.05em; padding:.1rem .4rem; border-radius: 0; vertical-align:middle; margin-left:.4rem; }
.plan-pill-free   { background:#f1f5f9; color:#94a3b8; }
.plan-pill-basic  { background:#dbeafe; color:#1e40af; }
.plan-pill-full   { background:#ede9fe; color:#5b21b6; }
.plan-pill-admin  { background:#fef3c7; color:#92400e; }

/* H1 + view-switcher row */
.map2d-h1-row { display:flex; align-items:center; gap:1rem; flex-wrap:wrap; margin-top:.25rem; }
.map2d-h1-row h1 { margin:0; flex-shrink:0; }
.map2d-h1-row .view-switcher { flex-shrink:0; margin:0; }

/* Right panel tab bigger + centered */
.concept-list-panel { align-items: center; }
.cl-panel-tab {
  font-size: .72rem; padding: .65rem .26rem;
  height: 90px; align-self: center;
}

/* Výklady right panel content */
.vykladu-inner {
  width: 304px; flex-shrink: 0; overflow-y: auto; padding: .75rem .9rem;
  font-size: .82rem; color: #222; background: rgba(255,255,255,.97);
  border-left: 1px solid #eee;
}
.vyk-block-title {
  font-size: .62rem; font-weight: 700; color: #aaa; text-transform: uppercase;
  letter-spacing: .07em; margin-bottom: .4rem; padding-bottom: .2rem;
  border-bottom: 1px solid #f0f0f0;
}
.vyk-section { margin-bottom: .9rem; }
.vyk-section-title { font-size: .79rem; font-weight: 700; color: #374151; margin-bottom: .25rem; }
.vyk-section-text { font-size: .8rem; color: #4b5563; line-height: 1.6; }
.vyk-admin-block { margin-bottom: 1rem; }
.vyk-generic-block {
  background: #f8faff; border-radius: 0; padding: .6rem .75rem; margin-top: .5rem;
}
.vyk-empty { font-size: .8rem; color: #9ca3af; padding: .5rem; text-align: center; }

/* Collapsible chapter vykladu in left panel */
.r2d-ch-vykladu { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.r2d-ch-vykladu.open { max-height: 800px; }
.r2d-ch-vykladu-inner { padding: .35rem .8rem .55rem; border-bottom: 1px solid #f0f0f0; }
.r2d-ch-vykladu-generic { font-size: .78rem; color: #4b5563; line-height: 1.55; margin-top: .2rem; }
.r2d-ch-vykladu-admin-title { font-size: .6rem; font-weight: 700; color: #aaa; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .2rem; }
.r2d-ch-vykladu-admin-text { font-size: .77rem; color: #374151; line-height: 1.55; }
.r2d-ch-vykladu-admin + .r2d-ch-vykladu-generic { margin-top: .4rem; border-top: 1px solid #f5f5f5; padding-top: .3rem; }

/* Admin textarea in right panel */
.vyk-admin-ta { width: 100%; box-sizing: border-box; font-size: .79rem; border: 1px solid #d1d5db; border-radius: 0; padding: .4rem .5rem; resize: vertical; line-height: 1.5; color: #1a1a2e; font-family: system-ui,sans-serif; }
.vyk-admin-ta:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,.15); }
.vyk-admin-save-btn { margin-top: .4rem; font-size: .75rem; padding: .25rem .7rem; border: 1px solid #c7d2fe; background: #eef2ff; color: #3730a3; border-radius: 0; cursor: pointer; }
.vyk-admin-save-btn:hover { background: #e0e7ff; }
.vyk-admin-comment-block { padding: .6rem .9rem; }
.vyk-admin-comment-title { font-size: .6rem; font-weight: 700; color: #aaa; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .35rem; }

/* Node tooltip */
#map-tt {
  display: none; position: fixed; pointer-events: none; z-index: 40;
  background: #1a1a2e; color: #eee; border-radius: 0;
  padding: .4rem .7rem; font-size: .8rem; line-height: 1.5;
  box-shadow: 0 3px 12px rgba(0,0,0,.35); max-width: 220px;
}
#map-tt strong { display: block; font-size: .88rem; color: #fff; }

/* Legend inline (below map) */
.map-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem;
              padding: .7rem .1rem 0; font-size: .79rem; color: #666; }
.legend-item { display: flex; align-items: center; gap: .4rem; }
.legend-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
