/* ==========================================================================
   Oydin — Makon sahifasi: ish maydoni, kartalar, aloqalar, fikrlash qatlami
   ========================================================================== */

.map-app {
  width: min(1540px, 96vw);
  margin: auto;
  padding: 30px 0 24px;
}
.map-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 30px;
  margin-bottom: 18px;
}
.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.title-row input {
  border: 0;
  background: transparent;
  outline: none;
  color: var(--ink);
  font: 800 34px var(--font-sans);
  letter-spacing: -1.7px;
  width: min(600px, 55vw);
}
/*
 * Saqlash holati — doimiy, lekin e'tiborni tortmaydigan.
 *
 * Ilgari bu element sarlavha yonida turardi VA `display: none !important`
 * bilan yashirilgan edi, ya'ni amalda umuman ko'rinmasdi. Endi u pastki
 * o'ng burchakda, har doim joyida.
 */
.save-state {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(6px);
  font: 600 10px var(--font-mono);
  color: var(--muted);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--ink) 8%, transparent);
  pointer-events: none;
  transition: 0.25s;
}
.save-state::before {
  content: '✓';
  font-size: 11px;
  color: #69856b;
}
.save-state[data-tone='pending']::before {
  content: '↻';
}
.save-state[data-tone='error']::before {
  content: '⚠';
  color: #9f4c45;
}
.map-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.map-head-actions {
  display: flex;
  gap: 8px;
}
.map-layout {
  display: grid;
  grid-template-columns: 198px 1fr;
  gap: 14px;
}
.map-rail {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  padding: 11px;
  min-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 35px color-mix(in srgb, var(--ink) 5%, transparent);
}
.rail-button {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  border-radius: 13px;
  padding: 13px;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: 5px;
  transition: 0.2s;
}
.rail-button:hover {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: var(--ink);
}
.rail-button span {
  grid-row: span 2;
  font-size: 20px;
}
.rail-button b {
  font-size: 12px;
  color: var(--ink);
}
.rail-button small {
  font-size: 9px;
  color: var(--muted);
}
.rail-button.active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--ink) 12%, transparent);
}
.rail-button.active b {
  color: var(--paper);
}
.rail-divider {
  border-top: 1px solid var(--line);
  margin: 15px 0;
}
.map-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
}
.map-stats div {
  padding: 10px 4px;
  border-top: 1px solid var(--line);
}
.map-stats strong {
  display: block;
  font-size: 23px;
  letter-spacing: -1px;
}
.map-stats small {
  font: 500 8px var(--font-mono);
  color: var(--muted);
  text-transform: uppercase;
}
.rail-theme {
  margin-top: 14px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 58%, transparent);
}
.rail-theme > small {
  font: 500 8px var(--font-mono);
  letter-spacing: 1px;
  color: var(--muted);
}
.theme-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 10px;
}
.swatch {
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: 0.18s;
  position: relative;
}
.swatch:hover {
  transform: translateY(-1px);
}
.swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}
.swatch[data-space='paper'] {
  background: linear-gradient(135deg, #e7e0d4, #f3eee4);
}
.swatch[data-space='mist'] {
  background: linear-gradient(135deg, #ccd8d8, #e8e3db);
}
.swatch[data-space='sand'] {
  background: linear-gradient(135deg, #d9c2a0, #eee0c9);
}
.swatch[data-space='night'] {
  background: linear-gradient(135deg, #31332f, #49483f);
}
.swatch[data-space='ink'] {
  background: linear-gradient(135deg, #252b2c, #3a4140);
}
.rail-help {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 13px;
  padding: 11px;
  text-align: left;
  cursor: pointer;
}
.rail-help > span {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
}
.rail-help b,
.rail-help small {
  display: block;
  font-size: 10px;
}
.rail-help small {
  font-size: 8px;
  color: var(--muted);
  margin-top: 2px;
}
.workspace {
  /* Ilgari bu yerda `min-height: 700px` turardi. 720px balandlikdagi
     ekranda u sahifani viewport'dan baland qilib qo'yardi: sahifa
     aylanadigan bo'lib qolar va yopishqoq sarlavha kartalar hamda ularning
     amallar panelini qoplab qo'yardi. Endi balandlik viewport'ga bog'liq. */
  height: calc(100dvh - 170px);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 25px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  isolation: isolate;
  --space-a: #e9e3d7;
  --space-b: #f2ede4;
  --space-dot: #77736b55;
  --space-glow: rgb(255, 255, 255, 0.42);
  background:
    radial-gradient(circle at 50% 42%, var(--space-glow), transparent 54%),
    radial-gradient(var(--space-dot) 0.75px, transparent 0.75px),
    linear-gradient(135deg, var(--space-a), var(--space-b));
  background-size:
    auto,
    15px 15px,
    auto;
  transition:
    background 0.35s,
    border-color 0.25s;
}
.workspace.space-mist {
  --space-a: #cfd8d5;
  --space-b: #e6e3dc;
  --space-dot: #6e7a7650;
  --space-glow: rgb(255, 255, 255, 0.38);
}
.workspace.space-sand {
  --space-a: #d9c09f;
  --space-b: #eee1cb;
  --space-dot: #8a765b50;
  --space-glow: rgb(255, 250, 235, 0.42);
}
.workspace.space-night {
  --space-a: #3a3b37;
  --space-b: #515047;
  --space-dot: #d0c8b230;
  --space-glow: rgb(255, 255, 255, 0.08);
  color: #eee9df;
}
.workspace.space-ink {
  --space-a: #303737;
  --space-b: #4a514e;
  --space-dot: #d9e0d835;
  --space-glow: rgb(255, 255, 255, 0.08);
  color: #eee9df;
}
.night .workspace.space-paper {
  --space-a: #353631;
  --space-b: #45453e;
  --space-dot: #c9c5b92d;
  --space-glow: rgb(255, 255, 255, 0.07);
}
.night .workspace.space-mist {
  --space-a: #343a38;
  --space-b: #484c47;
  --space-dot: #d4d4cb2d;
  --space-glow: rgb(255, 255, 255, 0.07);
}
.night .workspace.space-sand {
  --space-a: #4a4238;
  --space-b: #5a5144;
  --space-dot: #e3d6bd27;
  --space-glow: rgb(255, 255, 255, 0.06);
}
.space-hint {
  position: absolute;
  z-index: 7;
  left: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid color-mix(in srgb, var(--ink) 13%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 65%, transparent);
  backdrop-filter: blur(14px);
  font-size: 9px;
  color: var(--ink);
  box-shadow: 0 8px 25px color-mix(in srgb, var(--ink) 7%, transparent);
}
.space-hint span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}
.space-hint b {
  font-size: 9px;
}
.space-hint small {
  color: var(--muted);
  margin-left: 3px;
}
.workspace-toolbar {
  position: absolute;
  z-index: 10;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.tool-cluster {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--ink) 13%, transparent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: 0 9px 26px color-mix(in srgb, var(--ink) 7%, transparent);
  pointer-events: auto;
}
.tool-cluster button {
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 10px;
  font: 700 10px var(--font-sans);
  cursor: pointer;
}
.tool-cluster button:hover {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.tool-cluster span {
  font: 500 9px var(--font-mono);
  color: var(--muted);
  padding: 0 6px;
  min-width: 43px;
  text-align: center;
}
.canvas {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  z-index: 2;
}
.connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  overflow: visible;
  pointer-events: none;
  transform-origin: center center;
}
.connection-group {
  pointer-events: auto;
  cursor: pointer;
}
.connection-line {
  fill: none;
  stroke: color-mix(in srgb, var(--ink) 42%, var(--accent));
  stroke-width: 1.65;
  cursor: pointer;
  transition: 0.22s;
  stroke-linecap: round;
}
.connection-line:hover {
  stroke: var(--accent);
  stroke-width: 2.5;
}
.connection-group.selected .connection-line {
  stroke: var(--accent);
  stroke-width: 2.8;
}
.connection-glow {
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 22%, transparent);
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0.45;
  filter: blur(2px);
}
.thought-card {
  position: absolute;
  z-index: 4;
  width: 235px;
  min-height: 138px;
  padding: 17px 18px 18px;
  border: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
  background: color-mix(in srgb, var(--panel) 79%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: var(--card-shadow);
  color: var(--ink);
  border-radius: 23px 14px 27px 13px;
  cursor: grab;
  transition:
    box-shadow 0.18s,
    transform 0.18s,
    border-color 0.18s;
}
.thought-card:hover {
  box-shadow: 0 20px 44px color-mix(in srgb, var(--ink) 15%, transparent);
  transform: translateY(-2px);
}
.thought-card:active {
  cursor: grabbing;
}
.thought-card.connect-source {
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent),
    var(--card-shadow);
}
.thought-card.idea {
  --card-accent: #d96b55;
}
.thought-card.plan {
  --card-accent: #b28a49;
}
.thought-card.question {
  --card-accent: #6f8296;
}
.thought-card.context {
  --card-accent: #728b76;
}
.thought-card::before {
  content: '';
  position: absolute;
  left: 17px;
  top: -5px;
  width: 31px;
  height: 8px;
  border-radius: 99px;
  background: var(--card-accent);
  opacity: 0.82;
  transform: rotate(-2deg);
}
.card-actions {
  position: absolute;
  right: 9px;
  top: 8px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transform: translateY(-3px);
  transition: 0.18s;
}
.thought-card:hover .card-actions,
.thought-card:focus-within .card-actions {
  opacity: 1;
  transform: none;
}
.card-actions button {
  width: 25px;
  height: 25px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.card-actions button:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.card-actions .delete:hover {
  background: #9f4c45;
}
.card-type {
  display: block;
  font: 500 8px var(--font-mono);
  letter-spacing: 1.25px;
  color: var(--card-accent);
  margin-bottom: 19px;
}
.thought-card p {
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: -0.25px;
  margin: 0;
  max-width: 190px;
}
.card-meta,
.card-summary {
  display: block;
  color: var(--muted);
  font: 500 8px/1.5 var(--font-mono);
  margin-top: 11px;
}
.card-summary {
  font-family: var(--font-sans);
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  z-index: 3;
}
.empty-state p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
}
.empty-state strong {
  font-size: 19px;
  letter-spacing: -0.5px;
}
.empty-state button {
  margin-top: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  color: var(--ink);
  border-radius: 11px;
  padding: 10px 14px;
  font: 800 11px var(--font-sans);
  cursor: pointer;
}
.empty-orbit {
  width: 58px;
  height: 58px;
  border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
  border-radius: 45% 55% 50% 48%;
  position: relative;
  margin-bottom: 14px;
  transform: rotate(-8deg);
}
.empty-orbit::before,
.empty-orbit::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
}
.empty-orbit::before {
  width: 7px;
  height: 7px;
  top: 5px;
  left: 8px;
}
.empty-orbit::after {
  width: 5px;
  height: 5px;
  right: 8px;
  bottom: 8px;
}
.flow-panel {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(650px, calc(100% - 40px));
  padding: 8px 9px 8px 13px;
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  border-radius: 15px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: blur(17px);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 8%, transparent);
  font-size: 10px;
  color: var(--muted);
}
.flow-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}
.flow-panel button {
  margin-left: auto;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  border-radius: 9px;
  padding: 7px 10px;
  font: 800 9px var(--font-sans);
  cursor: pointer;
}
.flow-panel button:hover {
  transform: translateY(-1px);
}

