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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #252836;
  --border: #2e3248;
  --text: #e2e8f0;
  --text-muted: #8892a4;
  --accent: #5c6bc0;
  --radius: 10px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
header {
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

header .subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Main layout ── */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ── Left panel ── */
.left-panel {
  width: 55%;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-header {
  padding: 12px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.ds-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
  position: relative;
}

.ds-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.ds-card:active { transform: translateY(0); }

.card-accent {
  height: 4px;
  background: var(--accent);
}

.card-body {
  padding: 12px 14px 14px;
}

.card-name {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-complexity {
  font-size: 0.72rem;
  color: var(--accent);
  font-family: 'Courier New', monospace;
  margin-bottom: 6px;
  font-weight: 600;
}

.card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Right panel ── */
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.entry-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.85rem;
  gap: 8px;
}

.entry-empty .icon { font-size: 2rem; }

.entry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  transition: border-color 0.15s;
}

.entry-row:hover { border-color: var(--accent); }

.entry-name {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.88rem;
  font-family: 'Courier New', monospace;
  outline: none;
  min-width: 0;
}

.entry-name:focus {
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  padding: 2px 4px;
}

.entry-size-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.entry-size {
  width: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.8rem;
  font-family: 'Courier New', monospace;
  padding: 2px 6px;
  outline: none;
  flex-shrink: 0;
}

.entry-size:focus {
  border-color: var(--accent);
}

.entry-badge {
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  flex-shrink: 0;
}

.entry-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.entry-delete:hover { color: #e74c3c; background: rgba(231,76,60,0.1); }

/* ── Footer / Generate button ── */
footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

#gen-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #5c6bc0 0%, #4a90e2 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: 0.3px;
}

#gen-btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

#gen-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* ── 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(--accent); }
