/* ============================================================
   ANCESTOR CALENDAR
   Apple-premium visual system: deep space black, soft glass,
   champagne accent, pill buttons, calm typography.
   ============================================================ */

:root {
  --bg:          #050506;
  --panel:       rgba(255, 255, 255, 0.055);
  --panel-2:     rgba(255, 255, 255, 0.03);
  --line:        rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  --accent:      #e9c37e;
  --accent-hi:   #f6dfae;
  --accent-deep: #b9924e;
  --ember:       #ff6b52;
  --jade:        #4fd1a5;
  --blood:       #ff453a;

  --text:        #f5f5f7;
  --text-2:      #c7c7cc;
  --text-muted:  #a1a1a6;
  --text-faint:  #6e6e73;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Helvetica Neue", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;

  --radius: 24px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-drama: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px 20px;
}

body.shaking { animation: worldShake 0.5s cubic-bezier(.36,.07,.19,.97) both; }

/* ---------- Ambient background ---------- */
.stars, .aurora, .grain { position: fixed; inset: 0; pointer-events: none; }
.stars {
  background-image:
    radial-gradient(1.2px 1.2px at 14% 20%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 76% 12%, rgba(255,255,255,.25), transparent),
    radial-gradient(1.4px 1.4px at 34% 74%, rgba(233,195,126,.3), transparent),
    radial-gradient(1px 1px at 62% 46%, rgba(255,255,255,.2), transparent),
    radial-gradient(1.3px 1.3px at 88% 68%, rgba(233,195,126,.25), transparent);
  z-index: 0;
}
.aurora {
  background:
    radial-gradient(900px 620px at 20% -12%, rgba(233,195,126,.09), transparent 60%),
    radial-gradient(820px 700px at 88% 8%, rgba(96,90,160,.10), transparent 60%),
    radial-gradient(1000px 780px at 50% 112%, rgba(255,107,82,.05), transparent 60%);
  animation: drift 26s ease-in-out infinite alternate;
  z-index: 0;
}
.grain {
  opacity: .025; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(-2%, 2%, 0) scale(1.06); }
}

/* ---------- Screens ---------- */
.screen {
  display: none;
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1120px;
  animation: screenIn .7s var(--ease-drama) both;
}
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(22px) scale(.99); filter: blur(5px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

/* ---------- Glass panels ---------- */
.glass {
  width: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.028));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  box-shadow:
    0 32px 90px -30px rgba(0,0,0,.85),
    0 1px 0 rgba(255,255,255,.08) inset;
  padding: 48px 44px;
  position: relative;
  overflow: hidden;
}

.onboard, .profile, .math, .ask { max-width: 600px; margin: 0 auto; text-align: center; }
.event { max-width: 760px; margin: 0 auto; }

/* ---------- Typography ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: .85;
  margin-bottom: 16px;
}
.display {
  font-weight: 700;
  font-size: clamp(26px, 3.6vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 14px;
}
.lead {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  max-width: 52ch;
  margin: 0 auto 26px;
}
.lead strong { color: var(--accent-hi); font-weight: 600; }
.fineprint {
  margin-top: 20px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-faint);
}

/* ---------- Loading screen ---------- */
.loader-wrap { text-align: center; max-width: 560px; margin: 0 auto; }
.sigil {
  position: relative; width: 110px; height: 110px; margin: 0 auto 32px;
  display: grid; place-items: center;
}
.sigil-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.08);
}
.sigil-ring.r1 { border-top-color: var(--accent); animation: spin 2.8s cubic-bezier(.4,.1,.6,.9) infinite; }
.sigil-ring.r2 { inset: 16px; border-right-color: rgba(233,195,126,.45); animation: spin 2s linear infinite reverse; }
.sigil-ring.r3 { inset: 32px; border-bottom-color: rgba(255,255,255,.25); animation: spin 4.2s linear infinite; }
.sigil-core {
  font-size: 30px; color: var(--accent-hi);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:.55; transform: scale(1);} 50% { opacity:1; transform: scale(1.1);} }

