* { box-sizing: border-box; }

/* ══════════════════════════════
   MAIN SECTION LAYOUT
   Left: Input | Right: Stats
══════════════════════════════ */
#main-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}

.sc-input-section  { grid-column: 1 / 2; }
.sc-stats-section  { grid-column: 2 / 3; }

/* ── Section base ── */
.sc-input-section,
.sc-stats-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.sc-section-title,
.sc-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.sc-section-title svg,
.sc-section-title svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #6366f1;
  stroke: #6366f1;
}

/* ══════════════════
   INPUT
══════════════════ */
.sc-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sc-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;
}

.sc-textarea:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.sc-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;
}

.sc-clear-btn:hover {
  background: #e2e8f0;
  color: #ef4444;
}

/* ══════════════════
   STATS GRID
══════════════════ */
.sc-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
  align-content: start;
}

/* ── Stat Card ── */
.sc-stat-card {
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.18s;
}

.sc-stat-card:hover {
  border-color: #a5b4fc;
  box-shadow: 0 2px 10px rgba(99,102,241,0.08);
}

/* Primary card — Sentences (spans full width) */
.sc-stat-primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #ede9fe, #e0e7ff);
  border-color: #6366f1;
  box-shadow: 0 2px 12px rgba(99,102,241,0.12);
}

.sc-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(99,102,241,0.10);
}

.sc-stat-icon svg {
  stroke: #6366f1;
}

.sc-stat-primary .sc-stat-icon {
  background: #6366f1;
}

.sc-stat-primary .sc-stat-icon svg {
  stroke: #ffffff;
}

.sc-stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sc-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.sc-stat-primary .sc-stat-value {
  font-size: 2rem;
  color: #4338ca;
}

.sc-stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sc-stat-primary .sc-stat-label {
  color: #6366f1;
}

/* ══════════════════
   DARK MODE
══════════════════ */
body.dark-mode .sc-input-section,
body.dark-mode .sc-stats-section {
  background: #0f172a;
  border-color: #1e293b;
}

body.dark-mode label.sc-section-title,
body.dark-mode .sc-section-title {
  color: #e2e8f0;
}

body.dark-mode label.sc-section-title svg,
body.dark-mode .sc-section-title svg {
  color: #a5b4fc;
  stroke: #a5b4fc;
}

body.dark-mode .sc-textarea {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .sc-textarea:focus {
  border-color: #818cf8;
}

body.dark-mode .sc-clear-btn {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

body.dark-mode .sc-clear-btn:hover {
  background: #334155;
  color: #ef4444;
}

body.dark-mode .sc-stat-card {
  background: #1e1b4b;
  border-color: #312e81;
}

body.dark-mode .sc-stat-card:hover {
  border-color: #6366f1;
}

body.dark-mode .sc-stat-primary {
  background: linear-gradient(135deg, #1e1b4b, #2e1b6b);
  border-color: #6366f1;
}

body.dark-mode .sc-stat-icon {
  background: #0f172a;
}

body.dark-mode .sc-stat-primary .sc-stat-icon {
  background: #6366f1;
}

body.dark-mode .sc-stat-value {
  color: #e2e8f0;
}

body.dark-mode .sc-stat-primary .sc-stat-value {
  color: #a5b4fc;
}

body.dark-mode .sc-stat-label {
  color: #94a3b8;
}

body.dark-mode .sc-stat-primary .sc-stat-label {
  color: #a5b4fc;
}

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 700px) {
  #main-section {
    grid-template-columns: 1fr;
  }

  .sc-input-section { grid-column: 1 / -1; }
  .sc-stats-section { grid-column: 1 / -1; }

  .sc-textarea { min-height: 160px; }

  .sc-stat-value { font-size: 1.3rem; }
  .sc-stat-primary .sc-stat-value { font-size: 1.6rem; }
}