:root
{
  --bg: var(--color-white);
  --card: var(--color-white);
  --text: var(--color-background);
  --muted: var(--color-muted);
  --line: var(--palette-0e77e12406);
  --accent: var(--color-violet);
  --accent-soft: var(--color-cyan-pale);
  --shadow: 0 6px 18px var(--color-surface-dark);
  --radius: 14px;
}

*
{
  box-sizing: border-box;
}

body
{
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, var(--color-white) 0%, var(--color-background) 60%);
  color: var(--color-white);
}

/* Keep the shared portal header on its original dark palette on this light page. */
.self-launch-page .portal-header
{
  --line: var(--color-mint-soft);
  --line-strong: var(--color-cyan-50);
  --text: var(--color-white);
  --muted: var(--color-silver-muted);
  --gold: var(--color-gold);
  background: var(--color-background);
}

/* Self-launch system */
.self-launch-page
{
  color: var(--color-white);
  background: radial-gradient(circle at 50% 0, var(--color-mint-soft), transparent 42rem), var(--color-background);
}

.self-launch-page .page, .self-launch-page .mindmap, .self-launch-page .content-layout
{
  color: var(--color-white);
}


.self-launch-page .node > .node-row, 
.self-launch-page .node.incomplete > .node-row, 
.self-launch-page .node.complete > .node-row, 
.self-launch-page .todo-panel, 
.self-launch-page .toolbar-menu
{
  border-color: var(--color-border-soft);
  color: var(--color-white);
  background: linear-gradient(145deg, var(--color-blue-dark), var(--palette-684ec034c3) 72%);
  box-shadow: inset 0 0 0 1px var(--color-white-50), 0 12px 30px var(--color-overlay-dark-20);
}

.self-launch-page .node.complete > .node-row
{
  border-color: var(--color-cyan-50);
  background: linear-gradient(145deg, var(--color-teal), var(--color-background) 72%);
}

.self-launch-page .title, 
.self-launch-page .todo-item-text, 
.self-launch-page .completion-popup__text, 
.self-launch-page .sos-popup__text, 
.self-launch-page .info-popup__body
{
  color: var(--color-white);
}

.self-launch-page .hint, .self-launch-page .progress, .self-launch-page .todo-item-branch
{
  color: var(--color-mint);
}

.self-launch-page .todo-item-title, .self-launch-page .tt, .self-launch-page #basa
{
  color: var(--color-cyan);
}

.self-launch-page .toggle, .self-launch-page .icon-btn, .self-launch-page .todo-check
{
  border-color: var(--color-border-soft);
  color: var(--color-white);
  background: linear-gradient(145deg, var(--color-muted), var(--color-background));
}

.help-fab
{
  border-color: var(--color-border-soft);
  color: var(--color-white);
  background: linear-gradient(145deg, var(--color-muted), var(--color-background));
  box-shadow: inset 0 0 0 1px var(--color-white-50), 0 8px 22px var(--color-overlay-dark-20);
}

.help-fab:hover, .help-fab:focus-visible
{
  border-color: var(--color-cyan);
  color: var(--color-mint);
  box-shadow: 0 0 18px var(--color-cyan-50);
}

.page
{
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px;
}

.toolbar
{
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: var(--color-white);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-beige-82);
  border-radius: 14px;
}

.toolbar button
{
  border: 1px solid var(--color-mint-soft);
  background: var(--color-background);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s ease;
}

.toolbar button:hover
{
  border-color: var(--color-silver-muted);
  transform: translateY(-1px);
}

.mindmap-wrap
{
  overflow: visible;
  padding-bottom: 20px;
}

.mindmap
{
  min-width: 0;
  padding: 8px 8px 28px;
}

.root-title
{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--color-background);
  border: 1px solid var(--color-mint-soft);
  border-radius: 18px;
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 24px;
  line-height: 1.2;
}

#logo
{
  width: 150px;
  height: 100%;
  opacity: 0.9;
}

.content-layout
{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

.branches
{
  min-width: 0;
}

.tree
{
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree ul
{
  list-style: none;
  margin: 10px 0 0 20px;
  padding: 0 0 0 18px;
  position: relative;
}

.tree ul::before
{
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 14px;
  width: 2px;
  background: var(--color-mint-soft);
}

.node
{
  position: relative;
  margin-bottom: 10px;
}

.node > .node-row
{
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-background);
  border: 1px solid var(--color-mint-soft);
  border-radius: var(--radius);
  padding: 0px 12px;
  box-shadow: var(--shadow);
}

.node.incomplete > .node-row
{
  background: linear-gradient(180deg, var(--color-white) 0%, var(--color-white) 100%);
}

.node.complete > .node-row
{
  background: linear-gradient(180deg, var(--color-white) 0%, var(--color-white) 100%);
  border-color: var(--color-cyan-pale);
}

.node.has-children > .node-row::before
{
  content: "";
  position: absolute;
  left: -13px;
  top: 18px;
  width: 13px;
  height: 2px;
  background: var(--color-mint-soft);
}

.check
{
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--color-cyan);
  cursor: pointer;
  flex: 0 0 auto;
}