.brand-title {
  font-weight: 700;
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 20%, rgba(255,255,255,.55));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-title .tm { font-size: .38em; vertical-align: super; letter-spacing: 0; }

.brand-sub {
  font-size: 14px; letter-spacing: -0.01em;
  color: var(--text-faint); margin-top: 10px;
}

.loader-lines {
  margin: 38px auto 24px;
  min-height: 88px;
  display: flex; flex-direction: column; gap: 10px;
  font-family: var(--mono); font-size: 12.5px;
  color: var(--text-muted);
  text-align: left; max-width: 400px;
}
.loader-lines .line {
  display: flex; align-items: center; gap: 10px;
  animation: lineIn .45s var(--ease) both;
}
.loader-lines .line .tick { color: var(--jade); font-weight: 600; }
.loader-lines .line.pending .tick { color: var(--accent); }
.loader-lines .line.done { color: var(--text-faint); }
@keyframes lineIn { from { opacity:0; transform: translateX(-10px);} to {opacity:1; transform:none;} }

.loader-bar {
  width: min(400px, 100%); height: 3px; margin: 0 auto;
  background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden;
}
.loader-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent-hi));
  border-radius: 99px;
  transition: width .5s var(--ease);
}
.loader-hint {
  margin-top: 18px; font-size: 12.5px; color: var(--text-faint);
  min-height: 1.4em;
}

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 18px; text-align: left; margin-top: 8px; }
.form-two { grid-template-columns: 1fr 1fr; }
.span-2 { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label {
  font-size: 12.5px; font-weight: 600; letter-spacing: -0.005em;
  color: var(--text-2);
}
.input {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 15px 17px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  letter-spacing: -0.01em;
  transition: all .25s var(--ease);
  outline: none;
}
.input::placeholder { color: var(--text-faint); }
.input:focus {
  background: rgba(255,255,255,.09);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(233,195,126,.15);
}
select.input { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%), linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% + 1px), calc(100% - 14px) calc(50% + 1px);
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
select.input option { background: #1c1c1e; color: var(--text); }
textarea.input { resize: vertical; line-height: 1.5; }

.input-math {
  font-family: var(--mono); font-size: 28px; font-weight: 600; text-align: center;
  letter-spacing: .06em; padding: 18px;
}

/* Importance selector */
.importance { display: flex; gap: 8px; flex-wrap: wrap; }
.imp-opt {
  flex: 1; min-width: 108px;
  background: rgba(255,255,255,.05);
  border: 1px solid transparent;
  border-radius: 12px; padding: 12px 8px;
  color: var(--text-muted);
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; letter-spacing: -0.005em;
  cursor: pointer; transition: all .22s var(--ease);
}
.imp-opt:hover { background: rgba(255,255,255,.09); color: var(--text); }
.imp-opt.active {
  background: rgba(233,195,126,.16);
  border-color: rgba(233,195,126,.5);
  color: var(--accent-hi);
}

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 15px 30px;
  font-family: var(--sans);
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer;
  overflow: hidden;
  transition: transform .22s var(--ease), box-shadow .3s var(--ease), background .25s var(--ease), opacity .25s var(--ease);
  background: transparent; color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 10px 18px; font-size: 13px; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent) 55%, var(--accent-deep));
  color: #201709;
  border-color: transparent;
  box-shadow: 0 8px 26px -10px rgba(233,195,126,.7);
}
.btn-primary:hover { box-shadow: 0 12px 34px -10px rgba(233,195,126,.85); filter: brightness(1.04); }

.btn-ghost { background: rgba(255,255,255,.07); color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,.12); color: var(--text); }

.btn-drop {
  font-size: 16px; padding: 18px 46px;
  animation: breathe 2.8s ease-in-out infinite;
}
@keyframes breathe {
  0%,100% { box-shadow: 0 8px 26px -10px rgba(233,195,126,.6), 0 0 0 0 rgba(233,195,126,.25); }
  50%     { box-shadow: 0 12px 38px -8px rgba(233,195,126,.9), 0 0 0 12px rgba(233,195,126,0); }
}

