﻿.cwg-plugin {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #444444;
  --card: #ffffff;
  --line: #8f8f8f;
  --accent: #1c7c78;
  --cell: 2rem;
  color: var(--ink);
  font-family: "Nunito", sans-serif;
}

.cwg-plugin,
.cwg-plugin * {
  box-sizing: border-box;
}

.cwg-plugin .bg-noise {
  display: none;
}

.cwg-plugin .layout {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: minmax(300px, 390px) 1fr;
  gap: 1rem;
}

.cwg-plugin .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
}

.cwg-plugin .panel-input {
  padding: 1.25rem;
  position: sticky;
  top: 1rem;
  height: fit-content;
}

.cwg-plugin .panel-output {
  padding: 1.25rem;
}

.cwg-plugin h1,
.cwg-plugin h2,
.cwg-plugin h3,
.cwg-plugin h4 {
  margin: 0;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
}

.cwg-plugin h1,
.cwg-plugin h2 {
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  line-height: 1.1;
}

.cwg-plugin .entries {
  margin-top: 1rem;
  display: grid;
  gap: 0.5rem;
  max-height: 56vh;
  overflow: auto;
  padding-right: 0.25rem;
}

.cwg-plugin .entry-row {
  display: grid;
  grid-template-columns: 1fr 120px 36px;
  gap: 0.4rem;
}

.cwg-plugin .input {
  width: 100%;
  padding: 0.58rem 0.62rem;
  border-radius: 10px;
  border: 1px solid #000;
  font-size: 0.92rem;
  font-family: "Nunito", sans-serif;
  background: #fff;
}

.cwg-plugin .input:focus {
  outline: 2px solid rgba(0, 0, 0, 0.2);
  border-color: #000;
}

.cwg-plugin .btn,
.cwg-plugin .icon-btn {
  border: 1px solid #000;
  border-radius: 12px;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
  cursor: pointer;
}

.cwg-plugin .btn {
  padding: 0.56rem 0.9rem;
}

.cwg-plugin .btn-primary {
  background: #1c7c78;
  border-color: #1c7c78;
  color: #fff;
}

.cwg-plugin .btn-accent-outline {
  background: #fff;
  border-color: #1c7c78;
  color: #1c7c78;
}

.cwg-plugin .btn:hover,
.cwg-plugin .icon-btn:hover {
  transform: translateY(-1px);
}

.cwg-plugin .icon-btn {
  background: #fff;
  font-size: 1.25rem;
  line-height: 1;
}

.cwg-plugin .form-actions {
  margin-top: 0.85rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cwg-plugin .hint,
.cwg-plugin .status {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: pre-line;
}

.cwg-plugin .status.error {
  color: #9b1111;
}

.cwg-plugin .output-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.7rem;
}

.cwg-plugin .print-controls {
  display: flex;
  gap: 0.45rem;
}

.cwg-plugin .sheet {
  padding: 1rem;
  border-radius: 0;
  border: 1px solid var(--line);
  background: #fff;
}

.cwg-plugin .answers-sheet {
  margin-top: 0.45rem;
}

.cwg-plugin .section-title {
  margin: 0.8rem 0 0;
}

.cwg-plugin .print-title,
.cwg-plugin .print-branding {
  display: none;
}

.cwg-plugin .grid {
  --size: var(--cell);
  display: block;
  background: #fff;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  margin-bottom: 0.9rem;
}

.cwg-plugin .grid-svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.cwg-plugin .clues-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 1rem;
}

.cwg-plugin .clues {
  margin: 0.5rem 0 0;
  padding-left: 1.4rem;
  font-size: 0.92rem;
  line-height: 1.4;
}

.cwg-plugin .clues li {
  margin-bottom: 0.35rem;
}

@media (max-width: 980px) {
  .cwg-plugin .layout {
    grid-template-columns: 1fr;
  }

  .cwg-plugin .panel-input {
    position: static;
  }

  .cwg-plugin .entry-row {
    grid-template-columns: 1fr 110px 34px;
  }

  .cwg-plugin .output-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media print {
  .cwg-plugin {
    background: #fff;
  }

  body.cwg-print-mode .cwg-plugin .bg-noise,
  body.cwg-print-mode .cwg-plugin .no-print,
  body.cwg-print-mode .cwg-plugin .panel-input {
    display: none !important;
  }

  body.cwg-print-mode .cwg-plugin .layout {
    display: block;
    max-width: 100%;
    padding: 0;
  }

  body.cwg-print-mode .cwg-plugin .panel-output {
    border: none;
    box-shadow: none;
    padding: 0;
  }

  body.cwg-print-mode .cwg-plugin .output-head,
  body.cwg-print-mode .cwg-plugin .section-title,
  body.cwg-print-mode .cwg-plugin .clues-wrap {
    display: none !important;
  }

  body.cwg-print-mode.cwg-print-puzzle .cwg-plugin [data-cwg="puzzle-sheet"] .clues-wrap {
    display: grid !important;
    margin-top: 8mm;
    page-break-inside: avoid;
  }

  body.cwg-print-mode.cwg-print-answers .cwg-plugin [data-cwg="answers-sheet"] .clues-wrap {
    display: grid !important;
    margin-top: 8mm;
    page-break-inside: avoid;
  }

  body.cwg-print-mode .cwg-plugin .print-branding {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin: 0 0 0.75rem;
  }

  body.cwg-print-mode .cwg-plugin .print-branding-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: #000;
    font-size: 0.78rem;
    line-height: 1.2;
  }

  body.cwg-print-mode .cwg-plugin .print-branding-item img {
    height: 32px;
    width: auto;
    object-fit: contain;
  }

  body.cwg-print-mode .cwg-plugin .print-branding-right {
    align-items: flex-end;
    text-align: right;
  }

  body.cwg-print-mode .cwg-plugin .print-branding-right a,
  body.cwg-print-mode .cwg-plugin .print-branding-item span {
    display: none !important;
  }

  body.cwg-print-mode .cwg-plugin .print-title {
    display: none !important;
  }

  body.cwg-print-mode .cwg-plugin .sheet {
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    break-inside: avoid;
  }

  body.cwg-print-mode.cwg-print-puzzle .cwg-plugin [data-cwg="answers-sheet"] {
    display: none;
  }

  body.cwg-print-mode.cwg-print-answers .cwg-plugin [data-cwg="puzzle-sheet"] {
    display: none;
  }

  body.cwg-print-mode .cwg-plugin [data-cwg="grid"],
  body.cwg-print-mode .cwg-plugin [data-cwg="answer-grid"] {
    margin-top: 12mm;
    margin-left: auto;
    margin-right: auto;
  }
}
