:root {
  --bg: #0b1020;
  --bg-soft: #111a30;
  --text: #e8ecf6;
  --muted: #a9b4cc;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.18);
  --primary: #6aa2ff;
  --primary-strong: #4f8fff;
  --danger: #ff6b81;
  --ok: #4cd190;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

body.light {
  --bg: #edf2ff;
  --bg-soft: #f4f7ff;
  --text: #172038;
  --muted: #516083;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(31, 45, 74, 0.12);
  --primary: #336df2;
  --primary-strong: #255be0;
  --danger: #dc3558;
  --ok: #1ea869;
  --shadow: 0 10px 24px rgba(62, 80, 120, 0.16);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  background: radial-gradient(circle at top right, #24345c 0%, var(--bg) 42%);
  color: var(--text);
  padding: 24px;
  transition: background 0.25s ease, color 0.25s ease;
}

body.light {
  background: radial-gradient(circle at top right, #dbe6ff 0%, var(--bg) 50%);
}

.bg-orb {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(36px);
  opacity: 0.35;
  z-index: -1;
}

.orb-a { top: -80px; left: -60px; background: #8f7bff; }
.orb-b { top: 30%; right: -80px; background: #42b7ff; }
.orb-c { bottom: -120px; left: 30%; background: #38e7a3; }

.app-shell {
  max-width: 1220px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.09em;
}

h1, h2, h3 {
  margin: 0;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.header-actions,
.toolbar-left,
.toolbar-right,
.panel-actions,
.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.header-actions {
  align-items: flex-start;
  justify-content: flex-end;
}

.btn {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--glass-border);
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
}

.btn.danger {
  background: linear-gradient(135deg, var(--danger), #e64866);
  color: #fff;
}

.btn.ghost {
  border-color: var(--glass-border);
}

.btn.pro {
  background: linear-gradient(135deg, #ffd86e, #ff9d5c);
  color: #312107;
}

.btn-sm {
  padding: 8px 11px;
  font-size: 12px;
}

.toolbar {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.select {
  border: 1px solid var(--glass-border);
  background: linear-gradient(140deg, rgba(21, 30, 48, 0.95), rgba(16, 24, 42, 0.78));
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.25);
  min-width: 230px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.select:hover {
  border-color: rgba(106, 162, 255, 0.55);
}

.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(106, 162, 255, 0.22), 0 6px 16px rgba(0, 0, 0, 0.3);
}

.select option {
  background: #141d33;
  color: #f2f5ff;
}

body.light .select {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 255, 0.95));
  border-color: rgba(52, 82, 134, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 6px 14px rgba(37, 59, 95, 0.14);
}

body.light .select:focus {
  box-shadow: 0 0 0 3px rgba(51, 109, 242, 0.2), 0 6px 14px rgba(37, 59, 95, 0.18);
}

body.light .select option {
  background: #ffffff;
  color: #1b2640;
}

.suggestion-banner {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hidden {
  display: none !important;
}

.editor-grid {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.panel {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 12px;
}

body.light .panel {
  background: rgba(255, 255, 255, 0.6);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

small {
  color: var(--muted);
}

textarea {
  width: 100%;
  min-height: 220px;
  max-height: 520px;
  resize: none;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  border-radius: 12px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.48;
}

body.light textarea {
  background: rgba(255, 255, 255, 0.9);
}

.diff-panel {
  padding: 14px;
}

#diffOutput {
  margin: 10px 0 0;
  min-height: 54px;
  max-height: 260px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  padding: 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: rgba(0, 0, 0, 0.2);
}

.changed-char {
  background: rgba(255, 237, 168, 0.25);
  color: #ffdf7e;
}

body.light .changed-char {
  background: rgba(255, 210, 74, 0.28);
  color: #9f5800;
}

.utility-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.card {
  padding: 14px;
}

.list {
  margin: 10px 0;
  max-height: 170px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.list-item {
  border: 1px solid var(--glass-border);
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
  cursor: pointer;
  font-size: 13px;
}

body.light .list-item {
  background: rgba(255, 255, 255, 0.78);
}

.list-item:hover {
  border-color: var(--primary);
}

.share-url {
  width: 100%;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
  padding: 9px 10px;
}

body.light .share-url {
  background: rgba(255, 255, 255, 0.84);
}

.faq {
  padding: 18px;
}

details {
  border-top: 1px solid var(--glass-border);
  padding: 12px 0;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

details p {
  color: var(--muted);
  margin: 8px 0 0;
}

.drop-zone {
  position: fixed;
  inset: 0;
  background: rgba(23, 35, 59, 0.88);
  color: #fff;
  display: grid;
  place-items: center;
  z-index: 90;
  border: 3px dashed rgba(255, 255, 255, 0.4);
  font-size: 24px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: rgba(25, 30, 45, 0.95);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  z-index: 100;
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .editor-grid {
    grid-template-columns: 1fr;
  }
  .utility-grid {
    grid-template-columns: 1fr;
  }
}