/* The big ancestral button */
.btn-ancestor {
  position: relative;
  width: 100%; padding: 28px;
  border-radius: 22px;
  border: 1px solid rgba(233,195,126,.4);
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(233,195,126,.14), transparent 60%),
    rgba(255,255,255,.05);
  cursor: pointer; overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .35s var(--ease);
  box-shadow: 0 0 50px -22px rgba(233,195,126,.8);
}
.btn-ancestor:hover { transform: translateY(-2px); box-shadow: 0 0 70px -18px rgba(233,195,126,.95); }
.btn-ancestor:disabled { opacity: .6; cursor: wait; transform: none; }
.ask-label {
  position: relative; z-index: 2;
  font-weight: 700;
  font-size: clamp(17px, 2.5vw, 23px); letter-spacing: -0.02em;
  color: var(--accent-hi);
}
.ask-glow {
  position: absolute; inset: -50%;
  background: conic-gradient(from 0deg, transparent, rgba(233,195,126,.18), transparent 40%);
  animation: spin 5s linear infinite;
}
.link-btn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font: inherit; font-size: 12px;
  text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent-hi); }

/* ---------- Profile ---------- */
.profile-crest {
  font-size: 52px; line-height: 1; margin-bottom: 18px;
  filter: drop-shadow(0 6px 24px rgba(233,195,126,.45));
  animation: crestIn .9s var(--ease-drama) both;
}
@keyframes crestIn {
  from { opacity:0; transform: scale(.4) rotate(-18deg); }
  to { opacity:1; transform: none; }
}
.profile-body {
  font-size: 17px; line-height: 1.6; color: var(--text-2);
  letter-spacing: -0.01em;
  background: rgba(255,255,255,.045);
  border-radius: 16px;
  padding: 20px 22px;
  text-align: left;
  margin: 8px 0 22px;
}
.profile-traits { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 28px; }
.trait {
  font-size: 12px; font-weight: 600; letter-spacing: -0.005em;
  padding: 8px 14px; border-radius: 99px;
  background: rgba(233,195,126,.12);
  color: var(--accent-hi);
}

