* { box-sizing: border-box; }

/* ══════════════════════════════
   MAIN SECTION LAYOUT
   Top Row : Input | Options (50/50)
   Bottom  : Output (full width, centered)
══════════════════════════════ */
#main-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}

.dlr-input-section  { grid-column: 1 / 2; grid-row: 1; }
.dlr-mode-section   { grid-column: 2 / 3; grid-row: 1; }
.dlr-output-section { grid-column: 1 / -1; grid-row: 2; }

/* ── Section base ── */
.dlr-input-section,
.dlr-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;
}

.dlr-output-section {
  background: transparent;
  border: none;
  padding: 0;
}

/* ══════════════════
   SECTION TITLE
══════════════════ */
label.dlr-section-title,
.dlr-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.dlr-section-title svg,
.dlr-section-title svg {
  flex-shrink: 0;
  stroke: #6366f1;
}

/* ══════════════════
   INPUT
══════════════════ */
.dlr-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dlr-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;
}

.dlr-textarea:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.dlr-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;
}

.dlr-clear-btn:hover {
  background: #e2e8f0;
  color: #ef4444;
}

.dlr-input-stats {
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  padding-left: 2px;
}

/* ══════════════════
   MODE BUTTONS (multi-select)
══════════════════ */
.dlr-mode-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.dlr-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;
}

.dlr-mode-btn:hover {
  border-color: #a5b4fc;
  background: #ede9fe;
}

.dlr-mode-btn.active {
  border-color: #6366f1;
  background: linear-gradient(135deg, #ede9fe, #e0e7ff);
  box-shadow: 0 2px 10px rgba(99,102,241,0.12);
}

.dlr-mode-icon { font-size: 1rem; flex-shrink: 0; width: 22px; text-align: center; }

.dlr-mode-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  flex: 1;
}

.dlr-mode-btn.active .dlr-mode-name { color: #4338ca; }

.dlr-mode-ex {
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: monospace;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.dlr-mode-btn.active .dlr-mode-ex {
  background: #ddd6fe;
  color: #6d28d9;
}

/* ══════════════════════════════
   OUTPUT BOX
══════════════════════════════ */
.dlr-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);
}

.dlr-output-label {
  font-size: 0.80rem;
  font-weight: 700;
  color: #6366f1;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dlr-output-stats {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: #22c55e;
  background: #dcfce7;
  padding: 2px 10px;
  border-radius: 20px;
  text-transform: none;
  letter-spacing: 0;
}

.dlr-output-area {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  padding: 12px 14px;
  border: 1.5px solid #e0e7ff;
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
  color: #1e293b;
  background: #ffffff;
  line-height: 1.7;
  cursor: default;
}

/* ══════════════════
   COPY BUTTON
══════════════════ */
.dlr-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;
}

.dlr-copy-btn:hover { opacity: 0.88; transform: scale(1.02); }
.dlr-copy-btn.copied { background: linear-gradient(135deg, #22c55e, #16a34a); }

/* ══════════════════
   DARK MODE
══════════════════ */
body.dark-mode .dlr-input-section,
body.dark-mode .dlr-mode-section {
  background: #0f172a;
  border-color: #1e293b;
}

body.dark-mode label.dlr-section-title,
body.dark-mode .dlr-section-title { color: #e2e8f0; }

body.dark-mode label.dlr-section-title svg,
body.dark-mode .dlr-section-title svg { stroke: #a5b4fc; }

body.dark-mode .dlr-textarea {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .dlr-textarea:focus { border-color: #818cf8; }

body.dark-mode .dlr-clear-btn {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

body.dark-mode .dlr-clear-btn:hover { background: #334155; color: #ef4444; }

body.dark-mode .dlr-input-stats { color: #475569; }

body.dark-mode .dlr-mode-btn {
  background: #1e1b4b;
  border-color: #312e81;
}

body.dark-mode .dlr-mode-btn:hover { background: #2e1b6b; border-color: #6366f1; }

body.dark-mode .dlr-mode-btn.active {
  background: linear-gradient(135deg, #1e1b4b, #2e1b6b);
  border-color: #6366f1;
}

body.dark-mode .dlr-mode-name { color: #e2e8f0; }
body.dark-mode .dlr-mode-btn.active .dlr-mode-name { color: #a5b4fc; }

body.dark-mode .dlr-mode-ex { background: #0f172a; color: #64748b; }
body.dark-mode .dlr-mode-btn.active .dlr-mode-ex { background: #312e81; color: #a5b4fc; }

body.dark-mode .dlr-output-box {
  background: #1e1b4b;
  border-color: #312e81;
  box-shadow: 0 4px 24px rgba(99,102,241,0.15);
}

body.dark-mode .dlr-output-label { color: #a5b4fc; }

body.dark-mode .dlr-output-stats {
  background: #14532d;
  color: #86efac;
}

body.dark-mode .dlr-output-area {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 700px) {
  #main-section { grid-template-columns: 1fr; }

  .dlr-input-section  { grid-column: 1 / -1; grid-row: 1; }
  .dlr-mode-section   { grid-column: 1 / -1; grid-row: 2; }
  .dlr-output-section { grid-column: 1 / -1; grid-row: 3; }

  .dlr-textarea { min-height: 160px; }
  .dlr-output-area { min-height: 120px; }
  .dlr-output-box { max-width: 100%; }
}