* { box-sizing: border-box; }

/* ══════════════════════════════
   MAIN SECTION LAYOUT
══════════════════════════════ */
#main-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}

.tsg-input-section  { grid-column: 1 / 2; grid-row: 1; }
.tsg-mode-section   { grid-column: 2 / 3; grid-row: 1; }
.tsg-output-section { grid-column: 1 / -1; grid-row: 2; }

/* ── Section base ── */
.tsg-input-section,
.tsg-mode-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;
}

.tsg-output-section { background: transparent; border: none; padding: 0; }

/* ══════════════════
   SECTION TITLE
══════════════════ */
label.tsg-section-title,
.tsg-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

label.tsg-section-title svg,
.tsg-section-title svg { flex-shrink: 0; stroke: #6366f1; }

/* ══════════════════
   INPUT
══════════════════ */
.tsg-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tsg-textarea {
  flex: 1;
  width: 100%;
  min-height: 200px;
  resize: none;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
  color: #1e293b;
  background: #ffffff;
  line-height: 1.7;
  transition: border-color 0.18s;
}

.tsg-textarea:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.tsg-clear-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 4px 12px;
  font-size: 0.80rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background 0.18s;
}

.tsg-clear-btn:hover { background: #e2e8f0; color: #ef4444; }

/* ══════════════════
   OPTIONS
══════════════════ */
.tsg-mode-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

/* Separator row */
.tsg-option-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tsg-option-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tsg-sep-group {
  display: flex;
  gap: 8px;
}

.tsg-sep-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.tsg-sep-btn:hover { border-color: #a5b4fc; background: #ede9fe; }

.tsg-sep-btn.active {
  border-color: #6366f1;
  background: linear-gradient(135deg, #ede9fe, #e0e7ff);
  box-shadow: 0 2px 8px rgba(99,102,241,0.12);
}

.tsg-sep-preview {
  font-size: 0.78rem;
  font-family: monospace;
  font-weight: 700;
  color: #1e293b;
}

.tsg-sep-btn.active .tsg-sep-preview { color: #4338ca; }

.tsg-sep-name {
  font-size: 0.70rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tsg-sep-btn.active .tsg-sep-name { color: #6366f1; }

/* Toggle mode buttons */
.tsg-mode-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.18s;
  text-align: left;
  width: 100%;
  flex: 1;
}

.tsg-mode-btn:hover { border-color: #a5b4fc; background: #ede9fe; }

.tsg-mode-btn.active {
  border-color: #6366f1;
  background: linear-gradient(135deg, #ede9fe, #e0e7ff);
  box-shadow: 0 2px 10px rgba(99,102,241,0.12);
}

.tsg-mode-icon { font-size: 1rem; flex-shrink: 0; width: 22px; text-align: center; }
.tsg-mode-name { font-size: 0.88rem; font-weight: 700; color: #1e293b; flex: 1; }
.tsg-mode-btn.active .tsg-mode-name { color: #4338ca; }

.tsg-mode-ex {
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: monospace;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.tsg-mode-btn.active .tsg-mode-ex { background: #ddd6fe; color: #6d28d9; }

/* ══════════════════════════════
   OUTPUT BOX
══════════════════════════════ */
.tsg-output-box {
  background: linear-gradient(135deg, #f8f9ff, #ede9fe33);
  border: 2px solid #c7d2fe;
  border-radius: 14px;
  padding: 20px 24px;
  max-width: 700px;
  margin: 0 auto;
  box-shadow: 0 4px 24px rgba(99,102,241,0.10);
}

.tsg-output-label {
  font-size: 0.80rem;
  font-weight: 700;
  color: #6366f1;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tsg-output-label svg { stroke: #6366f1; }

/* Slug display */
.tsg-slug-display {
  background: #ffffff;
  border: 1.5px solid #e0e7ff;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 1.05rem;
  font-family: monospace;
  font-weight: 700;
  color: #4338ca;
  word-break: break-all;
  min-height: 52px;
  display: flex;
  align-items: center;
  letter-spacing: 0.01em;
}

.tsg-slug-placeholder {
  color: #cbd5e1;
  font-weight: 400;
  font-family: inherit;
  font-size: 0.92rem;
}

/* URL preview */
.tsg-slug-preview {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #94a3b8;
  font-family: monospace;
  padding-left: 2px;
  word-break: break-all;
  min-height: 18px;
}

.tsg-slug-preview span { color: #6366f1; }

/* ══════════════════
   COPY BUTTON
══════════════════ */
.tsg-copy-btn {
  margin-top: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 11px 0;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.18s, transform 0.15s;
  letter-spacing: 0.03em;
}

.tsg-copy-btn:hover { opacity: 0.88; transform: scale(1.02); }
.tsg-copy-btn.copied { background: linear-gradient(135deg, #22c55e, #16a34a); }

/* ══════════════════
   DARK MODE
══════════════════ */
body.dark-mode .tsg-input-section,
body.dark-mode .tsg-mode-section {
  background: #0f172a;
  border-color: #1e293b;
}

body.dark-mode label.tsg-section-title,
body.dark-mode .tsg-section-title { color: #e2e8f0; }

body.dark-mode label.tsg-section-title svg,
body.dark-mode .tsg-section-title svg { stroke: #a5b4fc; }

body.dark-mode .tsg-textarea {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .tsg-textarea:focus { border-color: #818cf8; }

body.dark-mode .tsg-clear-btn {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

body.dark-mode .tsg-clear-btn:hover { background: #334155; color: #ef4444; }

body.dark-mode .tsg-option-label { color: #475569; }

body.dark-mode .tsg-sep-btn {
  background: #1e1b4b;
  border-color: #312e81;
}

body.dark-mode .tsg-sep-btn:hover { background: #2e1b6b; border-color: #6366f1; }

body.dark-mode .tsg-sep-btn.active {
  background: linear-gradient(135deg, #1e1b4b, #2e1b6b);
  border-color: #6366f1;
}

body.dark-mode .tsg-sep-preview { color: #e2e8f0; }
body.dark-mode .tsg-sep-btn.active .tsg-sep-preview { color: #a5b4fc; }

body.dark-mode .tsg-mode-btn {
  background: #1e1b4b;
  border-color: #312e81;
}

body.dark-mode .tsg-mode-btn:hover { background: #2e1b6b; border-color: #6366f1; }

body.dark-mode .tsg-mode-btn.active {
  background: linear-gradient(135deg, #1e1b4b, #2e1b6b);
  border-color: #6366f1;
}

body.dark-mode .tsg-mode-name { color: #e2e8f0; }
body.dark-mode .tsg-mode-btn.active .tsg-mode-name { color: #a5b4fc; }
body.dark-mode .tsg-mode-ex { background: #0f172a; color: #64748b; }
body.dark-mode .tsg-mode-btn.active .tsg-mode-ex { background: #312e81; color: #a5b4fc; }

body.dark-mode .tsg-output-box {
  background: #1e1b4b;
  border-color: #312e81;
  box-shadow: 0 4px 24px rgba(99,102,241,0.15);
}

body.dark-mode .tsg-output-label { color: #a5b4fc; }
body.dark-mode .tsg-output-label svg { stroke: #a5b4fc; }

body.dark-mode .tsg-slug-display {
  background: #0f172a;
  border-color: #334155;
  color: #a5b4fc;
}

body.dark-mode .tsg-slug-preview { color: #475569; }
body.dark-mode .tsg-slug-preview span { color: #a5b4fc; }

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 700px) {
  #main-section { grid-template-columns: 1fr; }

  .tsg-input-section  { grid-column: 1 / -1; grid-row: 1; }
  .tsg-mode-section   { grid-column: 1 / -1; grid-row: 2; }
  .tsg-output-section { grid-column: 1 / -1; grid-row: 3; }

  .tsg-textarea { min-height: 160px; }
  .tsg-output-box { max-width: 100%; }
}