/* ---------- Physics board ---------- */
.physics-layout { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.physics-head { text-align: center; }
.board-frame {
  position: relative;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
  box-shadow: 0 32px 90px -35px rgba(0,0,0,.9);
  padding: 10px;
  overflow: hidden;
}
#physics-canvas { display: block; border-radius: 18px; max-width: 100%; height: auto; cursor: crosshair; touch-action: none; }

.board-verdict {
  position: absolute; inset: 0;
  display: none; place-items: center;
  background: rgba(5,5,6,.88);
  backdrop-filter: blur(10px);
  text-align: center; padding: 20px;
  border-radius: 26px;
}
.board-verdict.show { display: grid; animation: verdictIn .8s var(--ease-drama) both; }
@keyframes verdictIn {
  from { opacity: 0; transform: scale(1.1); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
.verdict-kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.verdict-date {
  font-weight: 700;
  font-size: clamp(30px, 5vw, 54px);
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 25%, rgba(255,255,255,.5));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  line-height: 1.1;
}
.verdict-sub { color: var(--text-muted); margin-top: 12px; font-size: 15px; }

.physics-controls { text-align: center; }
.physics-note { margin-top: 14px; font-size: 12.5px; color: var(--text-faint); }

/* ---------- Math ---------- */
.date-badge {
  display: inline-block;
  font-weight: 700; font-size: 19px; letter-spacing: -0.02em;
  color: var(--accent-hi);
  border-radius: 99px;
  padding: 10px 24px; margin-bottom: 18px;
  background: rgba(233,195,126,.13);
}
.math-challenge { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.math-equation {
  font-family: var(--mono); font-size: 36px; font-weight: 600;
  color: var(--text); letter-spacing: -0.01em;
}
.math-equation sup { font-size: .5em; color: var(--accent); }
.math-analyzing {
  min-height: 26px; margin-top: 18px;
  font-family: var(--mono); font-size: 12.5px; color: var(--jade);
  letter-spacing: .02em;
}
.math-analyzing .ok { color: var(--jade); }

/* ---------- Verdict / Ask ---------- */
.verdict { margin-top: 30px; animation: screenIn .7s var(--ease-drama) both; }
.verdict-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.score-card {
  border-radius: 18px; padding: 20px;
  background: rgba(255,255,255,.05);
  text-align: left;
}
.score-card .k {
  font-size: 12px; font-weight: 600; letter-spacing: -0.005em;
  color: var(--text-faint); margin-bottom: 8px;
}
.score-card .v {
  font-weight: 700; font-size: 34px; letter-spacing: -0.03em; color: var(--text);
}
.score-card .v small { font-size: .45em; color: var(--text-faint); font-weight: 600; }
.meter { height: 6px; border-radius: 99px; background: rgba(255,255,255,.09); margin-top: 12px; overflow: hidden; }
.meter i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--ember), var(--accent), var(--jade));
  border-radius: 99px;
  transition: width 1.3s var(--ease-drama);
}
.reasons { list-style: none; margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.reasons li { font-size: 13px; color: var(--text-muted); display: flex; gap: 8px; letter-spacing: -0.005em; }
.reasons li.plus::before { content: '+'; color: var(--jade); font-weight: 700; }
.reasons li.minus::before { content: '−'; color: var(--ember); font-weight: 700; }

.verdict-message {
  font-size: 16.5px; line-height: 1.6; letter-spacing: -0.01em;
  color: var(--text-2); text-align: left; white-space: pre-wrap;
  border-radius: 18px;
  padding: 24px 26px;
  background: rgba(255,255,255,.05);
}
.verdict-extra { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; justify-content: center; }
.chip {
  font-size: 12px; font-weight: 600; letter-spacing: -0.005em;
  padding: 8px 15px; border-radius: 99px;
  background: rgba(233,195,126,.12); color: var(--accent-hi);
}
.chip.wisdom { color: var(--jade); background: rgba(79,209,165,.12); }
.chip.warn { color: var(--ember); background: rgba(255,107,82,.12); }
.verdict-actions { display: flex; gap: 12px; margin-top: 24px; justify-content: center; flex-wrap: wrap; }

.historical {
  font-size: 15px; line-height: 1.6;
  color: var(--text-muted); margin-top: 16px; padding: 16px 20px;
  border-radius: 14px;
  background: rgba(255,107,82,.07);
  text-align: left;
  white-space: pre-wrap;
  width: 100%;
}

/* ---------- Calendar view ---------- */
.cal-wrap { width: 100%; }
.cal-header {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  flex-wrap: wrap; margin-bottom: 26px;
}
.cal-stats { display: flex; gap: 12px; }
.stat {
  border-radius: 18px; padding: 16px 24px;
  background: rgba(255,255,255,.05); text-align: center; min-width: 130px;
}
.stat-num {
  font-weight: 700; font-size: 32px; letter-spacing: -0.03em; color: var(--text);
}
.stat-label {
  font-size: 11.5px; font-weight: 600;
  color: var(--text-faint); margin-top: 4px;
}
.cal-toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap; margin-bottom: 24px;
  padding-bottom: 22px; border-bottom: 1px solid var(--line);
}
.streak-note { color: var(--text-muted); font-size: 14px; letter-spacing: -0.005em; }
.streak-note strong { color: var(--accent-hi); }

