* { box-sizing: border-box; }

/* ══════════════════
   LAYOUT
══════════════════ */
#main-section {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}

.lig-control-section,
.lig-output-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(99,102,241,0.07);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ══════════════════
   SECTION TITLE
══════════════════ */
label.lig-section-title,
.lig-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 18px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

label.lig-section-title svg,
.lig-section-title svg { flex-shrink: 0; stroke: #6366f1; }

/* ══════════════════
   FIELD GROUPS
══════════════════ */
.lig-field-group {
  margin-bottom: 18px;
}

.lig-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

/* ── Type buttons ── */
.lig-type-grid,
.lig-format-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.lig-type-btn,
.lig-format-btn {
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.lig-type-btn:hover,
.lig-format-btn:hover { border-color: #a5b4fc; background: #ede9fe; color: #4338ca; }

.lig-type-btn.active,
.lig-format-btn.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

/* ── Count ── */
.lig-count-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
  transition: border-color 0.18s;
}

.lig-count-wrap:focus-within { border-color: #818cf8; }

.lig-count-btn {
  width: 42px;
  height: 42px;
  background: #f8f9ff;
  border: none;
  font-size: 1.2rem;
  color: #6366f1;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.lig-count-btn:hover { background: #e0e7ff; }

.lig-count-input {
  flex: 1;
  border: none;
  outline: none;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  background: transparent;
  font-family: inherit;
  padding: 0;
  -moz-appearance: textfield;
}

.lig-count-input::-webkit-outer-spin-button,
.lig-count-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Checkboxes ── */
.lig-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.lig-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.87rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.lig-checkbox-label input[type="checkbox"] { display: none; }

.lig-checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid #c7d2fe;
  border-radius: 5px;
  background: #f8f9ff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  position: relative;
}

.lig-checkbox-label input:checked + .lig-checkmark {
  background: #6366f1;
  border-color: #6366f1;
}

.lig-checkbox-label input:checked + .lig-checkmark::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
  display: block;
}

/* ── Generate Button ── */
.lig-generate-btn {
  width: 100%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 13px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.18s, transform 0.15s;
  margin-top: auto;
  letter-spacing: 0.02em;
}

.lig-generate-btn:hover { opacity: 0.88; transform: scale(1.02); }
.lig-generate-btn:active { transform: scale(0.98); }

/* ══════════════════
   OUTPUT SECTION
══════════════════ */
.lig-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.lig-output-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lig-stat {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.lig-action-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.80rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.18s;
  white-space: nowrap;
}

.lig-action-btn:hover { opacity: 0.85; }
.lig-action-btn.copied { background: linear-gradient(135deg, #22c55e, #16a34a); }

.lig-action-btn.secondary {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.lig-action-btn.secondary:hover { background: #e2e8f0; }

.lig-output-area {
  flex: 1;
  width: 100%;
  min-height: 380px;
  resize: none;
  padding: 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.90rem;
  font-family: inherit;
  color: #1e293b;
  background: #f8faff;
  line-height: 1.8;
  outline: none;
  transition: border-color 0.18s;
}

.lig-output-area:focus { border-color: #818cf8; }

/* ══════════════════
   QUICK GENERATE
══════════════════ */
.lig-quick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lig-quick-btn {
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #4338ca;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.lig-quick-btn:hover {
  background: #ede9fe;
  border-color: #a5b4fc;
  box-shadow: 0 2px 8px rgba(99,102,241,0.12);
  transform: translateY(-1px);
}

/* ══════════════════
   DARK MODE
══════════════════ */
body.dark-mode .lig-control-section,
body.dark-mode .lig-output-section {
  background: #0f172a;
  border-color: #1e293b;
}

body.dark-mode label.lig-section-title,
body.dark-mode .lig-section-title { color: #e2e8f0; }

body.dark-mode label.lig-section-title svg,
body.dark-mode .lig-section-title svg { stroke: #a5b4fc; }

body.dark-mode .lig-label { color: #475569; }

body.dark-mode .lig-type-btn,
body.dark-mode .lig-format-btn {
  background: #1e1b4b;
  border-color: #312e81;
  color: #94a3b8;
}

body.dark-mode .lig-type-btn:hover,
body.dark-mode .lig-format-btn:hover { background: #2e1b6b; color: #a5b4fc; }

body.dark-mode .lig-type-btn.active,
body.dark-mode .lig-format-btn.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}

body.dark-mode .lig-count-wrap {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .lig-count-btn { background: #1e1b4b; color: #a5b4fc; }
body.dark-mode .lig-count-btn:hover { background: #312e81; }
body.dark-mode .lig-count-input { color: #e2e8f0; }

body.dark-mode .lig-checkbox-label { color: #94a3b8; }
body.dark-mode .lig-checkmark { background: #1e1b4b; border-color: #312e81; }

body.dark-mode .lig-output-area {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .lig-stat { color: #475569; }

body.dark-mode .lig-action-btn.secondary {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

body.dark-mode .lig-action-btn.secondary:hover { background: #334155; }

body.dark-mode .lig-quick-btn {
  background: #1e1b4b;
  border-color: #312e81;
  color: #a5b4fc;
}

body.dark-mode .lig-quick-btn:hover { background: #2e1b6b; border-color: #6366f1; }

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 768px) {
  #main-section { grid-template-columns: 1fr; }
  .lig-output-area { min-height: 260px; }
}