*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

::selection {
  background: rgba(123, 92, 245, 0.4);
  color: #FFFFFF;
}

:root {
  --cy-green: #00C271;
  --cy-green-dim: #00C27122;
  --cy-green-mid: #00C27155;
  --pw-purple: #7B5CF5;
  --pw-purple-dim: #7B5CF522;
  --pw-purple-mid: #7B5CF555;
  --bg: #0D0D10;
  --surface: #13131A;
  --surface2: #1A1A24;
  --surface3: #22222E;
  --border: #2A2A3A;
  --border2: #383848;
  --text: #F0EFF8;
  --text-dim: #8888AA;
  --text-dimmer: #555568;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --radius: 10px;
  --radius-lg: 16px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

/* ── GRID LAYOUT ── */
.app {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  height: 100vh;
  overflow: hidden;
}

/* ── HEADER ── */
header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 28px;
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

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

.brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, var(--cy-green), var(--pw-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-tag {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dimmer);
  background: var(--surface3);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── DIRECTION CONTROL ── */
.header-center {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  gap: 2px;
}

.logo-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  padding-bottom: 3px !important;
  height: 38px;
  min-width: 105px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: normal; 
  transition: all 0.2s ease;
  white-space: nowrap;
  cursor: default;
  user-select: none;
  overflow: visible;
}

.logo-chip.cy { color: var(--cy-green); background: var(--cy-green-dim); }
.logo-chip.pw { color: var(--pw-purple); background: var(--pw-purple-dim); }

.logo-chip svg, .logo-chip img {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: block;
}

.brand-container { display: flex; flex-direction: column; }
.brand-title { display: flex; align-items: center; gap: 8px; }
.brand-subtitle { font-size: 11px; color: var(--text-dimmer); margin-left: 30px; letter-spacing: 0.02em; text-transform: uppercase; font-weight: 500; }

.swap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface3);
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.swap-btn:hover { background: var(--surface); color: var(--text); border-color: var(--text-dimmer); transform: scale(1.05); }
.swap-btn:active { transform: scale(0.95); }
.swap-btn svg { transition: transform 0.35s cubic-bezier(.68,-0.55,.27,1.55); }
.swap-btn.flipping svg { transform: rotate(180deg); }

/* ── PRO TIPS SECTION ── */
.pro-tips-section {
  padding: 8px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.pro-tips-section summary {
  cursor: pointer;
  color: var(--text-dim);
  transition: color 0.15s;
  padding: 4px 0;
}
.pro-tips-section summary:hover { color: var(--text); }
.pro-tips-section ul { margin-top: 8px; padding-left: 20px; color: var(--text-dim); }
.pro-tips-section li { margin-bottom: 4px; }

/* ── HEADER ACTIONS ── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text-dim);
  white-space: nowrap;
}
.btn:hover { background: var(--surface3); color: var(--text); border-color: var(--text-dimmer); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
  background: var(--cy-green-dim);
  border: 1px solid var(--cy-green-mid);
  color: var(--cy-green);
}

.btn-primary.to-pw {
  background: var(--pw-purple-dim);
  border: 1px solid var(--pw-purple-mid);
  color: var(--pw-purple);
}

.btn-primary:hover {
  transform: none;
  filter: none;
  background: var(--cy-green);
  border-color: var(--cy-green);
  color: #0D1F17;
}

.btn-primary.to-pw:hover {
  transform: none;
  filter: none;
  background: var(--pw-purple);
  border-color: var(--pw-purple);
  color: #EEE8FF;
}

.btn-primary:active {
  transform: scale(0.97);
}

/* ── MAIN EDITOR AREA ── */
.editor-area {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

/* ── PANE ── */
.pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.pane-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: normal;
}
.pane-label.cy { color: var(--cy-green); }
.pane-label.pw { color: var(--pw-purple); }

.pane-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.cy .pane-dot { background: var(--cy-green); box-shadow: 0 0 6px var(--cy-green); }
.pw .pane-dot { background: var(--pw-purple); box-shadow: 0 0 6px var(--pw-purple); }

.pane-actions { display: flex; gap: 6px; }

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text-dim);
  transition: all 0.15s;
}
.btn-sm:hover { background: var(--surface3); color: var(--text); }

/* ── EDITOR WRAPPER ── */
.editor-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

textarea, .output-code {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  border: none;
  outline: none;
  resize: none;
  background: var(--bg);
  color: var(--text);
  tab-size: 2;
  overflow: auto;
}
textarea::placeholder { color: var(--text-dimmer); font-style: italic; }
textarea:focus { box-shadow: inset 0 0 0 1px var(--cy-green-mid); }
.output-pane textarea:focus { box-shadow: inset 0 0 0 1px var(--pw-purple-mid); }

.output-code { white-space: pre; overflow: auto; cursor: text; user-select: text; }

/* ── LINE NUMBERS ── */
.line-gutter {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  padding: 18px 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.line-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dimmer);
  line-height: 1.7;
  padding-right: 8px;
  height: 21.25px;
  display: flex;
  align-items: center;
}

