:root {
  --bg: #0b0d10;
  --bg-elev: #12151a;
  --bg-hi: #1a1e25;
  --border: #262a33;
  --text: #e8eaed;
  --text-muted: #9aa3b2;
  --accent: #6366f1;
  --accent-hi: #818cf8;
  --danger: #ef4444;
  --radius: 10px;
  --radius-sm: 6px;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px;
  gap: 12px;
}

.app__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.app__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app__logo {
  color: var(--accent);
}

.app__title {
  font-weight: 600;
  font-size: 15px;
}

.app__actions {
  display: flex;
  gap: 8px;
}

.panels {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.editor {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 8px 8px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}

.tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-family: var(--font-sans);
}

.tab:hover {
  color: var(--text);
  background: var(--bg-hi);
}

.tab--active {
  color: var(--text);
  background: var(--bg);
}

.editor__panes {
  flex: 1;
  position: relative;
  min-height: 0;
}

.editor__textarea {
  width: 100%;
  height: 100%;
  padding: 16px;
  border: none;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
  tab-size: 2;
  position: absolute;
  inset: 0;
}

.editor__textarea::placeholder {
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

.editor__footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--bg-hi);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: var(--border);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
}

.btn--ghost {
  background: transparent;
}

.btn kbd {
  padding: 2px 6px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-family: var(--font-mono);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info__block {
  padding: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.info__title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info__text {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.info__text kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}

.stats {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stats__item {
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stats__label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.stats__value {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  font-family: var(--font-mono);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  max-width: calc(100vw - 32px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast--show {
  opacity: 1;
  visibility: visible;
}

.toast--error {
  background: var(--danger);
  color: white;
}

@media (max-width: 900px) {
  .panels {
    grid-template-columns: 1fr;
  }
  .info {
    order: -1;
  }
}
