/* =============================================
   MINDSAVER — styles.css
   Aesthetic: Editorial brutalism meets calm utility
   Palette: Near-black bg, warm off-white, electric lime accent
   ============================================= */

:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-card-hover: #1c1c1c;
  --text: #f0ece4;
  --text-muted: #6b6560;
  --accent: #c8ff00;
  --accent-dark: #9bc400;
  --danger: #ff4545;
  --border: #242424;
  --radius: 12px;
  --radius-lg: 20px;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --transition: 0.2s ease;
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input { font-family: inherit; }

/* ---- UTILITIES ---- */
/* 
  .hidden uses display:none for layout-level elements that don't animate.
  Modals/overlays use their own .modal-hidden / .spinner-hidden classes
  (opacity + pointer-events) so CSS enter animations can still play.
*/
.hidden { display: none !important; }
.mt { margin-top: 16px; }

/* ---- INSTALL BANNER ---- */
.install-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--accent);
  color: #0a0a0a;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  z-index: 1000;
  font-weight: 500;
  font-size: 0.875rem;
  box-shadow: 0 -4px 30px rgba(200,255,0,0.2);
}
.install-banner.hidden { display: none !important; }
.install-banner:not(.hidden) { animation: slideUp 0.4s ease; }
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.install-banner span { flex: 1; }
.install-btn {
  background: #0a0a0a;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 8px;
  white-space: nowrap;
  transition: opacity var(--transition);
}
.install-btn:hover { opacity: 0.85; }
.install-dismiss {
  font-size: 1rem;
  color: rgba(0,0,0,0.5);
  padding: 4px;
  line-height: 1;
}

/* ---- HEADER ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(10,10,10,0.85);
}
.header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 10px var(--accent); transform: scale(1); }
  50%       { box-shadow: 0 0 20px var(--accent), 0 0 40px rgba(200,255,0,0.3); transform: scale(1.1); }
}
.brand-label {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  color: var(--text);
}

/* ---- MAIN / VIEWS ---- */
.main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px 120px;
}
.view { display: none; }
.view.active { display: block; }

/* ---- HERO ---- */
.hero {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3.8rem, 14vw, 6rem);
  line-height: 0.92;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 20px;
}
.hero-tagline {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 300;
  letter-spacing: 0.02em;
}

/* ---- SECTIONS ---- */
.section { margin-bottom: 40px; }
.section-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ---- HISTORY ---- */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
}
.hi-result {
  font-weight: 500;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hi-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  line-height: 1.6;
}
.empty-icon { font-size: 2.5rem; margin-bottom: 16px; }
.empty-state p { margin-bottom: 24px; font-size: 0.95rem; }

/* ---- LISTS GRID ---- */
.lists-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 380px) {
  .lists-grid { grid-template-columns: 1fr; }
}
.list-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
  text-align: left;
  color: var(--text);
  width: 100%;
}
.list-card::before {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 60px; height: 60px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  transform: translate(30px, 30px) scale(0);
  transition: opacity 0.3s, transform 0.3s;
}
.list-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.list-card:hover::before {
  opacity: 0.06;
  transform: translate(20px, 20px) scale(1);
}
.list-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.list-card-emoji { font-size: 1.5rem; margin-bottom: 12px; display: block; }
.list-card-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  word-break: break-word;
}
.list-card-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.list-card-used {
  position: absolute;
  top: 12px; right: 12px;
  background: var(--accent);
  color: #0a0a0a;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
}

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  padding: 12px 24px;
  border-radius: 100px;
  transition: opacity var(--transition), transform var(--transition);
  display: inline-block;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); opacity: 1; }
.btn-primary.small { padding: 10px 18px; font-size: 0.8rem; }
.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 10px 18px;
  border-radius: 100px;
  transition: border-color var(--transition), color var(--transition);
  display: inline-block;
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