textarea.with-gutter, .output-code.with-gutter { padding-left: 52px; }

/* ── DIVIDER ── */
.divider { width: 1px; background: var(--border); flex-shrink: 0; position: relative; }

/* ── MIDDLE DIVIDER ── */
.middle-divider { width: 1px; background: var(--border); flex-shrink: 0; }

/* ── BOTTOM BAR ── */
.bottom-bar { border-top: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.stats-row { display: flex; align-items: center; gap: 20px; padding: 6px 16px; }
.stat-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-dim); }
.stat-item strong { color: var(--text); font-weight: 600; font-family: var(--font-mono); }
.stat-item .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-dimmer); }

.warnings-area { max-height: 80px; overflow-y: auto; padding: 6px 16px; border-bottom: 1px solid var(--border); }
.warn-row { display: flex; align-items: flex-start; gap: 6px; padding: 2px 0; font-size: 11px; color: #E8A000; font-family: var(--font-mono); }
.warn-icon { flex-shrink: 0; margin-top: 1px; }

/* ── EXAMPLES PRESETS ── */
.examples-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.examples-label { font-size: 11px; color: var(--text-dimmer); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-right: 4px; }
.example-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text-dim);
  transition: all 0.15s;
}
.example-pill:hover { border-color: var(--cy-green-mid); color: var(--cy-green); background: var(--cy-green-dim); }
.example-pill.to-pw:hover { border-color: var(--pw-purple-mid); color: var(--pw-purple); background: var(--pw-purple-dim); }

/* ── PLACEHOLDER STATE ── */
.placeholder-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-dimmer);
  padding: 2rem;
  text-align: center;
  pointer-events: none;
}
.placeholder-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2); border: 1px solid var(--border);
}
.placeholder-state h3 { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--text-dim); }
.placeholder-state p { font-size: 12px; line-height: 1.5; max-width: 220px; }

/* ── TAB STRIP ── */
.tab-strip { display: none; gap: 0; border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.tab-strip.visible { display: flex; }
.tab { padding: 7px 16px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; color: var(--text-dimmer); border-bottom: 2px solid transparent; transition: all 0.15s; }
.tab:hover { color: var(--text-dim); }
.tab.active { color: var(--pw-purple); border-bottom-color: var(--pw-purple); }

/* ── FOOTER ── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 40px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  z-index: 10;
}
.footer-copyright { font-size: 11px; color: var(--text-dimmer); }
.footer-link { display: inline-flex; align-items: center; font-size: 11px; color: var(--text-dim); text-decoration: none; transition: color 0.15s; }
.footer-link:hover { color: var(--text); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dimmer); }

kbd { display: inline-flex; align-items: center; padding: 1px 5px; border-radius: 4px; font-size: 10px; font-family: var(--font-mono); background: var(--surface3); border: 1px solid var(--border2); color: var(--text-dimmer); }

/* ═══════════════════════════════ RESPONSIVE BREAKPOINTS ════════════════════════════════ */

@media (max-width: 1024px) {
  header { padding: 0 16px; }
  .header-brand .brand-tag, .header-actions kbd { display: none; }
}

@media (max-width: 850px) {
  .app { height: 100vh; overflow: hidden; }
  
  header { display: flex; position: relative; top: 0; height: auto; min-height: 64px; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .header-center { order: 3; width: 100%; justify-content: center; }
  .header-actions { order: 2; width: auto; }
  
  .editor-area { 
    display: flex; 
    flex-direction: row; 
    flex-wrap: nowrap;
    overflow-x: auto; 
    overflow-y: hidden; 
    scroll-snap-type: x mandatory;
    width: 100vw;
    height: 100%;
    padding: 10px;
    gap: 10px;
  }
  
  .middle-divider { display: none; }
  
  .pane { 
    flex: 0 0 95vw; 
    height: calc(100% - 20px); 
    border: 1px solid var(--border); 
    border-radius: var(--radius);
    scroll-snap-align: center;
  }
  
  .pane.output-pane { height: calc(100% - 20px); }
  .editor-wrap { height: 100%; width: 100%; position: relative; }
  
  textarea, .output-code { position: relative; height: 100%; border-radius: 0; border: none; }
}

@media (max-width: 600px) {
  header { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
  .header-brand { justify-content: center; }
  .header-actions { justify-content: space-between; width: 100%; gap: 6px; }
  .action-divider { display: none; }
  
  .logo-chip { padding: 6px 10px; font-size: 12px; min-width: 90px; }
  .swap-btn { width: 30px; height: 30px; }
  
  .examples-bar { padding: 8px 12px; gap: 4px; }
  .examples-label { width: 100%; margin-bottom: 2px; }
  
  .stats-row { gap: 12px; padding: 6px 12px; flex-wrap: wrap; }
  
  .site-footer { flex-direction: column; justify-content: center; gap: 8px; height: auto; padding: 14px 16px; text-align: center; }
  .footer-left, .footer-right { justify-content: center; width: 100%; }
}

@media (max-width: 600px) {
  .header-actions { justify-content: center !important; width: 100%; margin-top: 10px; }
}