.card-dialog-form,
.detail-dialog,
.help-dialog,
.notes-dialog,
.maps-dialog {
  padding: 30px;
}

.card-dialog-form h2,
.detail-dialog h2,
.help-dialog h2,
.notes-dialog h2,
.maps-dialog h2 {
  font: 600 30px/1.1 var(--font-serif);
  margin: 9px 0;
}
.dialog-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.card-dialog-form textarea,
.detail-dialog textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 125px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 13px;
  padding: 14px;
  outline: none;
  font: 500 13px/1.65 var(--font-sans);
  margin: 18px 0 13px;
}
.card-dialog-form textarea:focus,
.detail-dialog textarea:focus,
.detail-dialog input:focus,
.detail-dialog select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 11%, transparent);
}
.type-picker {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.type {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 99px;
  padding: 8px 12px;
  font: 700 10px var(--font-sans);
  cursor: pointer;
}
.type.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.submit {
  width: 100%;
}
.detail-dialog label {
  display: block;
  color: var(--muted);
  font: 600 10px var(--font-sans);
  margin-top: 15px;
}
.detail-dialog label textarea {
  margin: 7px 0 0;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detail-grid input,
.detail-grid select {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  padding: 11px;
  outline: none;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 15px;
}
.maps-dialog,
.notes-dialog {
  width: min(680px, calc(100vw - 28px));
}
.new-map-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--ink);
  padding: 14px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  margin-bottom: 10px;
}
.new-map-row:hover {
  background: var(--surface);
}
.new-map-row > span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
}
.new-map-row b,
.new-map-row small {
  display: block;
}
.new-map-row b {
  font-size: 11px;
}
.new-map-row small {
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
}
.saved-map {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.saved-map-main {
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}
.saved-map-main b,
.saved-map-main small {
  display: block;
}
.saved-map-main b {
  font-size: 12px;
}
.saved-map-main small {
  font-size: 9px;
  color: var(--muted);
  margin-top: 3px;
}
.saved-map-actions {
  display: flex;
  gap: 5px;
}
.saved-map-actions button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 9px;
  cursor: pointer;
}
.note-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 13px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}
.note-row span {
  font: 500 8px var(--font-mono);
  color: var(--accent);
}
.note-row b {
  font-size: 11px;
}
.note-row small {
  color: var(--muted);
  font-size: 9px;
}
.notes-empty {
  color: var(--muted);
  font-size: 12px;
}
.help-steps > div {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.help-steps span {
  font: 500 10px var(--font-mono);
  color: var(--accent);
}
.help-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}
.help-steps b {
  color: var(--ink);
}
.map-page .thought-card {
  /* Yopishqoq sarlavha va amallar paneli uchun joy qoldiramiz. */
  scroll-margin: 130px 48px 60px;
  width: max-content;
  max-width: min(270px, calc(100vw - 40px));
  min-height: 0;
  padding: 7px 10px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--ink) 40%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 14%, transparent) !important;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 9%, transparent),
    0 7px 22px color-mix(in srgb, var(--ink) 7%, transparent) !important;
  backdrop-filter: blur(2px);
  overflow: visible;
  color: var(--ink);
  cursor: grab;
  user-select: none;
}
.map-page .thought-card:active {
  cursor: grabbing;
}
.map-page .thought-card::before,
.map-page .thought-card::after {
  display: none !important;
}
.map-page .thought-card p {
  margin: 0;
  max-width: 250px;
  padding: 0;
  font-size: 15px;
  line-height: 1.48;
  font-weight: 650;
  letter-spacing: -0.25px;
}
.map-page .card-type,
.map-page .card-meta,
.map-page .card-summary {
  display: none;
}
.map-page .card-actions {
  top: -38px;
  left: -1px;
  right: auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid color-mix(in srgb, var(--ink) 13%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--ink) 9%, transparent);
  transition:
    opacity 0.15s,
    visibility 0.15s;
}
.map-page .thought-card:hover .card-actions,
.map-page .thought-card:focus-within .card-actions,
.map-page .thought-card.actions-open .card-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.map-page .card-actions button {
  width: 29px;
  height: 29px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  display: grid;
  place-items: center;
}
.map-page .card-actions button:hover,
.map-page .card-actions button:focus-visible {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  outline: none;
}
.map-page .thought-card.connect-source {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent) !important;
}
.map-page .workspace-toolbar,
.map-page .flow-panel,
.map-page .space-hint {
  z-index: 30;
}
.map-page .workspace {
  touch-action: none;
}
.map-page .canvas,
.map-page .connections {
  touch-action: none;
  will-change: transform;
}
.map-page .workspace button {
  min-height: 29px;
}
.map-page .map-head-actions button,
.map-page .workspace-toolbar button {
  white-space: nowrap;
}

