/* ===== CSS Variables ===== */
:root {
  --bg-base: #0a0e1a;
  --bg-surface: #111827;
  --bg-card: #161d2e;
  --bg-card-hover: #1a2236;
  --bg-input: #1e2840;
  --border: rgba(255,255,255,0.08);
  --border-focus: rgba(99,179,237,0.6);
  --text-primary: #f0f4ff;
  --text-secondary: #94a3c8;
  --text-muted: #5a6b8a;
  --accent-blue: #3b82f6;
  --accent-blue-light: #60a5fa;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --brand-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --card-shadow: 0 4px 24px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition: 0.2s ease;
  --header-h: 60px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ===== Header ===== */
.header {
  height: var(--header-h);
  background: rgba(17,24,39,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-icon {
  width: 38px; height: 38px;
  background: var(--brand-gradient);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(59,130,246,0.4);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.brand-accent {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

/* ===== Layout ===== */
.app-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
  align-items: stretch;
}

/* ===== Preview Section ===== */
.preview-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
  background: var(--bg-base);
  min-height: 0;      /* grid item: prevent growing beyond grid area */
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.3px;
}

.batch-info {
  background: rgba(59,130,246,0.15);
  color: var(--accent-blue-light);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid rgba(59,130,246,0.3);
}

/* ===== Dropzone ===== */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  cursor: pointer;
  transition: all 0.25s ease;
  background: var(--bg-card);
  position: relative;
}

.dropzone:hover, .dropzone:focus {
  border-color: var(--accent-blue);
  background: rgba(59,130,246,0.05);
  outline: none;
}

.dropzone.drag-over {
  border-color: var(--accent-blue);
  background: rgba(59,130,246,0.1);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px rgba(59,130,246,0.15);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 32px;
}

.dropzone-icon {
  width: 80px; height: 80px;
  background: rgba(59,130,246,0.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-blue-light);
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.dropzone-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dropzone-sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.dropzone-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Canvas Wrapper ===== */
.canvas-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}

.canvas-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  align-self: flex-end;
}

.canvas-nav-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

#preview-canvas {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  display: block;
  box-shadow: var(--card-shadow);
}

.canvas-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== Thumbnail Strip ===== */
.thumbnail-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.thumb-item {
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.thumb-item.active { border-color: var(--accent-blue); }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.thumb-remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  color: white;
  border: none;
}
.thumb-item:hover .thumb-remove { display: flex; }

/* ===== Settings Panel ===== */
.settings-panel {
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  min-height: 0;        /* grid item: constrained by grid row height */
  overflow-y: auto;     /* the panel itself scrolls — no nested scroll needed */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.settings-panel::-webkit-scrollbar { width: 5px; }
.settings-panel::-webkit-scrollbar-track { background: transparent; }
.settings-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
}
.settings-panel::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* settings-scroll: plain layout wrapper, no scroll */
.settings-scroll {
  padding: 16px;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Sticky footer — always visible at bottom of viewport while scrolling */
.panel-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

/* ===== Settings Card ===== */
.settings-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color var(--transition);
}
.settings-card:hover { border-color: rgba(255,255,255,0.12); }

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}

.card-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.card-icon--blue { background: rgba(59,130,246,0.15); color: var(--accent-blue-light); }
.card-icon--green { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.card-icon--purple { background: rgba(139,92,246,0.15); color: var(--accent-purple); }
.card-icon--orange { background: rgba(245,158,11,0.15); color: var(--accent-orange); }

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.card-body {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== Toggle Switch ===== */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--bg-input);
  border-radius: 22px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 2px; bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.3s ease;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-blue); border-color: var(--accent-blue); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); background: white; }

/* ===== Form Elements ===== */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-row { display: flex; flex-direction: column; gap: 12px; }
.form-row.two-cols { flex-direction: row; gap: 8px; }
.form-row.two-cols .form-group { flex: 1; }

.form-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-input, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3c8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* ===== Radio Group ===== */
.radio-group { display: flex; flex-direction: column; gap: 6px; }
.radio-option { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.radio-option input[type="radio"] {
  width: 15px; height: 15px;
  accent-color: var(--accent-blue);
  cursor: pointer;
}
.radio-label { font-size: 0.8rem; color: var(--text-secondary); }
.radio-option:hover .radio-label { color: var(--text-primary); }

/* ===== Range Input ===== */
.range-input {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-input);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.3);
  transition: box-shadow var(--transition);
}
.range-input::-webkit-slider-thumb:hover { box-shadow: 0 0 0 5px rgba(59,130,246,0.3); }
.range-input::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  border: none;
}
.range-value {
  font-size: 0.75rem;
  color: var(--accent-blue-light);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

/* ===== Color Picker ===== */
.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.color-input-wrapper:hover { border-color: rgba(255,255,255,0.2); }
.color-picker {
  width: 22px; height: 22px;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
}
.color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker::-webkit-color-swatch { border: none; border-radius: 4px; }
.color-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

/* ===== Position Grid ===== */
.position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.pos-btn {
  aspect-ratio: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.pos-btn:hover { background: rgba(59,130,246,0.1); color: var(--accent-blue-light); border-color: rgba(59,130,246,0.3); }
.pos-btn.active { background: rgba(59,130,246,0.2); color: var(--accent-blue); border-color: var(--accent-blue); }

/* ===== Style Presets ===== */
.style-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.preset-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.preset-btn:hover { border-color: rgba(255,255,255,0.2); color: var(--text-primary); }
.preset-btn.active { background: rgba(59,130,246,0.15); border-color: var(--accent-blue); color: var(--accent-blue-light); }

/* ===== GPS Status ===== */
.gps-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
}
.gps-indicator { display: flex; align-items: center; gap: 8px; }
.gps-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.gps-dot.active { background: var(--accent-green); box-shadow: 0 0 0 3px rgba(16,185,129,0.3); animation: pulse 2s ease infinite; }
.gps-dot.error { background: var(--accent-red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
#gps-label { font-size: 0.8rem; color: var(--text-secondary); }

.coords-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent-green);
  background: rgba(16,185,129,0.05);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
}

/* ===== Buttons ===== */
.btn-apply {
  width: 100%;
  padding: 14px;
  background: var(--brand-gradient);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--transition);
  box-shadow: 0 4px 15px rgba(59,130,246,0.4);
  letter-spacing: 0.3px;
}
.btn-apply:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,0.5); }
.btn-apply:active { transform: translateY(0); }

