* { box-sizing: border-box; }

/* ══════════════════
   LAYOUT
══════════════════ */
#main-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.ta-right-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ta-examples-outer { display: none; }
.ta-examples-inner { display: block; }

.ta-input-section,
.ta-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;
}

/* ══════════════════
   SECTION TITLE
══════════════════ */
label.ta-section-title,
.ta-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

label.ta-section-title svg,
.ta-section-title svg { stroke: #6366f1; flex-shrink: 0; }

/* ══════════════════
   MODE TOGGLE
══════════════════ */
.ta-mode-toggle {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 14px;
}

.ta-mode-btn {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: #64748b;
  transition: all 0.18s;
}

.ta-mode-btn.active {
  background: #ffffff;
  color: #4338ca;
  box-shadow: 0 1px 4px rgba(99,102,241,0.15);
}

/* ══════════════════
   INPUT
══════════════════ */
.ta-input-wrap {
  position: relative;
  margin-bottom: 14px;
}

.ta-textarea {
  width: 100%;
  resize: none;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.92rem;
  outline: none;
  font-family: 'Courier New', monospace;
  color: #1e293b;
  background: #ffffff;
  line-height: 1.7;
  transition: border-color 0.18s;
  min-height: 120px;
}

.ta-textarea:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.ta-clear-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s;
}

.ta-clear-btn:hover { background: #e2e8f0; color: #ef4444; }

/* ══════════════════
   FIELD GROUP
══════════════════ */
.ta-field-group { margin-bottom: 14px; }

.ta-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

/* Format & Sep buttons */
.ta-format-options,
.ta-sep-options {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.ta-fmt-btn,
.ta-sep-btn {
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.80rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}

.ta-fmt-btn:hover,
.ta-sep-btn:hover { background: #ede9fe; border-color: #a5b4fc; color: #4338ca; }

.ta-fmt-btn.active,
.ta-sep-btn.active { background: #ede9fe; border-color: #6366f1; color: #4338ca; }

/* ══════════════════
   CONVERT BTN
══════════════════ */
.ta-convert-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;
}

.ta-convert-btn:hover { opacity: 0.88; transform: scale(1.02); }
.ta-convert-btn:active { transform: scale(0.98); }

/* ══════════════════
   OUTPUT
══════════════════ */
.ta-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ta-copy-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 18px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.18s;
}

.ta-copy-btn:hover { opacity: 0.85; }
.ta-copy-btn.copied { background: linear-gradient(135deg, #22c55e, #16a34a); }

.ta-output-textarea {
  width: 100%;
  min-height: 130px;
  resize: none;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.90rem;
  font-family: 'Courier New', monospace;
  color: #1e293b;
  background: #f8faff;
  outline: none;
  line-height: 1.8;
  font-weight: 600;
  word-break: break-all;
  margin-bottom: 14px;
}

/* Stats */
.ta-stats-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.ta-stat-chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #475569;
}

/* ══════════════════
   CHARACTER MAP TABLE
══════════════════ */
.ta-table-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.ta-char-table {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.ta-char-table::-webkit-scrollbar { width: 4px; }
.ta-char-table::-webkit-scrollbar-track { background: #f1f5f9; }
.ta-char-table::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 2px; }

.ta-char-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 48px;
}

.ta-char-cell .ta-cc-char {
  font-size: 1rem;
  font-weight: 700;
  color: #6366f1;
  font-family: 'Courier New', monospace;
  line-height: 1.2;
}

.ta-char-cell .ta-cc-code {
  font-size: 0.70rem;
  font-weight: 600;
  color: #94a3b8;
  font-family: 'Courier New', monospace;
  margin-top: 3px;
}

/* ══════════════════
   EXAMPLES
══════════════════ */
.ta-examples-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ta-example-btn {
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #4338ca;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Courier New', monospace;
}

.ta-example-btn:hover {
  background: #ede9fe;
  border-color: #a5b4fc;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(99,102,241,0.12);
}

/* ══════════════════
   DARK MODE
══════════════════ */
body.dark-mode .ta-input-section,
body.dark-mode .ta-output-section { background: #0f172a; border-color: #1e293b; }

body.dark-mode label.ta-section-title,
body.dark-mode .ta-section-title { color: #e2e8f0; }

body.dark-mode label.ta-section-title svg,
body.dark-mode .ta-section-title svg { stroke: #a5b4fc; }

body.dark-mode .ta-mode-toggle { background: #1e293b; }
body.dark-mode .ta-mode-btn { color: #475569; }
body.dark-mode .ta-mode-btn.active { background: #1e1b4b; color: #a5b4fc; }

body.dark-mode .ta-textarea {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .ta-textarea:focus { border-color: #818cf8; }

body.dark-mode .ta-clear-btn {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

body.dark-mode .ta-label { color: #475569; }

body.dark-mode .ta-fmt-btn,
body.dark-mode .ta-sep-btn { background: #1e1b4b; border-color: #312e81; color: #94a3b8; }

body.dark-mode .ta-fmt-btn.active,
body.dark-mode .ta-sep-btn.active { background: #312e81; color: #a5b4fc; border-color: #6366f1; }

body.dark-mode .ta-fmt-btn:hover,
body.dark-mode .ta-sep-btn:hover { background: #2e1b6b; color: #a5b4fc; }

body.dark-mode .ta-output-textarea { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark-mode .ta-stat-chip { background: #1e293b; border-color: #334155; color: #94a3b8; }

body.dark-mode .ta-char-cell { background: #1e1b4b; border-color: #312e81; }
body.dark-mode .ta-char-cell .ta-cc-char { color: #a5b4fc; }
body.dark-mode .ta-char-cell .ta-cc-code { color: #475569; }
body.dark-mode .ta-char-table::-webkit-scrollbar-track { background: #1e293b; }
body.dark-mode .ta-char-table::-webkit-scrollbar-thumb { background: #312e81; }

body.dark-mode .ta-example-btn { background: #1e1b4b; border-color: #312e81; color: #a5b4fc; }
body.dark-mode .ta-example-btn:hover { background: #2e1b6b; border-color: #6366f1; }

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 768px) {
  #main-section { grid-template-columns: 1fr; }
  .ta-examples-inner { display: none !important; }
  .ta-examples-outer { display: block; }
}