@media (max-width: 650px) {
  .map-page .thought-card {
    max-width: calc(100vw - 32px);
    padding: 6px 9px 7px;
  }
  .map-page .thought-card p {
    font-size: 14px;
  }
  .map-page .card-actions {
    top: -40px;
  }
  .map-page .thought-card.actions-open .card-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .map-page .workspace {
    height: calc(100dvh - 270px);
    min-height: 520px;
  }
  .map-page .workspace-toolbar {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    z-index: 40;
  }
  .map-page .workspace-toolbar button {
    min-height: 36px;
    padding: 8px 11px;
  }
  .map-page .space-hint {
    bottom: 64px;
    max-width: calc(100% - 20px);
  }
  .map-page .flow-panel {
    bottom: 10px;
    left: 10px;
    right: 10px;
    max-width: none;
  }
  .map-page .map-heading {
    align-items: flex-start;
  }
  .map-page .map-heading .map-head-actions {
    flex-wrap: wrap;
  }
  .map-page .map-layout {
    grid-template-columns: 1fr;
  }
  .map-page .map-rail {
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    overflow-x: auto;
    padding: 7px;
  }
  .map-page .rail-button {
    min-width: 128px;
    padding: 9px;
  }
  .map-page .rail-divider,
  .map-page .map-stats,
  .map-page .rail-theme,
  .map-page .rail-help {
    display: none;
  }
  .map-page .map-app {
    width: calc(100vw - 16px);
    padding: 12px 0;
  }
  .map-page .map-subtitle {
    display: none;
  }
  .map-page .title-row input {
    width: 60vw;
    font-size: 25px;
  }
  .map-page .topbar {
    padding: 0 12px;
  }
  .map-page .map-center-nav {
    display: none;
  }
  .map-page .outline-button {
    display: none;
  }
}
.product-tools {
  gap: 3px;
}
.product-tools button {
  min-width: 32px;
}

