.mandala-container {
  max-width: 1280px;
}

.tool-layout {
  width: 100%;
}

.side-ad {
  display: none;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  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: 12px;
  box-shadow: var(--shadow-sm);
}

.mandala-container .ad-section {
  margin-top: 0;
  margin-bottom: 16px;
}

.title-input {
  flex: 1 1 280px;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.95rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.toolbar button,
.back-link {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f1f6fb 100%);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.toolbar button:hover,
.back-link:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1.3fr) minmax(360px, 1fr);
  gap: 18px;
}

.preview-panel,
.editor-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(247, 251, 255, 0.9) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.preview-panel h2,
.editor-panel h2 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: 0.01em;
}

.preview-wrap {
  margin-top: 10px;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #edf3fb 0%, #e7eef8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

#preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#preview-canvas.is-dragging {
  cursor: grabbing;
}

.preview-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  gap: 6px;
}

.preview-controls button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(9, 30, 66, 0.14);
}

.preview-controls button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.zoom-group {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 10px rgba(9, 30, 66, 0.14);
}

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

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

.zoom-group button:hover {
  background: #ecf7f6;
}

.preview-controls #reset-view {
  border: 1px solid var(--line);
}

.preview-controls svg {
  width: 18px;
  height: 18px;
}

.preview-controls svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#open-theme-modal svg circle {
  fill: currentColor;
  stroke: none;
}

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

.export-actions button {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f0f7f7 100%);
  border-radius: 12px;
  padding: 8px 12px;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.export-actions button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.mandala-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.cell {
  min-height: 110px;
  background: var(--cell-bg, linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%));
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  outline: none;
}

.cell.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #ccfbf1;
}

.cell.is-center {
  background: var(--cell-center-bg, linear-gradient(180deg, #e8fcf8 0%, #dcf7f4 100%));
}

.cell-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.cell-textview {
  min-height: 58px;
  border: 1px solid #d9e1ea;
  border-radius: 10px;
  padding: 9px 10px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: #ffffff;
}

.cell-textview.is-empty {
  color: #7c8ea5;
}

.cell-input {
  width: 100%;
  min-height: 58px;
  border: 1px solid #d9e1ea;
  border-radius: 10px;
  padding: 8px;
  resize: none;
  font-size: 0.95rem;
  line-height: 1.5;
  font-family: inherit;
  color: var(--text);
  background: #ffffff;
}

.cell-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 122, 117, 0.14);
}

.cell-input[readonly] {
  background: #f3f4f6;
  color: #4b5563;
}

.hint {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.hint-row {
  margin: 10px 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hint-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d3dee9;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #edf3fa 100%);
  color: #42566f;
  padding: 5px 11px;
  font-size: 0.82rem;
  line-height: 1.2;
  white-space: nowrap;
}

.hint-item svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.hint-item svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: #3e576f;
  font-weight: 600;
  background: linear-gradient(180deg, #ffffff 0%, #eef5fc 100%);
  border: 1px solid #d3deea;
  border-radius: 10px;
  padding: 6px 10px;
  width: fit-content;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(9, 20, 40, 0.55);
  z-index: 1000;
}

.modal.is-open {
  display: flex;
}

.modal-panel {
  width: min(1100px, calc(100vw - 32px));
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 14px;
}

.modal-panel h2 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.modal-preview-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #edf3fb;
  padding: 10px;
  height: min(72vh, 860px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-preview-wrap img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
  background: #fff;
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-actions button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f7fd 100%);
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
}

.modal-actions button:hover {
  border-color: var(--accent);
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.theme-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  cursor: pointer;
}

.theme-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 122, 117, 0.14);
}

.theme-card canvas {
  width: 100%;
  aspect-ratio: 1/1;
  display: block;
  border: 1px solid #d2dae4;
  border-radius: 8px;
  background: #eef3f8;
}

.theme-card-title {
  margin-top: 8px;
  font-size: 0.88rem;
  font-weight: 700;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}

.tutorial-spotlight {
  position: fixed;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 9999px rgba(10, 20, 34, 0.66),
    0 12px 28px rgba(10, 20, 34, 0.35);
  transition: none;
}

.tutorial-popover {
  position: fixed;
  width: min(420px, calc(100vw - 24px));
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  border: 1px solid #c9d3df;
  border-radius: 14px;
  box-shadow: 0 18px 36px rgba(9, 24, 48, 0.28);
  padding: 12px;
  pointer-events: auto;
  padding-top: 28px;
}

.tutorial-step {
  margin: 0;
  font-size: 0.78rem;
  color: #5d708a;
  font-weight: 700;
}

.tutorial-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.tutorial-close:hover {
  border-color: var(--accent);
}

.tutorial-popover h2 {
  margin: 4px 0 8px;
  font-size: 1.06rem;
}

.tutorial-popover p {
  margin: 0;
  color: #334a66;
  line-height: 1.45;
}

.tutorial-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tutorial-actions button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #edf4fd 100%);
  color: var(--text);
  padding: 7px 12px;
  cursor: pointer;
}

.tutorial-actions button:hover {
  border-color: var(--accent);
}

#tutorial-next {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-color: #1d4ed8;
  color: #ffffff;
  font-weight: 700;
}

#tutorial-next:hover {
  border-color: #1e40af;
  filter: brightness(1.04);
}

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

  .cell {
    min-height: 110px;
  }
}

@media (min-width: 1500px) {
  .tool-layout {
    max-width: 1760px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 220px minmax(960px, 1280px) 220px;
    gap: 20px;
    align-items: start;
  }

  .tool-layout .mandala-container {
    max-width: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .tool-layout .side-ad {
    display: block;
    position: sticky;
    top: 50vh;
    transform: translateY(-50%);
  }

  .tool-layout .side-ad-box {
    position: static;
    transform: none;
    top: auto;
  }

  .tool-layout .mandala-container .ad-section {
    display: none;
  }
}

.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;
  }
}
