/* ============================================================
   Escape Cursor Web – Minimal Dark UI
   ============================================================ */

/* ---------- Variables ---------- */
:root {
  --bg:       #0b0f1a;
  --surface:  #141926;
  --surface2: #1c2233;
  --input:    #1e2538;
  --border:   #2a3247;
  --blue:     #3b82f6;
  --purple:   #8b5cf6;
  --green:    #10b981;
  --red:      #ef4444;
  --yellow:   #f59e0b;
  --text:     #e2e8f0;
  --text2:    #7b8bab;
  --text3:    #4a5568;
  --radius:   10px;
  --radius-sm: 6px;
  --transition: 0.2s ease;

  --msg-ok-fg: var(--green);   --msg-ok-bg: #052e1f;
  --msg-err-fg: var(--red);    --msg-err-bg: #2a0a0a;
  --msg-warn-fg: var(--yellow);--msg-warn-bg: #2a1c06;
  --msg-info-fg: var(--blue);  --msg-info-bg: #0c1a3a;
  --msg-copy-fg: var(--purple);--msg-copy-bg: #1a0a3a;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- App Shell ---------- */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.header-logo { color: var(--blue); }

.header-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
}
.icon-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--text3);
}

/* ---------- Status Bar ---------- */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
  flex-shrink: 0;
  background: var(--surface);
  color: var(--text2);
  border: 1px solid var(--border);
  white-space: pre-line;
  line-height: 1.5;
  text-align: center;
}

.status-icon { flex-shrink: 0; }

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- Controls ---------- */
.controls {
  flex-shrink: 0;
  padding: 16px;
}

.controls-grid {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

/* ---------- Field ---------- */
.field { display: flex; flex-direction: column; }

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.field-label svg { color: var(--text3); }

.field:first-child { flex: 0 0 220px; }
.field-commands { flex: 1; min-width: 0; }

.field-text {
  padding: 12px 16px 0;
}

.input {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 12px;
  outline: none;
  caret-color: var(--blue);
  transition: all var(--transition);
}

.input::placeholder { color: var(--text3); }

.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* ---------- Command Buttons ---------- */
.cmd-group {
  display: flex;
  gap: 4px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.cmd-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text3);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 6px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.cmd-btn svg {
  flex-shrink: 0;
  transition: color var(--transition);
}

.cmd-btn:hover {
  color: var(--text2);
  background: var(--surface2);
}

.cmd-btn.active {
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.cmd-btn.active svg { color: #fff; }

/* ---------- Canvas ---------- */
.canvas-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.canvas-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.canvas-title svg { color: var(--blue); }

.canvas-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
}

.canvas-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
  background: var(--input);
}

.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* ---------- Placeholder ---------- */
.canvas-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  user-select: none;
  color: var(--text3);
}

.canvas-placeholder.hidden { display: none; }

.placeholder-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
}

.placeholder-label kbd {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.placeholder-sub {
  font-size: 12px;
  color: var(--text3);
}

.placeholder-sub kbd {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
}

/* ---------- Upload Button (placeholder) ---------- */
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 10px 20px;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  pointer-events: auto;
  transition: all var(--transition);
}

.upload-btn:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.upload-btn:active {
  transform: scale(0.97);
}

/* ---------- Upload Button (header) ---------- */
.canvas-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--input);
  color: var(--text2);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
}

.header-upload-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--text3);
}

/* ---------- Drop Overlay ---------- */
.drop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 2px dashed var(--blue);
  border-radius: var(--radius-sm);
  color: var(--blue);
  font-size: 15px;
  font-weight: 600;
  z-index: 10;
  pointer-events: none;
}

.drop-overlay.active {
  display: flex;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app { padding: 12px; gap: 10px; }

  .controls-grid {
    flex-direction: column;
    align-items: stretch;
  }

  .field:first-child { flex: 1; }

  .cmd-group { flex-wrap: wrap; }

  .cmd-btn {
    flex: 1 1 calc(33% - 4px);
    min-width: 0;
  }

  .cmd-btn span { display: none; }
  .cmd-btn { justify-content: center; padding: 8px; }
}

@media (max-width: 600px) {
  .app { padding: 8px; gap: 8px; }

  .header-title { font-size: 14px; }

  .controls { padding: 12px; }

  .canvas-header { padding: 10px 12px; }

  .cmd-btn {
    flex: 1 1 calc(50% - 4px);
  }

  .canvas-hint { display: none; }

  .header-upload-btn span { display: none; }

  .placeholder-sub { font-size: 11px; text-align: center; line-height: 1.6; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ---------- Selection ---------- */
::selection { background: var(--blue); color: #fff; }
