* { box-sizing: border-box; }

#main-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}

.btg-input-section  { grid-column: 1 / 2; grid-row: 1; }
.btg-mode-section   { grid-column: 2 / 3; grid-row: 1; }
.btg-output-section { grid-column: 1 / -1; grid-row: 2; }

.btg-input-section,
.btg-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;
}

.btg-output-section { background: transparent; border: none; padding: 0; }

/* ══════════════════
   SECTION TITLE
══════════════════ */
label.btg-section-title,
.btg-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.btg-section-title svg,
.btg-section-title svg { flex-shrink: 0; stroke: #6366f1; }

/* ══════════════════
   INPUT
══════════════════ */
.btg-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.btg-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;
}

.btg-textarea:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.btg-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;
}

.btg-clear-btn:hover { background: #e2e8f0; color: #ef4444; }

/* ══════════════════
   STYLE BUTTONS (right panel)
══════════════════ */
.btg-mode-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
  max-height: 420px;
  padding-right: 2px;
}

.btg-mode-grid::-webkit-scrollbar { width: 4px; }
.btg-mode-grid::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 2px; }
.btg-mode-grid::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 2px; }

.btg-mode-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
  flex-shrink: 0;
}

.btg-mode-btn:hover { border-color: #a5b4fc; background: #ede9fe; }

.btg-mode-btn.active {
  border-color: #6366f1;
  background: linear-gradient(135deg, #ede9fe, #e0e7ff);
  box-shadow: 0 2px 10px rgba(99,102,241,0.12);
}

.btg-mode-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  min-width: 100px;
  flex-shrink: 0;
}

.btg-mode-btn.active .btg-mode-label { color: #4338ca; }

.btg-mode-preview {
  font-size: 0.95rem;
  color: #1e293b;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════════════════
   OUTPUT BOX
══════════════════════════════ */
.btg-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);
}

.btg-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;
}

.btg-output-label svg { stroke: #6366f1; }

.btg-output-area {
  background: #ffffff;
  border: 1.5px solid #e0e7ff;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 1.3rem;
  color: #1e293b;
  word-break: break-word;
  min-height: 64px;
  display: flex;
  align-items: center;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.btg-placeholder {
  color: #cbd5e1;
  font-size: 0.92rem;
  font-weight: 400;
}

.btg-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;
}

.btg-copy-btn:hover { opacity: 0.88; transform: scale(1.02); }
.btg-copy-btn.copied { background: linear-gradient(135deg, #22c55e, #16a34a); }

/* ══════════════════
   ALL STYLES GRID
══════════════════ */
.btg-all-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.btg-card {
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.btg-card:hover { border-color: #a5b4fc; background: #ede9fe; }

.btg-card.active {
  border-color: #6366f1;
  background: linear-gradient(135deg, #ede9fe, #e0e7ff);
  box-shadow: 0 2px 10px rgba(99,102,241,0.12);
}

.btg-card-name {
  font-size: 0.70rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.btg-card.active .btg-card-name { color: #6366f1; }

.btg-card-preview {
  font-size: 1.1rem;
  color: #1e293b;
  word-break: break-word;
  line-height: 1.5;
}

.btg-card-copy {
  margin-top: 6px;
  font-size: 0.70rem;
  font-weight: 600;
  color: #6366f1;
  opacity: 0;
  transition: opacity 0.15s;
}

.btg-card:hover .btg-card-copy,
.btg-card.active .btg-card-copy { opacity: 1; }

/* ══════════════════
   DARK MODE
══════════════════ */
body.dark-mode .btg-input-section,
body.dark-mode .btg-mode-section {
  background: #0f172a;
  border-color: #1e293b;
}

body.dark-mode label.btg-section-title,
body.dark-mode .btg-section-title { color: #e2e8f0; }

body.dark-mode label.btg-section-title svg,
body.dark-mode .btg-section-title svg { stroke: #a5b4fc; }

body.dark-mode .btg-textarea {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .btg-textarea:focus { border-color: #818cf8; }

body.dark-mode .btg-clear-btn {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

body.dark-mode .btg-clear-btn:hover { background: #334155; color: #ef4444; }

body.dark-mode .btg-mode-grid::-webkit-scrollbar-track { background: #1e293b; }
body.dark-mode .btg-mode-grid::-webkit-scrollbar-thumb { background: #312e81; }

body.dark-mode .btg-mode-btn {
  background: #1e1b4b;
  border-color: #312e81;
}

body.dark-mode .btg-mode-btn:hover { background: #2e1b6b; border-color: #6366f1; }

body.dark-mode .btg-mode-btn.active {
  background: linear-gradient(135deg, #1e1b4b, #2e1b6b);
  border-color: #6366f1;
}

body.dark-mode .btg-mode-label { color: #94a3b8; }
body.dark-mode .btg-mode-btn.active .btg-mode-label { color: #a5b4fc; }
body.dark-mode .btg-mode-preview { color: #e2e8f0; }

body.dark-mode .btg-output-box {
  background: #1e1b4b;
  border-color: #312e81;
  box-shadow: 0 4px 24px rgba(99,102,241,0.15);
}

body.dark-mode .btg-output-label { color: #a5b4fc; }
body.dark-mode .btg-output-label svg { stroke: #a5b4fc; }

body.dark-mode .btg-output-area {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .btg-card {
  background: #1e1b4b;
  border-color: #312e81;
}

body.dark-mode .btg-card:hover { background: #2e1b6b; border-color: #6366f1; }

body.dark-mode .btg-card.active {
  background: linear-gradient(135deg, #1e1b4b, #2e1b6b);
  border-color: #6366f1;
}

body.dark-mode .btg-card-name { color: #475569; }
body.dark-mode .btg-card.active .btg-card-name { color: #a5b4fc; }
body.dark-mode .btg-card-preview { color: #e2e8f0; }
body.dark-mode .btg-card-copy { color: #a5b4fc; }

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 700px) {
  #main-section { grid-template-columns: 1fr; }
  .btg-input-section  { grid-column: 1 / -1; grid-row: 1; }
  .btg-mode-section   { grid-column: 1 / -1; grid-row: 2; }
  .btg-output-section { grid-column: 1 / -1; grid-row: 3; }
  .btg-textarea { min-height: 160px; }
  .btg-output-box { max-width: 100%; }
  .btg-all-grid { grid-template-columns: 1fr 1fr; }
  .btg-mode-grid { max-height: 300px; }
}