.btn-primary {
  padding: 8px 16px;
  background: var(--accent-blue);
  color: white;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: all var(--transition);
}
.btn-primary:hover { background: #2563eb; }
.btn-primary.btn-accent { background: linear-gradient(135deg, #10b981, #059669); }
.btn-primary.btn-accent:hover { filter: brightness(1.1); }

.btn-secondary {
  padding: 8px 16px;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: all var(--transition);
}
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn-ghost {
  padding: 6px 12px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: all var(--transition);
}
.btn-ghost:hover { background: var(--bg-input); color: var(--text-primary); }
.btn-ghost.btn-sm { padding: 4px 8px; font-size: 0.75rem; }

.btn-link {
  background: none;
  border: none;
  color: var(--accent-blue-light);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
}
.btn-link:hover { color: var(--accent-blue); }

.btn-icon {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon:hover:not(:disabled) { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-icon:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--card-shadow);
  animation: slideIn 0.3s ease;
  max-width: 320px;
  min-width: 200px;
}
.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error { border-color: rgba(239,68,68,0.4); }
.toast.info { border-color: rgba(59,130,246,0.4); }
.toast-icon { flex-shrink: 0; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}
.toast.hiding { animation: slideOut 0.3s ease forwards; }

/* ===== Download Overlay ===== */
.download-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
}
.download-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 40px;
  text-align: center;
  min-width: 280px;
}
.download-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.download-text { font-size: 0.95rem; font-weight: 600; margin-bottom: 12px; }
.download-bar-wrap {
  width: 100%; height: 6px;
  background: var(--bg-input);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}
.download-bar {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: 6px;
  width: 0%;
  transition: width 0.3s ease;
}
.download-sub { font-size: 0.8rem; color: var(--text-secondary); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
    align-items: start;
  }
  .preview-section {
    min-height: 50vh;
    min-height: unset;   /* reset: no height constraint needed */
  }
  .settings-panel {
    border-left: none;
    border-top: 1px solid var(--border);
    overflow-y: visible;   /* mobile: page itself scrolls */
    min-height: unset;
  }
  .panel-footer {
    position: static;      /* no sticky on mobile, flows naturally */
    border-top: none;
    padding: 0 16px 24px;
  }
}

/* ===== Coordinate Input Panel ===== */
.coord-format-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}
.hint-mono {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
}
.coords-paste-row {
  margin-bottom: 8px;
}
.coord-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.btn-lookup {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(59,130,246,0.2));
  border: 1px solid rgba(16,185,129,0.4);
  color: var(--accent-green);
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-lookup:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(16,185,129,0.35), rgba(59,130,246,0.3));
  border-color: var(--accent-green);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}
.btn-lookup:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn-lookup.loading {
  pointer-events: none;
  opacity: 0.7;
}
.btn-coord-clear {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: var(--accent-red);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-coord-clear:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.5);
}

/* Result Box */
.coord-result {
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.coord-result-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.coord-result-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-green);
  line-height: 1.3;
}
.coord-result-raw {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
}
.coord-use-name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  cursor: pointer;
  font-size: 0.77rem;
  color: var(--text-secondary);
}
.coord-use-name input[type="checkbox"] {
  accent-color: var(--accent-green);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ===== Template Teks Card ===== */
.card-icon--teal { background: rgba(20,184,166,0.15); color: #2dd4bf; }

.form-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 400;
}

.token-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.token-pill {
  padding: 3px 9px;
  border-radius: 4px;
  background: rgba(45,212,191,0.08);
  border: 1px solid rgba(45,212,191,0.25);
  color: #2dd4bf;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.4;
}
.token-pill:hover {
  background: rgba(45,212,191,0.18);
  border-color: rgba(45,212,191,0.5);
  transform: translateY(-1px);
}
.token-pill:active { transform: translateY(0); }

.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-xs);
  padding: 10px;
  font-size: 0.8125rem;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  min-height: 90px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-textarea:focus {
  border-color: rgba(45,212,191,0.6);
  box-shadow: 0 0 0 3px rgba(45,212,191,0.1);
}
.form-textarea::placeholder { color: var(--text-muted); font-style: italic; }

/* Highlight tokens inside textarea (visual only via overlay is complex,
   instead show a live preview strip below) */
.template-preview {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}
.template-preview-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  padding: 3px 8px;
  min-height: 22px;
}
.template-preview-line .line-num {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  min-width: 14px;
  text-align: center;
}
.template-preview-line .line-text {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #2dd4bf;
}
.template-preview-empty {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 2px 4px;
}