.content
{
  min-width: 0;
  flex: 1;
}

.title
{
  font-size: 18px;
  font-weight: 750;
  line-height: 1.25;
  margin: 0;
  word-break: break-word;
}

.leaf > .node-row .title
{
  font-size: 15px;
  font-weight: 500;
}

.hint
{
  margin-top: 4px;
  color: var(--color-cyan-pale);
  font-size: 12px;
}

.children.collapsed
{
  display: none;
}

.progress
{
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-cyan-pale);
}

.todo-panel
{
  position: sticky;
  top: 84px;
  align-self: start;
  background: var(--color-background);
  border: 1px solid var(--color-mint-soft);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.todo-panel h2
{
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.2;
}

.todo-panel ol
{
  margin: 0;
  padding-left: 24px;
}

.todo-panel li
{
  margin-bottom: 16px;
}

.todo-item-branch
{
  font-size: 12px;
  color: var(--color-cyan-pale);
  margin-bottom: 4px;
}

.todo-item-title
{
  font-size: 14px;
  line-height: 1.35;
  margin-bottom: 4px;
  color: var(--color-violet);
}

#basa
{
  color: var(--color-violet);
}

.todo-item-text
{
  font-size: 14px;
  line-height: 1.45;
  color: var(--color-white);
}

.completion-popup
{
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--color-overlay-dark-20);
  backdrop-filter: blur(4px);
}

.completion-popup.hidden
{
  display: none;
}

.completion-popup__card
{
  width: min(480px, 100%);
  background: var(--color-white);
  border: 1px solid var(--color-mint-soft);
  border-radius: 22px;
  box-shadow: 0 20px 60px var(--color-overlay-dark-20);
  padding: 24px;
  text-align: center;
  position: relative;
  z-index: 1001;
}

.completion-popup__emoji
{
  font-size: 36px;
  margin-bottom: 8px;
}

.completion-popup__title
{
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.2;
}

.completion-popup__text
{
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--color-white);
}

