@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300..700&display=swap');

:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --card: #ffffff;
  --muted: #6b6f73;
  --accent: #e8655a;
  --text: #333333;
  --panel-min-width: 300px;
  --switch-bg: #ccc;
  --switch-accent: #f5ca75;
  --trans: 0.3s;
  --canvas-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --track-bg: #ccc;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: 'Comfortaa', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background var(--trans), color var(--trans);
}

.container {
  display: flex;
  /* gap: 16px; */
  padding: 12px;
  height: 100%;
  align-items: stretch;
  justify-content: center;
}

.panel {
  flex: 0 0 20%;
  background: var(--panel);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background var(--trans), color var(--trans);
}

.panel-more-btn {
  display: none;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.18s;
}
.panel-more-btn:active {
  background: #eafbe2;
}
.panel-more-content {
  display: block;
  margin-top: 10px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.topRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.helpBtn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  opacity: 0.8;
  transition: opacity 0.18s, box-shadow 0.18s;
  border-radius: 50%;
}

.helpBtn:hover {
  opacity: 1;
  box-shadow: 0 2px 8px rgba(111, 191, 74, 0.1);
  background: #f3f6f8;
}

.helpBtn svg {
  width: 26px;
  height: 26px;
  stroke: #6b6f73;
  display: block;
}

.helpBtn:hover {
  opacity: 1;
}

.helpBtn svg {
  width: 22px;
  height: 22px;
  stroke: #6b6f73;
}

.brushCol {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  width: 100%;
  cursor: default;
}

.seo-article {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  height: 100%;
  overflow-y: auto;
}

.seo-article h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 14px 0;
  line-height: 1.4;
  color: var(--accent);
  cursor: default;
}

.seo-article h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 10px 0 0 0;
  color: var(--muted);
  cursor: default;
}

.seo-article p,
.seo-article ul,
.seo-article ol {
  font-size: 13px;
  margin-bottom: 10px;
  margin-top: 0;
  cursor: default;
}

.seo-article ul,
.seo-article ol {
  padding-left: 18px;
}

.seo-article li {
  margin-bottom: 4px;
}

.modal-back-help {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  text-align: center;
}

.modal-help {
  background: #fff;
  padding: 22px 20px 18px 20px;
  border-radius: 14px;
  color: var(--text);
  max-width: 680px;
  width: 90%;
  max-height: 70%;
  overflow-y: auto;
  box-sizing: border-box;
  /* box-shadow: 0 18px 64px rgba(0, 0, 0, 0.18),
    0 2px 12px rgba(111, 191, 74, 0.1); */

  box-shadow: 0 6px 32px rgba(111, 191, 74, 0.1), 0 1.5px 8px rgba(0, 0, 0, 0.1);

  animation: modalFadeIn 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  text-align: left;
  display: flex;
  flex-direction: column;
  cursor: default;
}