.events-list { display: grid; gap: 12px; }
.event-card {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 20px; align-items: center;
  border-radius: 20px; padding: 20px 24px;
  background: rgba(255,255,255,.05);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .25s var(--ease);
  animation: cardIn .5s var(--ease-drama) both;
}
.event-card:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(233,195,126,.35);
  transform: translateY(-2px);
  box-shadow: 0 16px 44px -22px rgba(0,0,0,.8);
}
@keyframes cardIn { from { opacity:0; transform: translateY(14px);} to {opacity:1; transform:none;} }
.ec-date { text-align: center; border-right: 1px solid var(--line); padding-right: 18px; }
.ec-day { font-weight: 700; font-size: 30px; letter-spacing: -0.03em; color: var(--text); line-height: 1; }
.ec-mon { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); margin-top: 6px; }
.ec-title { font-weight: 600; font-size: 17px; letter-spacing: -0.015em; color: var(--text); }
.ec-meta { font-size: 13px; color: var(--text-muted); margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }
.ec-meta span { display: inline-flex; gap: 5px; align-items: center; }
.ec-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.diff {
  font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 99px;
}
.diff.easy { color: var(--jade); background: rgba(79,209,165,.13); }
.diff.moderate { color: var(--accent); background: rgba(233,195,126,.13); }
.diff.hard { color: #ff9f0a; background: rgba(255,159,10,.13); }
.diff.legendary {
  color: #fff;
  background: linear-gradient(90deg, #d64533, var(--ember));
  animation: legendaryPulse 1.8s ease-in-out infinite;
}
@keyframes legendaryPulse { 0%,100% { filter: brightness(1);} 50% { filter: brightness(1.3);} }
.approval-mini { font-size: 12px; color: var(--text-faint); }
.approval-mini b { color: var(--text); }

.events-empty {
  text-align: center; padding: 70px 20px;
  border: 1px dashed var(--line-strong); border-radius: 22px;
  color: var(--text-muted); font-size: 16px;
}
.empty-crest { font-size: 40px; margin-bottom: 14px; opacity: .5; }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(14px);
  padding: 20px;
  animation: fadeIn .25s var(--ease) both;
}
.modal-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.modal {
  position: relative;
  width: 100%; max-width: 560px;
  background: rgba(28,28,30,.95);
  backdrop-filter: blur(30px);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 36px;
  text-align: center;
  animation: modalIn .5s var(--ease-drama) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.88) translateY(20px); }
  to { opacity: 1; transform: none; }
}
.modal.reject {
  border-color: rgba(255,69,58,.45);
  box-shadow: 0 0 90px -25px rgba(255,69,58,.8);
}
.modal.detail {
  max-width: 620px; text-align: left;
  box-shadow: 0 32px 90px -30px rgba(0,0,0,.9);
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.08);
  color: var(--text-muted); cursor: pointer; font-size: 13px;
  transition: all .2s var(--ease);
}
.modal-close:hover { color: var(--text); background: rgba(255,255,255,.15); }

.reject-flash {
  position: absolute; inset: 0; border-radius: 26px; pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(255,69,58,.3), transparent 70%);
  animation: flash 1.1s ease-out 2;
}
@keyframes flash { 0%,100% { opacity: .2 } 50% { opacity: 1 } }
.reject-title {
  font-weight: 700;
  font-size: clamp(19px, 3.2vw, 26px); letter-spacing: -0.02em;
  color: var(--ember);
  margin-bottom: 8px;
}
.reject-sub {
  font-size: 16px;
  color: var(--text-2); margin-bottom: 20px;
}
.video-wrap {
  position: relative;
  width: 100%; aspect-ratio: 16/9;
  border-radius: 16px; overflow: hidden;
  background: #000;
  margin-bottom: 22px;
}
.video-wrap iframe { position: relative; z-index: 2; }
.video-fallback {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-items: center; align-content: center; gap: 10px;
  color: var(--text-muted); font-size: 15px;
  text-align: center;
}
.rr-face { font-size: 48px; animation: dance 1s ease-in-out infinite alternate; }
@keyframes dance {
  from { transform: rotate(-12deg) translateY(0); }
  to { transform: rotate(12deg) translateY(-8px); }
}
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.shake-target { animation: modalIn .5s var(--ease-drama) both, shakeHard .55s cubic-bezier(.36,.07,.19,.97) .1s 2 both; }
@keyframes shakeHard {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
  40%, 60% { transform: translate3d(8px, 0, 0); }
}
@keyframes worldShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(6px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-10px, 0, 0); }
  40%, 60% { transform: translate3d(10px, 0, 0); }
}