/* ---- LIST DETAIL VIEW ---- */
.view-header {
  padding: 24px 0 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.back-btn {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: inline-block;
  transition: color var(--transition);
  padding: 4px 0;
}
.back-btn:hover { color: var(--accent); }
.list-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.list-detail-title {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.04em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  font-size: 1rem;
  padding: 8px;
  border-radius: 8px;
  transition: background var(--transition);
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
}
.icon-btn:hover { background: var(--bg-card); }
.icon-btn.danger:hover { background: rgba(255,69,69,0.15); }

/* ---- OPTIONS LIST ---- */
.options-container { margin-bottom: 40px; }
.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 20px;
}
.options-empty-msg {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 8px 0;
}
.option-item {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  gap: 12px;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  animation: fadeInItem 0.25s ease both;
}
@keyframes fadeInItem {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.option-item.highlighted {
  border-color: var(--accent);
  background: rgba(200,255,0,0.06);
  box-shadow: 0 0 0 1px var(--accent);
}
.option-item.winner {
  border-color: var(--accent);
  background: rgba(200,255,0,0.1);
  box-shadow: 0 0 20px rgba(200,255,0,0.15);
}
.option-bullet {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background 0.15s;
}
.option-item.highlighted .option-bullet,
.option-item.winner .option-bullet { background: var(--accent); }
.option-text {
  flex: 1;
  font-size: 0.95rem;
  color: var(--text);
  word-break: break-word;
}
.option-edit-btn, .option-delete-btn {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
  line-height: 1;
}
.option-edit-btn:hover { background: var(--bg-card-hover); color: var(--text); }
.option-delete-btn:hover { background: rgba(255,69,69,0.15); color: var(--danger); }

/* ---- ADD OPTION ROW ---- */
.add-option-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.text-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 16px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition);
  min-width: 0;
}
.text-input::placeholder { color: var(--text-muted); }
.text-input:focus { border-color: var(--accent); }

/* ---- DECIDE BUTTON ---- */
.decide-area {
  text-align: center;
  margin: 40px 0;
}
.decide-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: var(--accent);
  color: #0a0a0a;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s;
  box-shadow: 0 0 0 0 rgba(200,255,0,0.4);
  position: relative;
  overflow: hidden;
}
.decide-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.25), transparent 60%);
  pointer-events: none;
}
.decide-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 0 0 20px rgba(200,255,0,0.12), 0 20px 60px rgba(200,255,0,0.25);
}
.decide-btn:active:not(:disabled) { transform: scale(0.97); }
.decide-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.decide-btn-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
  position: relative; z-index: 1;
}
.decide-btn-sub {
  font-size: 0.65rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  opacity: 0.65;
  margin-top: 6px;
  text-transform: uppercase;
  position: relative; z-index: 1;
}

/* ---- RESULT AREA ---- */
/*
  Uses .hidden (display:none) since result doesn't need an entry animation
  while hidden — only the reveal matters, which is handled by JS adding the class.
*/
.result-area {
  text-align: center;
  padding: 32px 24px 40px;
}
.result-area:not(.hidden) {
  animation: revealResult 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes revealResult {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.result-label {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.result-text {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3.5rem);
  color: var(--accent);
  letter-spacing: 0.03em;
  line-height: 1.05;
  word-break: break-word;
}

/* ---- MODAL ---- */
/*
  .modal-overlay always has display:flex so the enter animation works.
  Visibility is controlled via opacity + pointer-events via .modal-hidden.
*/
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.2s ease;
}
.modal-overlay.modal-hidden {
  opacity: 0;
  pointer-events: none;
}
.modal-overlay:not(.modal-hidden) {
  animation: fadeOverlay 0.2s ease both;
}
@keyframes fadeOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal {
  background: #181818;
  border: 1px solid #2a2a2a;
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.modal-overlay:not(.modal-hidden) .modal {
  animation: slideModal 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes slideModal {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
  color: var(--text);
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ---- SPINNER OVERLAY ---- */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}
.spinner-overlay.spinner-hidden {
  opacity: 0;
  pointer-events: none;
}
.spinner-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 280px;
  height: 280px;
}
.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(200,255,0,0.15);
  border-top-color: var(--accent);
  animation: spin 0.65s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner-option {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 6vw, 2.2rem);
  color: var(--text);
  text-align: center;
  max-width: 220px;
  letter-spacing: 0.04em;
  padding: 0 20px;
  line-height: 1.2;
  word-break: break-word;
  transition: color 0.1s;
}
