/* ── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f0f0f;
  --surface:   #1a1a1a;
  --surface2:  #242424;
  --border:    #2e2e2e;
  --text:      #e8e8e8;
  --muted:     #888;
  --accent:    #4a9eff;

  --valid:     #2db57a;
  --reject:    #e05252;
  --maybe:     #d4a017;
  --prev-next: #444;

  --radius:    14px;
  --bar-h:     72px;
  --top-h:     48px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
  gap: 20px;
  overflow: auto;
}

.login-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

.login-form input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  padding: 14px 16px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}

.login-form input:focus { border-color: var(--accent); }

.login-form button {
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 14px;
  width: 100%;
}

.login-error {
  color: var(--reject);
  font-size: 0.9rem;
  text-align: center;
}

/* ── App Shell ──────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-rows: var(--top-h) 1fr var(--bar-h);
  height: 100dvh;
  overflow: hidden;
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: var(--top-h);
  position: relative;
  z-index: 10;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.logout-btn {
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ── Stage ──────────────────────────────────────────────────────────────── */
.stage {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.card {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 16px 12px;
  will-change: transform, opacity;
  transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity   0.25s ease;
}

.card--loading,
.card--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-icon {
  font-size: 3rem;
  color: var(--valid);
}

.card--empty h2 {
  font-size: 1.4rem;
  font-weight: 600;
}

.card--empty p { color: var(--muted); }
.empty-stats    { font-size: 0.85rem; }

/* ── Idea Card Content ──────────────────────────────────────────────────── */
.card-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge--score    { background: #1e3a5f; color: var(--accent); }
.badge--source   { background: #2a2a2a; color: var(--muted); }
.badge--category { background: #1e2a1e; color: #6abf69; }

.badge--high   { background: #1a3a2a; color: var(--valid); }
.badge--medium { background: #2a2a1a; color: var(--maybe); }
.badge--low    { background: #2a1a1a; color: var(--reject); }

.idea-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 18px;
  color: var(--text);
}

.idea-section {
  margin-bottom: 16px;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.section-text {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.55;
}

.idea-product {
  font-size: 1rem;
  font-weight: 500;
  color: #d4e8ff;
}

.idea-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.source-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
}

/* ── Score Breakdown ────────────────────────────────────────────────────── */
.score-breakdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 6px;
  font-size: 0.82rem;
}

.score-row {
  display: contents;
}

.score-row span:first-child { color: var(--muted); }
.score-row span:last-child  { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }

.score-row--penalty span:last-child { color: var(--reject); }

/* ── Notes ──────────────────────────────────────────────────────────────── */
.notes-wrap { padding-bottom: 8px; }

.notes-field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  padding: 12px 14px;
  resize: vertical;
  width: 100%;
  min-height: 56px;
  outline: none;
  transition: border-color 0.2s;
}

.notes-field:focus { border-color: var(--accent); }
.notes-field::placeholder { color: var(--muted); }

/* ── Action Bar ─────────────────────────────────────────────────────────── */
.action-bar {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.2fr 1.2fr 1fr;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  align-items: center;
  height: var(--bar-h);
}

.btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  height: 52px;
  letter-spacing: 0.01em;
  outline: none;
  transition: opacity 0.15s, transform 0.1s;
  touch-action: manipulation;
  white-space: nowrap;
}

.btn:active { transform: scale(0.94); opacity: 0.85; }

.btn--reject { background: var(--reject);   color: #fff; }
.btn--maybe  { background: var(--maybe);    color: #000; }
.btn--valid  { background: var(--valid);    color: #fff; }
.btn--prev,
.btn--next   { background: var(--surface2); color: var(--muted); font-size: 0.72rem; }

.btn:disabled { opacity: 0.3; pointer-events: none; }

/* ── Swipe Hint Overlay ─────────────────────────────────────────────────── */
.swipe-hint {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 100;
  font-size: 2.5rem;
  font-weight: 900;
  border-radius: 20px;
  margin: 8px;
  transition: background 0.1s;
}

.swipe-hint--valid  { background: rgba(45, 181, 122, 0.25); color: var(--valid); }
.swipe-hint--reject { background: rgba(224, 82, 82, 0.25);  color: var(--reject); }
.swipe-hint--maybe  { background: rgba(212, 160, 23, 0.25); color: var(--maybe); }

/* ── Card animation states ──────────────────────────────────────────────── */
.card--exit-left  { transform: translateX(-110%) rotate(-8deg); opacity: 0; }
.card--exit-right { transform: translateX(110%)  rotate(8deg);  opacity: 0; }
.card--exit-down  { transform: translateY(110%)  rotate(4deg);  opacity: 0; }
.card--enter      { transform: translateX(0) rotate(0); opacity: 1; }
.card--enter-from { transform: translateX(50px); opacity: 0; }

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