#mapSearchResults {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  max-height: 50vh;
  overflow: auto;
}
.search-result {
  padding: 13px 14px;
  text-align: left;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.search-result:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.product-empty {
  color: var(--muted);
  padding: 18px 4px;
}
.thought-card.search-hit {
  animation: oydinSearchHit 1.2s ease;
}

@keyframes oydinSearchHit {
  0%,
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
  25% {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 18%, transparent);
  }
}
.oqim-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 8px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  color: var(--muted);
}
.oqim-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}
.oqim-search:focus-within {
  border-color: var(--accent);
}

@media (max-width: 650px) {
  .product-tools button:nth-child(3) {
    display: none;
  }
  .product-dialog {
    padding: 22px;
    border-radius: 18px;
  }
}
.thinking-focus .thought-card {
  transition:
    opacity 0.22s ease,
    filter 0.22s ease,
    transform 0.22s ease;
}
.thinking-focus .thought-card.is-dimmed {
  opacity: 0.16;
  filter: saturate(0.35) blur(0.15px);
}
.thinking-focus .thought-card.is-focused {
  opacity: 1;
  filter: none;
  transform: translateZ(0) scale(1.025);
}
.exit-focus {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 13px;
  box-shadow: 0 10px 30px rgb(0, 0, 0, 0.08);
  backdrop-filter: blur(14px);
  font: inherit;
  cursor: pointer;
}
.exit-focus span {
  font-size: 16px;
}
.thinking-focus .connections {
  transition: opacity 0.2s;
}
.thinking-focus .connection-group {
  opacity: 0.22;
}
.thinking-focus .connection-group.selected {
  opacity: 1;
}
.thinking-focus .connection-group:has(path) {
  transition: opacity 0.2s;
}
.connection-label {
  font:
    500 10px/1 system-ui,
    sans-serif;
  letter-spacing: 0.03em;
  fill: currentColor;
  opacity: 0.7;
}
.connection-group.selected .connection-label {
  opacity: 1;
}
.card-actions .focus {
  font-size: 14px !important;
}
.workspace .relation-panel {
  position: absolute;
  z-index: 35;
  right: 18px;
  top: 62px;
  width: min(280px, calc(100% - 36px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  color: var(--ink);
  box-shadow: 0 18px 55px rgb(0, 0, 0, 0.14);
  backdrop-filter: blur(16px);
}
.relation-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.relation-head button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
}
.relation-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 12px;
}
.relation-options button {
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  border-radius: 10px;
  padding: 9px 8px;
  text-align: left;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.relation-options button:hover,
.relation-options button.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.relation-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

@media (max-width: 700px) {
  .exit-focus {
    right: 12px;
    bottom: 12px;
  }
  .workspace .relation-panel {
    right: 10px;
    top: 58px;
  }
  .relation-options {
    grid-template-columns: 1fr 1fr;
  }
  .thinking-focus .thought-card.is-dimmed {
    opacity: 0.1;
  }
}

/* ==========================================================================
   Yangi qatlamlar: sudrash, klaviatura fokusi, tasdiq oynalari, sinxronizatsiya
   ========================================================================== */

/* Sudralayotgan karta — kursor va soya bilan aniq belgilanadi. */
.thought-card.is-dragging {
  cursor: grabbing;
  z-index: 20;
  box-shadow: 0 24px 50px color-mix(in srgb, var(--ink) 22%, transparent);
}

/* Aloqalar endi klaviatura bilan ham tanlanadi — ilgari ular `aria-hidden`
   konteynerida bo'lib, yordamchi texnologiyalar uchun umuman mavjud emas edi.
   (Asosiy `.connection-group` qoidasi yuqorida, 363-qatorda.) */
.connection-group:focus-visible {
  outline: none;
}
.connection-group:focus-visible .connection-line {
  stroke: var(--accent);
  stroke-width: 3.2;
  stroke-dasharray: 6 4;
}
.connection-group:focus-visible .connection-glow {
  opacity: 0.9;
  stroke-width: 12;
}

.relation-remove {
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  border: 1px solid color-mix(in srgb, #9f4c45 45%, transparent);
  border-radius: 9px;
  background: transparent;
  color: #9f4c45;
  font: 700 10px var(--font-sans);
  cursor: pointer;
}
.relation-remove:hover {
  background: color-mix(in srgb, #9f4c45 12%, transparent);
}

/* --------------------------- saqlash holati ------------------------------ */

.save-state[data-tone='error'] {
  color: #9f4c45;
  font-weight: 700;
}
.save-state[data-tone='pending'] {
  color: var(--muted);
}
.map-page .save-state {
  max-width: 42ch;
}

/* ------------------------- tasdiqlash oynalari --------------------------- */

/* ----------------------- sinxronizatsiya ko'rsatkichi --------------------- */

/* ----------------------------- vault oynasi ------------------------------ */

/* ==========================================================================
   Mobil: yordam va makon ohangi yo‘qolmasin
   ==========================================================================
   Ilgari `<950px` da `.rail-help` butunlay `display: none` edi — ya'ni
   "Qanday ishlaydi?" yo‘riqnomasiga telefondan umuman yetib bo‘lmasdi.
   Endi u ixcham dumaloq tugmaga aylanadi va rail ichida qoladi. */

@media (max-width: 950px) {
  .map-page .map-rail {
    flex-wrap: wrap;
  }
  .map-page .rail-help {
    display: inline-flex;
    order: 9;
    margin: 0 0 0 8px;
    padding: 0;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
  }
  .map-page .rail-help > span {
    width: auto;
    height: auto;
    border: 0;
    background: transparent;
    font-weight: 800;
  }
  .map-page .rail-help > div {
    display: none;
  }
  .map-page .rail-theme {
    /* `display` ni ham qaytaramiz: yuqoridagi 650px bloki uni yashiradi. */
    display: block;
    order: 8;
    margin-top: 0;
    padding: 6px 8px;
    flex: 1 1 100%;
  }
  .map-page .rail-theme > small {
    display: none;
  }
  .map-page .theme-swatches {
    margin-top: 0;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }
  .map-page .swatch {
    height: 30px;
  }
}

/* Karta ish maydonining yuqori chekkasida bo‘lsa, amallar paneli tepada
   qirqilib qoladi — shunday holatda uni pastga tushiramiz. */
.map-page .thought-card.actions-below .card-actions {
  top: auto;
  bottom: -38px;
}

/* ==========================================================================
   Telefon: Makon sahifasini barmoq bilan ishlatsa bo‘ladigan qilish
   ==========================================================================
   Auditda topilgan eng jiddiy muammo: asboblar paneli ikkita klasterdan
   iborat va `justify-content: space-between` bilan joylashardi. 390px
   ekranda ikkinchi klaster (Yangi makon / Saqlash) x=395–569 ga, ya'ni
   ekrandan TASHQARIGA chiqib ketardi — telefonda ularni bosib bo'lmasdi.
   ========================================================================== */

@media (max-width: 760px) {
  .map-page .workspace-toolbar {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    top: 10px;
    left: 10px;
    right: 10px;
  }
  .map-page .workspace-toolbar .tool-cluster {
    flex: 0 1 auto;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .map-page .workspace-toolbar .tool-cluster::-webkit-scrollbar {
    display: none;
  }
  .map-page .workspace-toolbar button {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
    white-space: nowrap;
  }
  .map-page .workspace-toolbar .tool-cluster span {
    min-width: 48px;
  }

  /* Pastki panel ekrandan chiqib ketmasin. */
  .map-page .flow-panel {
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    transform: none;
    bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .map-page .flow-panel button {
    margin-left: auto;
    min-height: 44px;
  }

  /* Makon ohangi tugmalari barmoqqa mos. */
  .map-page .swatch {
    min-height: 44px;
  }
  .map-page .rail-button {
    min-height: 48px;
  }

  /* Sarlavha maydoni ham qulay bo‘lsin. */
  .map-page .title-row input {
    width: 100%;
    min-height: 44px;
    font-size: 24px;
  }
  .map-page .map-heading {
    gap: 12px;
  }
  .map-page .map-head-actions {
    width: 100%;
  }
  .map-page .map-head-actions button {
    flex: 1 1 auto;
  }

  /* Ish maydoni telefonda balandroq bo‘lsin — asosiy joy shu. */
  .map-page .workspace {
    height: calc(100dvh - 210px);
    min-height: 360px;
  }

  /* Bo‘sh holatdagi asosiy tugma ham barmoqqa mos. */
  .map-page .empty-state button {
    min-height: 48px;
    padding: 12px 20px;
    font-size: 13px;
  }

  /* Karta amallari barmoq uchun kattaroq. */
  .map-page .card-actions button {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }
  .map-page .card-actions {
    gap: 4px;
    padding: 5px;
  }

  /* Fikr matni telefonda o‘qish uchun kattaroq. */
  .map-page .thought-card p {
    font-size: 16px;
  }

  /* Dialog ichidagi maydonlar. */
  .card-dialog-form textarea,
  .detail-dialog textarea,
  .detail-dialog input,
  .detail-dialog select {
    font-size: 16px;
    min-height: 48px;
  }
  .card-dialog-form textarea,
  .detail-dialog textarea {
    min-height: 120px;
  }
  .type-picker .type {
    flex: 1 1 auto;
    min-height: 44px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }

  /* Aloqa chizig‘ini barmoq bilan bosish oson bo‘lsin. */
  .connection-glow {
    stroke-width: 18;
  }
}

/* ==========================================================================
   Telefon: ixcham asboblar paneli + amallar varag‘i
   ==========================================================================
   Panelda faqat zoom va "Sig‘dirish" qoladi; qolgan amallar "⋯" tugmasi
   ortidagi pastki varaqqa ko‘chadi. Shu tufayli panel bir qatorga sig‘adi
   va ish maydonini yeb qo‘ymaydi (ilgari 184px balandlikda edi).
   ========================================================================== */

.mobile-actions-trigger {
  margin-left: auto;
}

body:not(.has-mobile-actions) .mobile-actions-trigger {
  display: none;
}

@media (max-width: 760px) {
  .map-page.has-mobile-actions .workspace-toolbar {
    flex-wrap: nowrap;
    align-items: flex-start;
  }
  /* Varaqqa ko‘chgan tugmalar paneldan olib tashlanadi. */
  /* Aniq sinf nomlari bo‘yicha — `nth-of-type` mo‘rt edi, chunki
     `#oydinProductTools` panelga birinchi bo‘lib qo‘shiladi va tartibni
     suradi. */
  .map-page.has-mobile-actions #oydinProductTools,
  .map-page.has-mobile-actions .workspace-toolbar .space-tools,
  .map-page.has-mobile-actions #autoLayout {
    display: none;
  }
  .map-page.has-mobile-actions .mobile-actions-trigger {
    display: flex;
  }
  .map-page.has-mobile-actions .mobile-actions-trigger button {
    font-size: 20px;
    line-height: 1;
  }
}

/* Pastki varaq */
.mobile-actions {
  width: min(560px, calc(100vw - 16px));
  max-height: 82dvh;
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  background: var(--panel);
  color: var(--ink);
}
.mobile-actions::backdrop {
  background: color-mix(in srgb, var(--ink) 45%, transparent);
  backdrop-filter: blur(4px);
}
.mobile-actions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 6px;
}
.mobile-actions-head .kicker {
  margin: 0;
}
.mobile-actions-head .dialog-close {
  position: static;
}
.mobile-actions-list {
  display: grid;
  gap: 6px;
  padding: 8px 14px calc(18px + env(safe-area-inset-bottom));
}
.mobile-action {
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--ink);
  font: 700 14px var(--font-sans);
  text-align: left;
  cursor: pointer;
}
.mobile-action:hover,
.mobile-action:focus-visible {
  border-color: var(--accent);
}
.mobile-actions-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.mobile-action-page {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--ink);
  font: 700 13px var(--font-sans);
  text-decoration: none;
}
.mobile-action-page:hover,
.mobile-action-page:focus-visible {
  border-color: var(--accent);
}
.mobile-action-glyph {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 15px;
}

/* ==========================================================================
   Telefon: ish maydoni asosiy joyni egallasin
   ==========================================================================
   O‘lchov (390×844): topbar 74 + sarlavha 111 + yon panel 235 = 420px —
   ya'ni ish maydoni ekranning yarmidan pastda boshlanardi va uni ko‘rish
   uchun aylantirish kerak edi. Endi yon panel bitta ixcham qatorga,
   sarlavha esa bitta satrga sig‘adi.
   ========================================================================== */

@media (max-width: 760px) {
  .map-page .map-app {
    padding: 8px 0 10px;
  }

  /* Sarlavha: nom va amallar bitta ixcham blokda. */
  .map-page .map-heading {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
  }
  .map-page .map-heading .kicker {
    display: none;
  }
  .map-page .title-row {
    gap: 8px;
  }
  .map-page .title-row input {
    font-size: 20px;
    min-height: 40px;
  }
  .map-page .map-head-actions {
    display: flex;
    gap: 8px;
  }
  .map-page .map-head-actions button {
    min-height: 44px;
    font-size: 12px;
  }

  /* Yon panel: bitta gorizontal qator, kerak bo‘lsa siljiydi. */
  .map-page .map-rail {
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    padding: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    border-radius: 14px;
  }
  .map-page .map-rail::-webkit-scrollbar {
    display: none;
  }
  .map-page .rail-button {
    /* Asosiy qoidada `width: 100%` bor — telefonda u qo‘shni tugmani
       ekrandan itarib chiqarardi. */
    width: auto;
    flex: 0 1 auto;
    min-width: auto;
    min-height: 44px;
    padding: 6px 12px;
    grid-template-columns: auto auto;
    column-gap: 7px;
    align-items: center;
  }
  .map-page .rail-button small {
    display: none;
  }
  .map-page .rail-button span {
    grid-row: auto;
    font-size: 16px;
  }
  .map-page .rail-theme {
    flex: 0 0 auto;
    order: 0;
    padding: 0 4px;
    border: 0;
    background: transparent;
  }
  .map-page .theme-swatches {
    display: flex;
    gap: 6px;
  }
  .map-page .swatch {
    flex: 0 0 34px;
    width: 34px;
    min-height: 34px;
    height: 34px;
  }
  .map-page .rail-help {
    order: 0;
    margin-left: 0;
  }

  /* Ish maydoni qolgan joyni to‘liq egallaydi.
     Chrome balandligi o‘lchandi: topbar 74 + sarlavha ~107 + yon panel 58
     + oraliqlar ~45 = ~284px. Shu tufayli sahifa vertikal aylanmaydi. */
  .map-page .workspace {
    height: calc(100dvh - 284px);
    min-height: 300px;
  }

  /* Aloqa turi paneli — pastki varaq ko‘rinishida, kartalarni qoplamasin. */
  .map-page .relation-panel {
    position: fixed;
    inset: auto 0 0;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    z-index: 40;
  }
  .map-page .relation-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .map-page .relation-options button {
    min-height: 46px;
  }
  .map-page .relation-remove {
    min-height: 46px;
  }
  /* Panel ochilganda pastdagi oqim paneli xalaqit bermasin. */
  .map-page .workspace:has(.relation-panel) .flow-panel {
    display: none;
  }
}

/* Telefonda yon panelda faqat eng kerakli ikkita boshqaruv qoladi;
   yozuvlar va makon ohangi "⋯" varag‘iga ko‘chadi. Ilgari ular
   gorizontal siljish ortida — ekrandan tashqarida qolib ketardi. */
@media (max-width: 760px) {
  .map-page.has-mobile-actions .rail-theme,
  .map-page.has-mobile-actions #railNotes {
    display: none;
  }
  .map-page.has-mobile-actions .map-rail {
    overflow-x: visible;
  }
  .map-page .title-row input {
    min-height: 44px;
  }
}