.modal-help h3 {
  margin: 0 0 18px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.modal-help ul {
  margin: 0;
  padding: 0;
  font-size: 13px;
  color: var(--muted);
  list-style: none;
}

.modal-help li {
  margin-bottom: 2px;
  line-height: 1.5;
}

.logo {
  font-weight: 900;
  font-size: 28px;
  background: linear-gradient(to right, #e8655a 42%, #ffba57 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.themeBtn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.brushBtn,
.gridBtn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  border: 1px solid #eaeaea;
  border-radius: 8px;
}

.brushBtn.active,
.gridBtn.active {
  background: #fff4dd;
}

.controlsWrap {
  flex: 1;
  overflow: visible;
}

.controlsGrid {
  display: grid;
  gap: 6px;
  justify-content: space-between;
  grid-template-columns: repeat(6, 1fr);
}

.controlsSlider {
  display: flex;
  flex-direction: column;
  cursor: default;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brushBtn:hover,
.gridBtn:hover {
  background: #fff4dd;
}

.brushBtn img:hover {
  transform: scale(1.1);
  transition: 0.1s linear !important;
}

.color-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

input[type='color'] {
  width: 40px;
  height: 40px;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: filter 0.18s;
  background: none;
}

.btn {
  padding: 9px;
  border-radius: 10px;
  border: 0;
  color: #fff;
  cursor: pointer;
  transition: background 0.18s;
  width: 100%;
}

.btn.secondary {
  background: #eafbe2;
  color: #6fbf4a;
}

.btn.danger {
  background: #e53935;
  color: #fff;
  width: 100%;
  margin-top: 24px;
  margin-bottom: 0;
  box-shadow: 0 2px 8px rgba(229, 57, 53, 0.08);
  border-radius: 10px;
}

.brushCol .btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  max-width: 40px;
  max-height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background-color: #ffffff;
  border: 1px solid #eaeaea;
  border-radius: 8px;
}

.brushCol .btn:not(:disabled):hover {
  background: #fff4dd;
}

.brushCol .btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.range-row {
  display: flex;
  flex-direction: column;
}

.range-wrap {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  background: transparent;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 6px;
  background: var(--track-bg);
  outline: none;
  margin: 0;
  padding: 0;
  background-image: linear-gradient(
    90deg,
    var(--switch-accent) var(--pct),
    var(--track-bg) var(--pct)
  );
  transition: filter 0.18s, opacity 0.18s, cursor 0.18s;
  cursor: e-resize;
}

input[type='range']::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 6px;
  background: transparent;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--switch-accent);
  margin-top: -5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.range-label {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.range-label span {
  cursor: help;
}

.horiz-row {
  display: grid;
  gap: 2px;
}

.horiz-row .field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggles-row {
  display: grid;
  gap: 6px;
}

.toggle-block {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

.switch {
  position: relative;
  width: 40px;
  height: 20px;
  background: var(--switch-bg);
  border-radius: 40px;
  cursor: pointer;
  transition: background 0.18s;
  flex: 0 0 auto;
}

.switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.18s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch.on {
  background: var(--switch-accent);
}

.switch.on .knob {
  left: 23px;
}

.switch-label {
  font-size: 10px;
  color: var(--muted);
  cursor: help;
}

.canvas-wrap {
  width: 100%;
  max-width: 100%;
  height: 100%;
  aspect-ratio: 1/1;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(180deg, transparent, transparent);
}

canvas {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: transparent;
  display: block;
  box-shadow: var(--canvas-shadow);
  transition: box-shadow var(--trans);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.info {
  flex: 0 0 20%;
  background: var(--card);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: background var(--trans);
}

.hint-block {
  margin-top: auto;
  background: #f7f8fa;
  border-radius: 10px;
  padding: 14px 12px 12px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.hint-title {
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.01em;
}

.hint-arrows {
  display: flex;
  gap: 4px;
}

.hint-arrow-btn {
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.hint-arrow-btn:disabled {
  opacity: 0.2;
  cursor: default;
}

.hint-arrow-btn svg {
  width: 18px;
  height: 18px;
  stroke: #6b6f73;
}

.hint-text {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.saveBlock {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exportBtns {
  display: flex;
  gap: 8px;
}

.tabSave {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 0;
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
  cursor: pointer;
}

.tabSave.active {
  background: var(--accent);
  color: #06202a;
  font-weight: 700;
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  text-align: center;
}

.language-selector {
  position: relative;
  font-family: inherit;
  user-select: none;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: #333;
  transition: 0.2s;
  /* background: #fff1de; */
}

.lang-btn:hover {
  background: #f5f5f5;
}

.flag {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  object-fit: cover;
}

.lang-dropdown {
  position: absolute;
  top: 120%;
  left: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  list-style: none;
  padding: 4px 0;
  margin: 0;
  display: none;
  z-index: 10;
  width: 100%;
}

.lang-dropdown.show {
  display: block;
}

.lang-dropdown li {
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.lang-dropdown li:hover {
  background: #f2f2f2;
}

.modal {
  background: var(--panel);
  padding: 22px 20px 18px 20px;
  border-radius: 14px;
  color: var(--text);
  max-width: 400px;
  width: 90%;
  box-shadow: 0 6px 32px rgba(111, 191, 74, 0.1), 0 1.5px 8px rgba(0, 0, 0, 0.1);
  animation: modalFadeIn 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.modal h3 {
  margin: 0 0 8px 0;
}

.modal p {
  color: var(--muted);
  margin: 0 0 12px;
}

.kv {
  font-size: 13px;
  color: var(--muted);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.undo-redo-label,
.brush-label,
label.control-title {
  font-size: 8px;
  color: var(--muted);
  text-align: left;
}

#colorSvgBtn,
#bgcolor_custom {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid #eaeaea;
  border-radius: 8px;
}

#color,
#bgcolor {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  padding: 0;
  margin: 0;
  border: none;
  pointer-events: auto;
}

#color_preview,
#bgcolor_preview {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #000000;
  z-index: 1;
  position: relative;
}

#clear,
#undo,
#redo {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#confirmClear {
  background: #c33;
  font-weight: 500;
  min-width: 110px;
}

#closeHelp {
  min-width: 100%;
  font-size: 15px;
  padding: 12px 0;
  border-radius: 10px;
}

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

@media (max-width: 1440px) {
  .controlsGrid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1200px) {
  .panel-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .panel-more-content {
    display: none;
  }

  .panel-more-content.open {
    display: block;
    animation: fadeIn 0.3s;
  }

  .container {
    flex-direction: column;
    gap: 12px;
    height: calc(100vh - 24px);
    overflow: auto;
    justify-content: space-between;
  }

  .panel {
    width: 100%;
    min-width: unset;
    flex: 0 0 auto;
  }

  .info {
    width: 100%;
    min-width: unset;
  }
  .seo-article h2 {
    text-align: center;
  }
  .controlsGrid {
    grid-template-columns: repeat(12, 1fr);
  }
}

@media (max-width: 1024px) {
  .controlsGrid {
    grid-template-columns: repeat(12, 1fr);
  }

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

  .horiz-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .controlsGrid {
    grid-template-columns: repeat(6, 1fr);
  }

  .toggles-row {
    display: grid;
    flex-wrap: wrap;
    flex-direction: column;
    grid-template-columns: repeat(1, 1fr);
  }

  .horiz-row {
    grid-template-columns: repeat(1, 1fr);
    gap: 4px;
  }
}
