﻿.tool-layout {
  width: 100%;
  margin: 0 auto;
  padding: 14px 20px 30px;
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) minmax(160px, 220px);
  gap: 18px;
  align-items: start;
}

.side-ad {
  position: sticky;
  top: 50%;
  transform: translateY(-50%);
}

.side-ad-box {
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mindmap-container {
  max-width: none;
  width: 100%;
  padding: 0;
}

.mindmap-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #f7fbff 0%, #edf4fb 100%);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}

.mindmap-title-input {
  flex: 1 1 auto;
  min-width: 240px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 1rem;
  color: var(--text);
  background: #fff;
}

.mindmap-title-input::placeholder {
  color: var(--muted);
}

.ad-section {
  margin-top: 14px;
}

.mobile-center-ad {
  display: none;
}

.mindmap-app {
  margin-top: 14px;
}

.export-actions {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.export-actions .btn {
  border-color: #1f5fbf;
  background: #1f5fbf;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(22, 63, 132, 0.30);
}

.export-actions .btn:hover {
  border-color: #184d9b;
  background: #184d9b;
  box-shadow: 0 10px 20px rgba(20, 57, 118, 0.34);
}

.canvas-area {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #f7fbff 0%, #edf3fa 100%);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 700px;
}

.canvas-wrapper {
  position: relative;
  flex: 1;
  min-height: 600px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #1f2838;
}

#mindmap {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-controls {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 5;
  display: flex;
  gap: 8px;
}

.canvas-control-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f2f7fd 100%);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.canvas-control-text {
  width: auto;
  min-width: 110px;
  padding: 0 14px;
  font-size: 0.95rem;
  font-weight: 700;
}

.canvas-control-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.canvas-control-btn svg {
  width: 18px;
  height: 18px;
}

.canvas-control-btn path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.canvas-control-btn circle {
  fill: currentColor;
}

.zoom-control-group {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #f2f7fd 100%);
}

.zoom-control-group .zoom-part {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.zoom-control-group .zoom-part:last-child {
  border-right: 0;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #fff 0%, #f2f7fd 100%);
  color: var(--text);
  font-weight: 700;
  padding: 9px 12px;
  cursor: pointer;
}

.btn.danger {
  border-color: #a03232;
  background: #a03232;
  color: #fff;
}

.node-inline-editor {
  position: absolute;
  z-index: 12;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  padding: 0 2px;
  box-shadow: none;
  text-align: center;
}

.node-inline-editor.is-hidden {
  display: none;
}

.node-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  display: grid;
  gap: 6px;
  min-width: 160px;
  box-shadow: var(--shadow-sm);
}

.node-menu.is-hidden {
  display: none;
}

.node-menu button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  font-weight: 600;
  cursor: pointer;
}

.node-menu button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.node-quick-actions {
  position: absolute;
  z-index: 11;
  display: inline-flex;
  gap: 8px;
}

.node-quick-actions[hidden] {
  display: none !important;
}

.node-quick-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f2f7fd 100%);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.node-quick-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.node-quick-btn svg {
  width: 16px;
  height: 16px;
}

.node-quick-btn path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.export-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(10, 20, 36, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.export-preview-modal[hidden] {
  display: none !important;
}

.export-preview-panel {
  width: min(920px, 100%);
  max-height: min(90vh, 900px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.export-preview-panel h2 {
  margin: 0;
  font-size: 1.1rem;
}

.export-size-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.export-preview-body {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f5f8fc;
  display: grid;
  place-items: center;
  padding: 10px;
  overflow: auto;
}

#export-preview-image {
  width: 100%;
  max-width: 760px;
  height: auto;
  object-fit: contain;
}

.export-preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#download-export-image {
  border-color: #1f5fbf;
  background: #1f5fbf;
  color: #ffffff;
}

#download-export-image:hover {
  border-color: #184d9b;
  background: #184d9b;
}

.theme-modal {
  position: fixed;
  inset: 0;
  z-index: 72;
  background: rgba(10, 20, 36, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.theme-modal[hidden] {
  display: none !important;
}

.theme-panel {
  width: min(920px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.theme-panel h2 {
  margin: 0;
  font-size: 1.2rem;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.theme-option {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.theme-option.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft) inset;
}

.theme-option-preview {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.theme-swatch {
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.theme-option-name {
  font-weight: 700;
  color: var(--text);
}

.theme-actions {
  margin-top: 0;
  display: flex;
  justify-content: flex-end;
}

.theme-subtitle {
  margin: 0 0 10px;
  font-size: 0.98rem;
  color: var(--text);
}

.line-style-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.line-style-option {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
}

.line-style-option.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft) inset;
  color: var(--accent);
}

.theme-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.theme-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
  padding: 12px;
}

.node rect {
  fill: #f9fcff;
  stroke: rgba(171, 186, 205, 0.75);
  stroke-width: 1.2;
}

.node text {
  fill: #12233f;
  font-size: 14px;
  pointer-events: none;
}

.node.is-selected rect {
  stroke: #0b7a75;
  stroke-width: 2.4;
}

.edge {
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}

@media (max-width: 1360px) {
  .tool-layout {
    grid-template-columns: minmax(0, 1fr);
    width: min(1280px, 100%);
    padding: 14px 20px 30px;
  }

  .side-ad {
    display: none;
  }

  .mobile-center-ad {
    display: block;
  }

  .mindmap-container {
    max-width: 100%;
  }
}

@media (max-width: 1080px) {
  .canvas-area {
    min-height: 520px;
  }

  .canvas-wrapper {
    min-height: 460px;
  }
}

@media (max-width: 760px) {
  .mindmap-toolbar {
    justify-content: stretch;
    flex-direction: column;
    align-items: stretch;
  }

  .mindmap-toolbar .btn,
  .mindmap-title-input {
    flex: 1 1 auto;
  }

  .canvas-controls {
    right: 10px;
    top: 10px;
  }

  .export-actions {
    flex-direction: column;
  }

  .theme-options {
    grid-template-columns: 1fr;
  }

  .theme-panel {
    padding: 14px;
    gap: 10px;
  }

  .theme-group {
    padding: 10px;
  }
}

.card-section {
  margin-top: 26px;
}

.article-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(244, 249, 255, 0.92) 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  --article-content-width: 860px;
}

.article-card h2 {
  max-width: min(100%, var(--article-content-width));
  margin: 0 auto 18px;
  font-size: 1.45rem;
  text-align: left;
}

.article-body {
  max-width: min(100%, var(--article-content-width));
  margin-inline: auto;
}

.article-body h3 {
  margin: 20px 0 10px;
  font-size: 1.16rem;
  color: #213653;
}

.article-body h3:first-child {
  margin-top: 0;
}

.article-card p {
  margin: 0 0 14px;
  line-height: 1.8;
  color: #334a66;
  font-size: 1.15rem;
}

.article-card p:last-child {
  margin-bottom: 0;
}

.related-tools h2 {
  margin: 0 0 10px;
  font-size: 1.06rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.related-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.related-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.related-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.related-card p {
  margin: 0;
  color: #58708a;
  font-size: 0.9rem;
  line-height: 1.5;
}

.related-card.is-coming {
  opacity: 0.86;
  cursor: not-allowed;
}

.related-card.is-coming:hover {
  transform: none;
  border-color: var(--line);
}

@media (max-width: 1100px) {
  .related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .related-grid {
    grid-template-columns: 1fr;
  }
}