.mobile-actions-label {
  margin: 6px 2px 2px;
  font: 500 10px var(--font-mono);
  letter-spacing: 0.1em;
  color: var(--muted);
}
.mobile-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 6px;
}
.mobile-swatch {
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.mobile-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}
.mobile-swatch[data-space='paper'] {
  background: linear-gradient(135deg, #e7e0d4, #f3eee4);
}
.mobile-swatch[data-space='mist'] {
  background: linear-gradient(135deg, #ccd8d8, #e8e3db);
}
.mobile-swatch[data-space='sand'] {
  background: linear-gradient(135deg, #d9c2a0, #eee0c9);
}
.mobile-swatch[data-space='night'] {
  background: linear-gradient(135deg, #31332f, #49483f);
}
.mobile-swatch[data-space='ink'] {
  background: linear-gradient(135deg, #252b2c, #3a4140);
}

/* ------------------------------- toast ----------------------------------- */

/*
 * Qisqa muddatli xabar. `Ctrl+Z` bosilganda ekranda hech qanday javob
 * yo'q edi — foydalanuvchi amal bajarilganini bilmasdi.
 */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(58px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  justify-content: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 30rem);
  padding: 11px 16px;
  border: 1px solid color-mix(in srgb, var(--paper) 22%, var(--ink));
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 16px 38px color-mix(in srgb, var(--ink) 26%, transparent);
  opacity: 0;
  transform: translateY(8px);
  transition: 0.22s;
}
.toast[data-shown='true'] {
  opacity: 1;
  transform: translateY(0);
}
.toast-text {
  font: 700 12px var(--font-sans);
}
.toast-hint {
  font: 500 10px var(--font-mono);
  color: color-mix(in srgb, var(--paper) 68%, transparent);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}

/* ------------------------- birinchi qo'llanma ---------------------------- */

/*
 * Bo'sh makon yangi odamga hech narsa taklif qilmaydi. Qo'llanma faqat
 * BIRINCHI tashrifda chiqadi va istagan payt to'xtatiladi.
 *
 * Yoritish bitta element bilan: ulkan `box-shadow` atrofni qoraytiradi,
 * elementning o'zi esa shaffof qoladi.
 */

.tour {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.tour-spot {
  position: fixed;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px color-mix(in srgb, #12110f 62%, transparent);
  pointer-events: none;
  transition: 0.28s;
}
.tour-spot[data-on='false'] {
  inset: 0;
  border-radius: 0;
  box-shadow: none;
  background: color-mix(in srgb, #12110f 62%, transparent);
}
.tour-card {
  position: relative;
  z-index: 1;
  width: min(30rem, 100%);
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 30px 80px rgb(0 0 0 / 34%);
}
.tour-card[data-place='top'] {
  margin-bottom: auto;
  margin-top: 6vh;
}
.tour-card[data-place='bottom'] {
  margin-top: auto;
  margin-bottom: 6vh;
}
.tour-card h2 {
  margin: 6px 0 10px;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
}
.tour-kicker {
  margin: 0;
  font: 700 10px var(--font-mono);
  letter-spacing: 1.4px;
  color: var(--accent-2);
}
.tour-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}
.tour-hint {
  display: inline-block;
  margin: 12px 0 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font: 600 11px var(--font-mono);
  color: var(--ink);
}
.tour-figure {
  display: block;
  width: 100%;
  max-width: 17rem;
  height: auto;
  margin: 4px 0 14px;
}
.tour-figure .tour-node {
  fill: var(--surface);
  stroke: var(--line);
}
.tour-figure .tour-edge {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 5 4;
}
.tour-figure .tour-dot {
  fill: var(--accent);
}
.tour-figure .tour-glyph {
  fill: var(--paper);
  font: 700 11px var(--font-sans);
}
.tour-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
}
.tour-dots {
  display: flex;
  gap: 6px;
}
.tour-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
  transition: 0.2s;
}
.tour-dots i[data-active='true'] {
  width: 18px;
  border-radius: 3px;
  background: var(--accent);
}
.tour-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tour-skip {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font: 700 11px var(--font-sans);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.tour-skip:hover {
  color: var(--ink);
}

@media (max-width: 560px) {
  .tour-card {
    padding: 18px;
  }
  .tour-card h2 {
    font-size: 20px;
  }
  .tour-foot {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .tour-buttons {
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tour-spot,
  .tour-dots i {
    transition: none;
  }
}

.help-replay {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* --------------------------- zaxira eslatmasi ---------------------------- */

/*
 * Bir martalik, yopilgach qaytmaydi. Ogohlantirish emas, taklif —
 * shuning uchun qizil emas, tinch ohangda.
 */

.backup-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 0 12px 12px 0;
  background: var(--panel);
  font-size: 13px;
  line-height: 1.5;
}
.backup-notice b {
  font-weight: 800;
}
.backup-notice span {
  color: var(--muted);
}
.backup-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
