/* ============================================================
   DEECIDE! — style.css
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,700;0,9..144,900;1,9..144,400&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600&display=swap');

:root {
  --bg:         #0D0F1A;
  --surface:    #161926;
  --surface2:   #1E2235;
  --border:     #272B40;
  --text:       #F5F0E8;
  --text2:      #9090A8;
  --coral:      #FF5F45;
  --coral-dk:   #CC4C36;
  --gold:       #F0B429;
  --radius-lg:  20px;
  --radius-md:  14px;
  --radius-sm:  10px;
  --pill:       999px;
  --fd:         'Fraunces', Georgia, serif;
  --fb:         'DM Sans', system-ui, sans-serif;
  --spring:     cubic-bezier(0.34, 1.56, 0.64, 1);
  --out:        cubic-bezier(0.16, 1, 0.3, 1);
  --sb:         env(safe-area-inset-bottom, 0px);
}
[data-theme="light"] {
  --bg:       #F2EEE5;
  --surface:  #FFFFFF;
  --surface2: #EDE9DF;
  --border:   #D8D3C8;
  --text:     #1A1612;
  --text2:    #7A746A;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body { font-family: var(--fb); background: var(--bg); color: var(--text); height: 100%; overflow: hidden; -webkit-tap-highlight-color: transparent; transition: background .35s, color .35s; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input  { font-family: inherit; border: none; outline: none; background: none; }

/* ── APP ── */
#app { width: 100%; height: 100%; position: relative; overflow: hidden; }

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform .4s var(--out);
  padding-bottom: calc(24px + var(--sb));
  background: var(--bg);
}
.screen.active    { transform: translateX(0); }
.screen.slide-out { transform: translateX(-30%); }

/* ── TOP BAR ── */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px; position: sticky; top: 0; z-index: 10;
  background: var(--bg); transition: background .35s; flex-shrink: 0;
}
.top-right-btns { display: flex; gap: 6px; }
.wordmark { font-family: var(--fd); font-size: 26px; font-weight: 900; color: var(--coral); letter-spacing: -1px; font-style: italic; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface2); display: flex; align-items: center; justify-content: center;
  color: var(--text2); transition: transform .2s var(--spring), background .2s; flex-shrink: 0;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(0.86); background: var(--border); }
.user-initial-icon { font-family: var(--fd); font-weight: 900; font-size: 18px; color: var(--coral); line-height: 1; }
.ghost-btn { font-size: 14px; font-weight: 600; color: var(--text2); padding: 6px 12px; border-radius: var(--pill); transition: background .2s; }
.ghost-btn:active { background: var(--surface2); }
.ghost-btn.danger-txt { color: var(--coral); }
.ghost-btn.small { font-size: 13px; }