.popup__actions
{
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

#confettiCanvas
{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

.todo-check-row
{
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.todo-check
{
  margin-top: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--color-violet);
  cursor: pointer;
  flex: 0 0 auto;
}

.todo-check-content
{
  min-width: 0;
}

.todo-enter
{
  opacity: 0;
  transform: translateY(10px);
}

.todo-enter-active
{
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.todo-list-item
{
  list-style: none;
  margin-bottom: 14px;
  opacity: 1;
  transform: translateY(0);
}

.todo-removing
{
  opacity: 0;
  transform: translateX(24px);
  height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-width: 0 !important;
  transition: opacity 0.3s ease, transform 0.3s ease, height 0.3s ease, margin 0.3s ease, padding 0.3s ease, border-width 0.3s ease;
}

/* базовая кнопка */
.icon-btn
{
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--color-mint-soft);
  background: var(--color-background);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* hover */
.icon-btn:hover
{
  transform: translateY(-1px);
  border-color: var(--color-silver-muted);
  box-shadow: var(--shadow);
}

/* active */
.icon-btn:active
{
  transform: translateY(0);
}

/* danger (очистка) */
.icon-btn.danger
{
  color: var(--color-brown);
}

.icon-btn.danger:hover
{
  border-color: var(--color-pink);
  background: var(--color-white);
}

.tt
{
  font-weight: 700;
  color: var(--color-violet);
}

@media (max-width: 900px)
{
  .content-layout
  {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .todo-collapse-icon
  {
    display: inline-block !important;
  }

  .todo-panel
  {
    width: 100%;
    position: sticky;
    top: 72px;
    order: -1;
    padding: 14px;
    border-radius: 14px;
    max-height: 38vh;
    overflow: auto;
    z-index: 15;
  }

  .todo-panel h2
  {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .todo-panel ol
  {
    padding-left: 18px;
  }

  .todo-panel li
  {
    margin-bottom: 12px;
  }

  .todo-item-branch
  {
    font-size: 11px;
  }

  .todo-item-title
  {
    font-size: 13px;
    line-height: 1.3;
  }

  .todo-item-text
  {
    font-size: 13px;
    line-height: 1.35;
  }

  .node > .node-row
  {
    padding: 8px 10px;
    gap: 8px;
  }

  .title
  {
    font-size: 15px;
    line-height: 1.2;
  }

  .leaf > .node-row .title
  {
    font-size: 14px;
  }

  .progress
  {
    font-size: 11px;
    margin-top: 3px;
  }

  .check
  {
    width: 17px;
    height: 17px;
  }

  .tree ul
  {
    margin: 8px 0 0 14px;
    padding: 0 0 0 14px;
  }

  .tree ul::before
  {
    left: 5px;
  }

  .node.has-children > .node-row::before
  {
    left: -10px;
    width: 10px;
    top: 16px;
  }

  .page
  {
    height:95%;
  }

}

.sos-btn
{
  border: 1px solid var(--color-mint-soft);
  background: var(--color-brown);
  color: var(--color-white);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  margin-left: 6px;
}

.sos-btn:hover
{
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.sos-popup__text
{
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-white);
}

.sos-popup__options
{
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.sos-option
{
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--color-mint-soft);
  border-radius: 14px;
  cursor: pointer;
}

.sos-option input[type="radio"]
{
  margin-top: 3px;
  accent-color: var(--color-cyan);
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 0;
  box-shadow: none;
}

.sos-option__text
{
  font-size: 15px;
  line-height: 1.4;
}

.popup__actions
{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 700px)
{

  .sos-popup__text, .sos-option__text
  {
    font-size: 14px;
  }

  .todo-panel
  {
    position: sticky;
    top: 84px;
    align-self: start;
    background: var(--color-background);
    border: 1px solid var(--color-mint-soft);
    border-radius: 16px;
    box-shadow: 0 5px 14px var(--color-surface-dark);
    width: 100%;
    position: static;
    order: -1;
    padding: 14px;
    border-radius: 14px;
    max-height: none;
    overflow: visible;
    z-index: 15;
  }

  #logo
  {
    width: 100px;
    height: 80%;
    opacity: 0.9;
  }

  .page
  {
    padding: 12px;
  }

  .root-title
  {
    font-size: 16px;
    padding: 8px 10px;
  }

  .title
  {
    font-size: 16px;
  }

  .leaf > .node-row .title
  {
    font-size: 14px;
  }

  .todo-item-title
  {
    display: none;
  }

}

.hidden
{
  display: none !important;
}

.todo-header
{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.todo-header h2
{
  margin: 0;
}

.menu-btn
{
  display: none;
}

.toolbar-actions
{
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}

.toolbar-menu
{
  display: flex;
  gap: 10px;
  align-items: center;
}

@media (max-width: 900px)
{
  .menu-btn
  {
    display: flex;
  }

  .toolbar-menu
  {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 170px;
    padding: 10px;
    background: var(--color-background);
    border: 1px solid var(--color-mint-soft);
    border-radius: 16px;
    box-shadow: 0 10px 24px var(--color-gold);
  }

  .toolbar-menu.open
  {
    display: flex;
  }

  .toolbar-menu .icon-btn, .toolbar-menu .sos-btn
  {
    width: 100%;
    justify-content: center;
  }

  .toolbar-menu .sos-btn
  {
    margin-left: 0;
  }

  .todo-panel
  {
    position: sticky;
    top: 84px;
    align-self: start;
    background: var(--color-background);
    border: 1px solid var(--color-mint-soft);
    border-radius: 16px;
    box-shadow: 0 5px 14px var(--color-surface-dark);
    width: 100%;
    position: static;
    order: -1;
    padding: 14px;
    border-radius: 14px;
    max-height: none;
    overflow: visible;
    z-index: 15;
  }

}

@media (max-width: 700px)
{
  html, body
  {
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .page
  {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 12px;
    padding-bottom: 24px;
  }

  .toolbar
  {
    position: static;
    flex: 0 0 auto;
  }

  .mindmap-wrap
  {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
    padding-bottom: 0;
  }

  .mindmap
  {
    height: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 8px 8px 16px;
  }

  .root-title
  {
    flex: 0 0 auto;
  }

  .content-layout
  {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 0 0 auto;
    min-height: 0;
  }

  .todo-panel
  {
    width: 100%;
    position: sticky;
    top: 84px;
    order: -1;
    flex: 0 0 auto;
    padding: 14px;
    border-radius: 14px;
    max-height: none;
    overflow: visible;
    z-index: 15;
  }

  .branches
  {
    flex: 0 0 auto;
    min-height: 0;
    max-height: calc(100vh - 270px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    padding-bottom: 20px;
  }

  .branches::-webkit-scrollbar
  {
    display: none;
    width: 0;
    height: 0;
  }

}

.todo-header
{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.todo-collapse-trigger
{
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  min-width: 0;
}

.todo-collapse-trigger h2
{
  margin: 0;
}

.todo-collapse-icon
{
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-blue-dark);
  border-bottom: 2px solid var(--color-blue-dark);
  transform: rotate(45deg);
  transition: transform 0.28s ease;
  flex: 0 0 auto;
  margin-top: 2px;
}

.todo-panel-body
{
  overflow: hidden;
  max-height: 2000px;
  opacity: 1;
  margin-top: 18px;
  transition: max-height 0.35s ease, opacity 0.22s ease, margin-top 0.35s ease;
}

.todo-panel.is-collapsed .todo-panel-body
{
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.todo-panel.is-collapsed .todo-collapse-icon
{
  transform: rotate(-135deg);
}

@media (max-width: 700px)
{
  .todo-panel
  {
    overflow: hidden;
  }

  .todo-header
  {
    align-items: center;
  }

  .todo-collapse-trigger
  {
    flex: 1 1 auto;
  }

  .todo-collapse-icon
  {
    display: inline-block;
  }

}

.todo-collapse-icon
{
  display: none;
}

.content, .content *
{
  cursor: pointer;
}

.gpt-icon
{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.gpt-icon img
{
  width: 36px;
  height: 36px;
  display: block;
}

.gpt-icon:hover
{
  opacity: 0.7;
}

.todo-header-actions
{
  display: flex;
  align-items: center;
  /* ключевое */
  gap: 12px;
}

.self-launch-tool--locked
{
  position: relative;
  cursor: pointer;
  filter: grayscale(.35);
  opacity: .58;
  text-decoration: none;
  pointer-events: auto;
}

.self-launch-tool--locked:hover,
.self-launch-tool--locked:focus-visible
{
  filter: grayscale(0);
  opacity: .82;
}

.self-launch-tool__lock
{
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  width: 17px;
  height: 17px;
  border: 1px solid var(--color-cyan);
  border-radius: 50%;
  background: var(--color-surface-dark);
  color: var(--color-cyan);
  place-items: center;
}

.self-launch-tool__lock svg
{
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.help-fab-wrap
{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
}

.help-fab
{
  width: 56px;
  height: 56px;
  border: 1px solid var(--color-white);
  border-radius: 999px;
  background: var(--color-white);
  color: var(--color-blue-dark);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-fab:hover
{
  transform: translateY(-1px);
}

.info-popup__card, .info-popup__header
{
  border-color: var(--color-border-soft);
  color: var(--color-white);
}

.info-popup
{
  position: fixed;
  inset: 0;
  z-index: 1300;
}

.info-popup.hidden
{
  display: none;
}

.info-popup__backdrop
{
  position: absolute;
  inset: 0;
  background: var(--color-surface-dark);
  backdrop-filter: blur(4px);
}

.info-popup__card
{
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(760px, calc(100vw - 32px));
  max-height: min(78vh, 760px);
  height: min(78vh, 760px);
  transform: translate(-50%, -50%);
  border-radius: 28px;
  box-shadow: 0 24px 70px var(--color-gold);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--color-blue-dark);
}

.info-popup__card .underlayer
{
  display: flex;
  height: 100%;
  min-height: 0;
  min-height: 0;
  flex-direction: column;
}

.info-popup__header
{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--color-chrome-pale);
}

.info-popup__title
{
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--color-cyan);
}

.info-popup__body
{
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px 24px 26px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  color: var(--color-white);
}

.info-popup__body p, .info-popup__body li
{
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.55;
}

.info-popup__body ol
{
  margin: 0 0 20px;
  padding-left: 28px;
}

.info-popup__body hr
{
  border: 0;
  border-top: 1px solid var(--color-white);
  margin: 24px 0;
}

.info-popup__body::-webkit-scrollbar
{
  width: 10px;
}

.info-popup__body::-webkit-scrollbar-thumb
{
  background: var(--color-silver-muted);
  border-radius: 999px;
}

.info-popup__body::-webkit-scrollbar-track
{
  background: transparent;
}

body.popup-open
{
  overflow: hidden;
  overscroll-behavior: none;
}

@media (max-width: 700px)
{
  .info-popup__card
  {
    width: calc(100vw - 20px);
    max-height: 82vh;
    border-radius: 24px;
  }

  .info-popup__header
  {
    padding: 18px 18px 14px;
  }

  .info-popup__title
  {
    font-size: 20px;
  }

  .info-popup__close
  {
    width: 40px;
    height: 40px;
    font-size: 30px;
  }

  .info-popup__body
  {
    padding: 16px 18px 18px;
  }

  .info-popup__body p, .info-popup__body li
  {
    font-size: 16px;
    line-height: 1.5;
  }

}

body.popup-open
{
  overflow: hidden;
}

#infoPopupCloseBtn
{
  margin-top: 25px;
  margin-bottom: 25px;
}

.content, .content *
{
  cursor: pointer;
}