/* Detail modal internals */
.detail-title { font-weight: 700; font-size: 23px; letter-spacing: -0.02em; color: var(--text); margin-bottom: 6px; }
.detail-sub { font-size: 13px; color: var(--text-faint); margin-bottom: 20px; }
.detail-rows { display: grid; gap: 12px; margin-bottom: 20px; }
.detail-row { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: start; font-size: 14px; }
.detail-row .k { font-size: 12px; font-weight: 600; color: var(--text-faint); padding-top: 2px; }
.detail-row .v { color: var(--text-2); line-height: 1.5; }
.detail-msg {
  font-size: 15px; line-height: 1.6;
  color: var(--text-2); white-space: pre-wrap;
  background: rgba(255,255,255,.05); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 18px;
}
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-danger { color: var(--ember); background: rgba(255,69,58,.12); border-color: transparent; }
.btn-danger:hover { background: rgba(255,69,58,.22); }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; top: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 340px; pointer-events: none;
}
.toast {
  border-radius: 16px;
  padding: 14px 18px;
  background: rgba(40,40,44,.9);
  backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  box-shadow: 0 16px 44px -20px rgba(0,0,0,.85);
  animation: toastIn .5s var(--ease-drama) both;
}
.toast.out { animation: toastOut .45s var(--ease) both; }
.toast .t-title {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 4px;
}
.toast .t-body { font-size: 13.5px; line-height: 1.45; color: var(--text-2); letter-spacing: -0.005em; }
@keyframes toastIn { from { opacity: 0; transform: translateX(110%) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(110%) scale(.92); } }

/* ---------- Settings ---------- */
.settings-fab {
  position: fixed; bottom: 20px; right: 20px; z-index: 90;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(40,40,44,.85); backdrop-filter: blur(18px);
  color: var(--text-2); font-size: 17px; cursor: pointer;
  transition: all .3s var(--ease);
}
.settings-fab:hover { transform: rotate(60deg) scale(1.06); color: var(--accent); }
.settings-panel {
  position: fixed; bottom: 78px; right: 20px; z-index: 90;
  width: min(350px, calc(100vw - 40px));
  border: 1px solid var(--line); border-radius: 20px;
  background: rgba(28,28,30,.96); backdrop-filter: blur(28px);
  padding: 24px;
  box-shadow: 0 26px 80px -25px rgba(0,0,0,.9);
  animation: screenIn .35s var(--ease) both;
}
.settings-panel[hidden] { display: none; }
.settings-panel h4 {
  font-size: 16px; font-weight: 700; letter-spacing: -0.015em;
  color: var(--text); margin-bottom: 8px;
}
.settings-note { font-size: 12.5px; line-height: 1.55; color: var(--text-muted); margin-bottom: 16px; }
.settings-note a { color: var(--accent); }
.settings-actions { display: flex; gap: 8px; margin-top: 14px; }
.settings-status { margin-top: 10px; font-family: var(--mono); font-size: 11px; color: var(--jade); min-height: 1.2em; }

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
  body { padding: 16px 12px; }
  .glass { padding: 32px 22px; }
  .form-two { grid-template-columns: 1fr; }
  .verdict-scores { grid-template-columns: 1fr; }
  .event-card { grid-template-columns: 64px 1fr; }
  .ec-right { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; }
  .cal-header { align-items: flex-start; }
  .cal-stats { width: 100%; }
  .stat { flex: 1; min-width: 0; }
  .toasts { top: auto; bottom: 78px; right: 12px; left: 12px; max-width: none; }
  .detail-row { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