/* ── ORACLE ── */
.oracle-zone { position: relative; display: flex; align-items: center; justify-content: center; padding: 24px 0 16px; flex-shrink: 0; }
.oracle-glow { position: absolute; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255,95,69,.18) 0%, transparent 70%); pointer-events: none; transition: opacity .6s; }
.oracle {
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #2a2e4a 0%, #0a0c14 60%, #000 100%);
  box-shadow: 0 0 0 3px var(--border), 0 0 0 6px var(--surface2), 0 20px 60px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08);
  position: relative; overflow: hidden; flex-shrink: 0; transition: transform .3s var(--spring);
}
[data-theme="light"] .oracle { background: radial-gradient(circle at 38% 32%, #3a3f6a 0%, #1a1d2e 60%, #050608 100%); }
.oracle-inner { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.oracle-shimmer { position: absolute; top: 12%; left: 20%; width: 35%; height: 22%; background: radial-gradient(ellipse, rgba(255,255,255,.12) 0%, transparent 70%); border-radius: 50%; }
.oracle-content { text-align: center; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; }
.oracle-icon   { font-size: 36px; display: block; }
.oracle-ask    { font-family: var(--fd); font-style: italic; font-size: 13px; color: rgba(245,240,232,.45); }
.oracle-result { font-family: var(--fd); font-weight: 900; font-size: clamp(15px,4.5vw,22px); color: var(--gold); max-width: 140px; word-break: break-word; text-shadow: 0 0 20px rgba(240,180,41,.4); animation: revealR .5s var(--spring) forwards; }
@keyframes revealR { from { opacity:0; transform:scale(.7) translateY(6px); } to { opacity:1; transform:scale(1) translateY(0); } }
.oracle.spinning { animation: oP .5s ease-in-out infinite alternate; }
@keyframes oP { from{transform:scale(.97);box-shadow:0 0 0 3px var(--border),0 0 0 6px var(--surface2),0 20px 60px rgba(0,0,0,.6),0 0 30px rgba(255,95,69,.15);} to{transform:scale(1.02);box-shadow:0 0 0 3px var(--coral),0 0 0 7px var(--surface2),0 24px 70px rgba(0,0,0,.6),0 0 50px rgba(255,95,69,.35);} }
.oracle.winner { box-shadow: 0 0 0 3px var(--gold), 0 0 0 7px var(--surface2), 0 24px 70px rgba(0,0,0,.7), 0 0 60px rgba(240,180,41,.3); transition: box-shadow .4s var(--out); }

/* ── DECIDE BTN ── */
.decide-btn {
  margin: 0 20px; height: 64px; border-radius: var(--radius-lg);
  background: var(--coral); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 0 var(--coral-dk), 0 10px 30px rgba(255,95,69,.35);
  transition: transform .15s var(--spring), box-shadow .15s; flex-shrink: 0; position: relative; overflow: hidden;
}
.decide-btn::before { content:''; position:absolute; top:0; left:0; right:0; height:50%; background:rgba(255,255,255,.1); border-radius:var(--radius-lg) var(--radius-lg) 40% 40%; }
.decide-btn:active { transform:translateY(4px); box-shadow:0 2px 0 var(--coral-dk),0 4px 14px rgba(255,95,69,.3); }
.decide-btn:disabled { opacity:.5; pointer-events:none; }
.decide-btn-text { font-family:var(--fd); font-weight:900; font-size:24px; letter-spacing:-.5px; font-style:italic; }

/* ── PRESETS ── */
.preset-strip { display:flex; gap:8px; padding:14px 20px 2px; overflow-x:auto; scrollbar-width:none; flex-shrink:0; }
.preset-strip::-webkit-scrollbar { display:none; }
.preset-chip { flex-shrink:0; background:var(--surface2); border:1.5px solid var(--border); border-radius:var(--pill); padding:8px 14px; font-size:13px; font-weight:600; color:var(--text2); white-space:nowrap; transition:all .2s var(--spring); }
.preset-chip:active, .preset-chip.lit { background:var(--coral); border-color:var(--coral); color:#fff; transform:scale(.95); }

/* ── OPTIONS CARD ── */
.options-card { margin:14px 16px 0; background:var(--surface); border:1.5px solid var(--border); border-radius:var(--radius-lg); overflow:hidden; flex-shrink:0; transition:background .35s,border-color .35s; }
.options-card-head { display:flex; align-items:center; justify-content:space-between; padding:14px 16px 10px; border-bottom:1px solid var(--border); }
.options-heading { font-family:var(--fd); font-weight:700; font-size:16px; color:var(--text); display:flex; align-items:center; gap:8px; }
.count-pill { background:var(--coral); color:#fff; font-family:var(--fb); font-size:11px; font-weight:700; border-radius:var(--pill); padding:2px 7px; min-width:22px; text-align:center; }
.options-head-actions { display:flex; align-items:center; gap:6px; }
.save-list-btn { background:var(--surface2); border:1.5px solid var(--border); border-radius:var(--pill); padding:5px 12px; font-size:12px; font-weight:700; color:var(--text); white-space:nowrap; transition:all .2s var(--spring); }
.save-list-btn:active { background:var(--coral); border-color:var(--coral); color:#fff; transform:scale(.93); }
.options-list { min-height:8px; }
.option-item { display:flex; align-items:center; gap:10px; padding:12px 16px; border-bottom:1px solid var(--border); background:var(--surface); transition:background .15s; animation:slideIn .3s var(--spring) both; }
@keyframes slideIn { from{opacity:0;transform:translateX(-12px);} to{opacity:1;transform:translateX(0);} }
.option-item:last-child { border-bottom:none; }
.option-item.swipe-reveal { background:#c0392b; }
.option-dot { width:8px; height:8px; border-radius:50%; background:var(--coral); flex-shrink:0; opacity:.6; }
.option-text { flex:1; font-size:15px; font-weight:500; color:var(--text); word-break:break-word; }
.option-item.highlight { background:var(--surface2); }
.option-item.highlight .option-dot { opacity:1; background:var(--gold); box-shadow:0 0 6px var(--gold); }
.option-item.highlight .option-text { color:var(--gold); font-weight:600; }
.option-delete { width:30px; height:30px; border-radius:50%; background:var(--surface2); display:flex; align-items:center; justify-content:center; color:var(--text2); font-size:16px; flex-shrink:0; transition:background .2s,color .2s,transform .2s var(--spring); }
.option-delete:active { background:rgba(255,95,69,.2); color:var(--coral); transform:scale(.85); }
.option-empty { padding:24px 16px; text-align:center; font-size:14px; color:var(--text2); font-style:italic; font-family:var(--fd); }
.add-row { display:flex; border-top:1.5px solid var(--border); }
.option-input { flex:1; padding:14px 16px; font-size:15px; font-weight:500; color:var(--text); background:var(--surface2); transition:background .2s; }
.option-input::placeholder { color:var(--text2); font-weight:400; }
.option-input:focus { background:var(--surface); }
.add-btn { width:52px; height:52px; background:var(--coral); color:#fff; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:background .2s,transform .15s var(--spring); }
.add-btn svg { width:18px; height:18px; }
.add-btn:active { background:var(--coral-dk); transform:scale(.9); }

/* ── USER BAR ── */
.user-bar { display:flex; align-items:center; gap:10px; margin:10px 16px 0; background:var(--surface); border:1.5px solid var(--border); border-radius:var(--radius-md); padding:10px 14px; flex-shrink:0; }
.user-avatar-circle { width:36px; height:36px; border-radius:50%; background:var(--coral); color:#fff; display:flex; align-items:center; justify-content:center; font-family:var(--fd); font-weight:900; font-size:18px; flex-shrink:0; }
.user-info { flex:1; display:flex; flex-direction:column; gap:2px; min-width:0; }
.user-display-name { font-size:14px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-lists-btn { font-size:12px; font-weight:600; color:var(--coral); background:none; border:none; padding:0; cursor:pointer; text-align:left; }
.signout-btn { font-size:12px; font-weight:700; color:var(--text2); background:var(--surface2); border:1px solid var(--border); border-radius:var(--pill); padding:5px 10px; white-space:nowrap; transition:background .2s,color .2s; }
.signout-btn:active { background:rgba(255,95,69,.15); color:var(--coral); }

/* ── HISTORY ── */
.history-body { flex:1; padding:16px; display:flex; flex-direction:column; gap:10px; }
.history-list { display:flex; flex-direction:column; gap:10px; }
.history-card { background:var(--surface); border:1.5px solid var(--border); border-radius:var(--radius-md); padding:14px 16px; display:flex; flex-direction:column; gap:4px; animation:slideIn .3s var(--spring) both; }
.history-winner { font-family:var(--fd); font-weight:900; font-size:20px; color:var(--gold); }
.history-from   { font-size:12px; color:var(--text2); font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.history-time   { font-size:11px; color:var(--text2); opacity:.6; }
.history-empty  { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; color:var(--text2); font-family:var(--fd); font-style:italic; font-size:16px; text-align:center; padding:60px 24px; }
.history-empty span { font-size:48px; }
.history-empty.hidden { display:none; }

/* ── LISTS ── */
.lists-body { flex:1; padding:16px; overflow-y:auto; }
.lists-grid { display:flex; flex-direction:column; gap:10px; }
.list-card { background:var(--surface); border:1.5px solid var(--border); border-radius:var(--radius-md); padding:14px 16px; display:flex; align-items:center; gap:12px; animation:slideIn .3s var(--spring) both; }
.list-card-body { flex:1; min-width:0; }
.list-card-name    { font-family:var(--fd); font-weight:900; font-size:17px; color:var(--text); margin-bottom:3px; }
.list-card-preview { font-size:12px; color:var(--text2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:2px; }
.list-card-count   { font-size:11px; color:var(--coral); font-weight:700; }
.list-card-actions { display:flex; align-items:center; gap:6px; flex-shrink:0; }
.list-load-btn { background:var(--coral); color:#fff; border:none; border-radius:var(--pill); padding:7px 14px; font-size:13px; font-weight:700; font-family:var(--fb); transition:all .18s var(--spring); }
.list-load-btn:active { background:var(--coral-dk); transform:scale(.93); }
.list-del-btn { background:var(--surface2); border:none; border-radius:50%; width:32px; height:32px; font-size:15px; display:flex; align-items:center; justify-content:center; transition:background .2s,transform .15s var(--spring); }
.list-del-btn:active { background:rgba(255,95,69,.2); transform:scale(.85); }
.lists-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:60px 24px; gap:12px; color:var(--text2); font-family:var(--fd); font-style:italic; font-size:16px; text-align:center; }
.lists-empty span { font-size:48px; }

/* ═══════════════════════════════════════════
   AUTH OVERLAY — full screen layer, outside #app
   Uses display:flex (toggled by JS) so it is
   always on top and never clipped.
═══════════════════════════════════════════ */
.auth-overlay {
  position: fixed; inset: 0;
  display: flex;           /* toggled none↔flex by JS */
  align-items: flex-end;
  justify-content: center;
  z-index: 9999;
}

.auth-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0);
  backdrop-filter: blur(0px);
  transition: background .35s ease, backdrop-filter .35s ease;
}
.auth-backdrop.visible {
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
}

/* THE SHEET */
.auth-sheet {
  position: relative;
  width: 100%; max-width: 480px;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 0 0 calc(16px + var(--sb));
  transform: translateY(100%);
  transition: transform .42s var(--spring);
  z-index: 1;
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -8px 40px rgba(0,0,0,.4);
}
.auth-sheet.open { transform: translateY(0); }

.save-sheet { max-height: 60vh; }

.auth-drag-bar { width: 40px; height: 4px; background: var(--border); border-radius: 4px; margin: 14px auto 0; }

/* CLOSE BTN */
.auth-close-btn {
  position: absolute; top: 12px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface2); color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: background .2s, transform .2s var(--spring);
}
.auth-close-btn:active { background: var(--border); transform: scale(.88); }

/* TABS */
.auth-tabs {
  display: flex; gap: 0;
  margin: 20px 24px 0;
  background: var(--surface2); border-radius: var(--radius-md);
  padding: 4px;
}
.auth-tab { flex:1; padding:10px; font-size:14px; font-weight:700; color:var(--text2); border-radius:var(--radius-sm); transition:all .22s var(--out); font-family:var(--fb); }
.auth-tab.active { background:var(--coral); color:#fff; box-shadow:0 3px 12px rgba(255,95,69,.35); }

/* FORM */
.auth-form { padding: 20px 24px 4px; display: flex; flex-direction: column; gap: 16px; }
.save-modal-body { padding: 20px 24px 0; display: flex; flex-direction: column; gap: 14px; }
.form-tagline { font-family:var(--fd); font-size:22px; font-weight:900; color:var(--text); font-style:italic; }

.field-group { display:flex; flex-direction:column; gap:6px; }
.field-label { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.8px; color:var(--text2); }
.field-hint  { font-size:11px; color:var(--text2); opacity:.7; margin-top:2px; }

.field-row { position:relative; display:flex; }
.field-row .field-input { padding-right: 48px; }

.field-input {
  width:100%; padding:14px 16px;
  background:var(--surface2); border:2px solid var(--border);
  border-radius:var(--radius-md); font-size:16px; font-weight:500;
  color:var(--text); transition:border-color .2s, background .2s;
  font-family:var(--fb);
}
.field-input::placeholder { color:var(--text2); font-weight:400; }
.field-input:focus { border-color:var(--coral); background:var(--surface); outline:none; }

.field-eye {
  position:absolute; right:14px; top:50%; transform:translateY(-50%);
  background:none; border:none; cursor:pointer; color:var(--text2); padding:4px;
  display:flex; align-items:center; justify-content:center;
}
.field-eye svg { width:20px; height:20px; }

.form-error { font-size:13px; font-weight:600; color:var(--coral); background:rgba(255,95,69,.1); border-radius:var(--radius-sm); padding:10px 14px; text-align:center; border:1px solid rgba(255,95,69,.25); }

.form-submit {
  width:100%; padding:16px; border-radius:var(--radius-md);
  background:var(--coral); color:#fff;
  font-size:16px; font-weight:700; font-family:var(--fb);
  box-shadow: 0 4px 0 var(--coral-dk), 0 8px 24px rgba(255,95,69,.3);
  transition: transform .15s var(--spring), box-shadow .15s;
  position: relative; overflow: hidden;
}
.form-submit::before { content:''; position:absolute; top:0;left:0;right:0;height:45%; background:rgba(255,255,255,.12); border-radius:inherit; }
.form-submit:active  { transform:translateY(3px); box-shadow:0 1px 0 var(--coral-dk),0 4px 12px rgba(255,95,69,.25); }
.form-submit:disabled { opacity:.55; pointer-events:none; }

.form-switch { text-align:center; font-size:13px; color:var(--text2); }
.form-switch-btn { color:var(--coral); font-size:13px; font-weight:700; background:none; border:none; cursor:pointer; font-family:var(--fb); padding:0 2px; }
.form-switch-btn:active { opacity:.7; }

/* SAVE MODAL specifics */
.save-btns { display:flex; gap:10px; }
.save-cancel-btn { flex:1; padding:14px; border-radius:var(--radius-md); background:var(--surface2); color:var(--text2); font-size:15px; font-weight:700; font-family:var(--fb); transition:background .2s; }
.save-cancel-btn:active { background:var(--border); }
.save-confirm-btn { flex:1; }

/* ── TOAST ── */
#app-toast {
  position:fixed; bottom:calc(28px + var(--sb)); left:50%;
  transform:translateX(-50%) translateY(16px);
  background:var(--text); color:var(--bg);
  font-size:14px; font-weight:600; padding:10px 20px;
  border-radius:var(--pill); opacity:0;
  transition:opacity .25s, transform .28s var(--spring);
  pointer-events:none; white-space:nowrap; z-index:10000;
}
#app-toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* ── CONFETTI ── */
#confetti-canvas { position:fixed; inset:0; pointer-events:none; z-index:9998; width:100%; height:100%; }

/* ── UTILS ── */
.hidden { display:none !important; }
::-webkit-scrollbar { width:3px; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:4px; }
::-webkit-scrollbar-track { background:transparent; }
