/* ===========================================================================
   Lenti's Mary Poppins Rehearsal App
   A polished, kid-friendly theme. Pure CSS, no web fonts (works offline).
   =========================================================================== */

:root {
  --cherry: #d7263d;
  --cherry-dk: #a51125;
  --navy: #20324f;
  --navy-soft: #46587a;
  --gold: #f4b942;
  --sky-1: #9fdcf2;
  --sky-2: #cdeefa;
  --sky-3: #eef9fe;
  --card: #ffffff;
  --card-2: #f7fbff;
  --line: #e4ecf5;
  --green: #2a9d52;
  --green-dk: #1c7b3e;
  --amber: #ef9d10;
  --amber-dk: #c97e00;
  --red: #e0394f;
  --red-dk: #b3132a;
  --shadow: 0 10px 30px rgba(32, 50, 79, 0.14);
  --shadow-sm: 0 4px 14px rgba(32, 50, 79, 0.12);
  --radius: 22px;
  --radius-sm: 14px;
  --maxw: 940px;
  --font: "SF Pro Rounded", ui-rounded, "Nunito", "Quicksand", system-ui,
    -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
/* Clear keyboard focus ring (only shows for keyboard users, not taps) */
button:focus-visible, a:focus-visible, input:focus-visible,
.switch:focus-visible, .listen-line:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--cherry); outline-offset: 2px; border-radius: 10px;
}
.turn-panel:focus-visible { outline: none; }   /* container gets focus, no ring needed */

html, body {
  margin: 0; padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--navy);
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 38%, var(--sky-3) 100%);
  background-attachment: fixed;
  overscroll-behavior: none;
}
body { padding-bottom: env(safe-area-inset-bottom); }

/* ---- decorative sky ---- */
.sky { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.cloud {
  position: absolute; border-radius: 100px; background: rgba(255,255,255,0.75);
  filter: blur(2px); opacity: .8;
}
.cloud::before, .cloud::after {
  content: ""; position: absolute; background: inherit; border-radius: 100px;
}
.c1 { width: 180px; height: 46px; top: 8%; left: -200px; animation: drift 70s linear infinite; }
.c1::before { width: 90px; height: 90px; top: -42px; left: 30px; }
.c1::after  { width: 70px; height: 70px; top: -30px; left: 100px; }
.c2 { width: 140px; height: 38px; top: 22%; left: -160px; animation: drift 95s linear infinite 8s; transform: scale(.8); }
.c2::before { width: 70px; height: 70px; top: -34px; left: 24px; }
.c2::after  { width: 56px; height: 56px; top: -22px; left: 78px; }
.c3 { width: 200px; height: 50px; top: 60%; left: -240px; animation: drift 120s linear infinite 20s; opacity: .55; }
.c3::before { width: 100px; height: 100px; top: -48px; left: 36px; }
.c3::after  { width: 76px; height: 76px; top: -34px; left: 116px; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(120vw); } }
.kite { position: absolute; top: 12%; right: 6%; font-size: 30px; animation: float 9s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-4deg);} 50% { transform: translateY(-16px) rotate(6deg);} }
@media (prefers-reduced-motion: reduce) {
  .cloud, .kite { animation: none !important; }
}

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.5);
}
.topbar-title { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-title .brolly { font-size: 22px; }
.topbar-title .brand {
  font-weight: 800; font-size: 17px; letter-spacing: .2px; color: var(--navy);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.iconbtn {
  border: none; background: rgba(255,255,255,0.9); color: var(--navy);
  width: 46px; height: 46px; min-width: 46px; border-radius: 14px; font-size: 22px;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .12s, background .2s;
  display: inline-flex; align-items: center; justify-content: center;
}
.iconbtn:hover { background: #fff; transform: translateY(-1px); }
.iconbtn:active { transform: scale(.94); }
.home-btn.hidden { visibility: hidden; }

/* current-user pill in the top bar (tap to change user) */
.user-pill {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.9); background: rgba(255,255,255,0.9);
  color: var(--navy); border-radius: 999px; padding: 7px 12px 7px 9px; cursor: pointer;
  box-shadow: var(--shadow-sm); font-family: inherit; font-weight: 800; font-size: 14px;
  transition: transform .12s, background .2s; max-width: 42vw;
}
.user-pill:hover { background: #fff; transform: translateY(-1px); }
.user-pill:active { transform: scale(.96); }
.user-pill .uavatar { font-size: 16px; }
.user-pill .uname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26vw; }
.user-pill .ucaret { color: var(--navy-soft); font-size: 12px; margin-left: -2px; }
.user-pill .sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* user picker screen */
.user-row { position: relative; }
.user-row.current { outline: 2px solid var(--green); }
.user-initial { background: linear-gradient(135deg, #ffd9df, #ffe9ec) !important; color: var(--cherry) !important; font-size: 18px !important; }
.cur-tag { font-size: 10.5px; font-weight: 800; color: #fff; background: var(--green); border-radius: 999px; padding: 2px 8px; margin-left: 4px; vertical-align: middle; }
.user-remove {
  border: none; background: transparent; color: var(--navy-soft); cursor: pointer;
  font-size: 15px; width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; margin-left: 2px;
}
.user-remove:hover { background: #ffe1e6; color: var(--red); }
.newuser-card {
  display: flex; gap: 10px; align-items: center;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
}
.newuser-card input {
  flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 15px;
  font-family: inherit; font-size: 17px; font-weight: 600; color: var(--navy); background: var(--card-2);
}
.newuser-card input:focus { outline: none; border-color: var(--cherry); background: #fff; }
.newuser-card .big-btn { min-height: 50px; }

/* ---- view container ---- */
.view {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto; padding: 18px 16px 60px;
}

/* ---- generic card ---- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; border: 1px solid rgba(255,255,255,0.7);
}

/* =================== HOME =================== */
.hero {
  text-align: center; margin: 6px 0 18px;
}
.hero h1 { margin: 0; font-size: 30px; font-weight: 900; color: var(--cherry); letter-spacing: .3px; }
.hero .sub { margin: 6px 0 0; color: var(--navy-soft); font-weight: 600; font-size: 15px; }
.hero .greet { margin: 12px auto 0; font-size: 19px; font-weight: 800; color: var(--navy); }

.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.mode-card {
  cursor: pointer; border: none; text-align: left; color: var(--navy);
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; transition: transform .14s, box-shadow .14s;
  display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
}
.mode-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(32,50,79,.2); }
.mode-card:active { transform: scale(.98); }
.mode-card .emoji { font-size: 34px; }
.mode-card h3 { margin: 2px 0 0; font-size: 20px; font-weight: 850; }
.mode-card p { margin: 0; color: var(--navy-soft); font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.mode-card.rehearse { background: linear-gradient(135deg, #fff 60%, #ffe9ec); }
.mode-card.listen   { background: linear-gradient(135deg, #fff 60%, #e7f4ff); }

.drill-card {
  display: flex; align-items: center; gap: 14px; margin: 4px 0 18px;
  cursor: pointer; border: none; width: 100%; text-align: left; color: var(--navy);
  background: linear-gradient(135deg, #fff 55%, #fff4d6);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px;
  transition: transform .14s;
}
.drill-card:hover { transform: translateY(-2px); }
.drill-card:active { transform: scale(.98); }
.drill-card .emoji { font-size: 30px; }
.drill-card .grow { flex: 1; }
.drill-card h3 { margin: 0; font-size: 18px; font-weight: 850; }
.drill-card p { margin: 2px 0 0; color: var(--navy-soft); font-size: 13px; font-weight: 600; }
.drill-card .badge {
  background: var(--cherry); color: #fff; font-weight: 800; font-size: 15px;
  padding: 5px 12px; border-radius: 999px; min-width: 34px; text-align: center;
}
.drill-card.empty { opacity: .6; }
.drill-card.empty .badge { background: var(--green); }

.section-label {
  display: flex; align-items: center; gap: 8px; margin: 22px 4px 10px;
  font-weight: 850; font-size: 16px; color: var(--navy);
}
.section-label .filter {
  margin-left: auto; font-size: 13px; font-weight: 700; color: var(--navy-soft);
  background: rgba(255,255,255,.8); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; cursor: pointer;
}
.section-label .filter.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.scene-grid { display: grid; grid-template-columns: 1fr; gap: 11px; }
.scene-item {
  display: flex; align-items: center; gap: 14px; cursor: pointer; border: none;
  width: 100%; text-align: left; color: var(--navy);
  background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  padding: 13px 15px; transition: transform .12s, box-shadow .12s;
}
.scene-item:hover { transform: translateX(3px); box-shadow: var(--shadow); }
.scene-item:active { transform: scale(.99); }
.scene-item.nolines { opacity: .62; }
.scene-num {
  width: 40px; height: 40px; min-width: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--sky-1), #bfe7f7); color: var(--navy);
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 15px;
}
.scene-meta { flex: 1; min-width: 0; }
.scene-meta .title { font-weight: 800; font-size: 15px; line-height: 1.25; }
.scene-meta .sub { color: var(--navy-soft); font-size: 12.5px; font-weight: 650; margin-top: 2px; }
.ring { width: 42px; height: 42px; min-width: 42px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 850; color: var(--green-dk); }
.scene-tag {
  font-size: 11px; font-weight: 800; color: var(--navy-soft);
  background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px;
}

/* =================== REHEARSAL =================== */
.rehearse-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.rehearse-head .scene-title-wrap { flex: 1; min-width: 160px; }
.rehearse-head .scene-title { font-weight: 850; font-size: 17px; }
.rehearse-head .scene-where { font-weight: 800; font-size: 12.5px; color: var(--cherry); margin-top: 2px; }
.turn-where { text-align: center; font-weight: 800; font-size: 13px; color: var(--cherry); margin-top: 2px; }
.progress-pill {
  font-size: 13px; font-weight: 800; color: var(--navy); background: rgba(255,255,255,.85);
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px;
}
.toggle-btn {
  border: 1px solid var(--line); background: rgba(255,255,255,.9); color: var(--navy);
  border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: 13.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.toggle-btn.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* transcript area */
.stage { min-height: 50vh; }
.stage-more { text-align: center; color: var(--navy-soft); font-weight: 800; letter-spacing: 3px; opacity: .5; margin: 6px 0; }
.bubble {
  display: flex; gap: 12px; margin: 12px 0; align-items: flex-start;
  opacity: .55; transition: opacity .25s, transform .25s;
}
.bubble.active { opacity: 1; }
.bubble.past { opacity: .42; }
.bubble.mary { flex-direction: row-reverse; }
.avatar {
  width: 46px; height: 46px; min-width: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  box-shadow: var(--shadow-sm); border: 3px solid #fff;
}
.bubble-body { max-width: 78%; }
.bubble.mary .bubble-body { text-align: right; }
.speaker-name {
  font-weight: 850; font-size: 13px; margin-bottom: 3px; display: inline-flex; gap: 6px; align-items: center;
}
.kind-chip { font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); color: var(--navy-soft); }
.line-text {
  background: var(--card); border-radius: 16px; padding: 11px 15px; box-shadow: var(--shadow-sm);
  font-size: 17px; line-height: 1.5; font-weight: 550; border: 1px solid rgba(255,255,255,.7);
}
.bubble.mary .line-text { background: linear-gradient(135deg, #fff, #ffe9ec); border-color: #ffd3d9; }
.line-text.dir { background: transparent; box-shadow: none; border: 1px dashed var(--line); font-style: italic; color: var(--navy-soft); font-size: 14.5px; }
.line-text .stagedir { color: var(--navy-soft); font-style: italic; font-weight: 600; }
.line-text.hidden-text { color: transparent; user-select: none; }
.song-icon { color: var(--cherry); }
.now-playing-eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; margin-left: 4px; }
.now-playing-eq i { width: 3px; background: var(--cherry); border-radius: 2px; animation: eq .9s ease-in-out infinite; }
.now-playing-eq i:nth-child(2){ animation-delay:.2s } .now-playing-eq i:nth-child(3){ animation-delay:.4s }
@keyframes eq { 0%,100%{height:4px} 50%{height:12px} }

/* Mary's turn panel */
.turn-panel {
  position: sticky; bottom: 0; z-index: 20;
  margin: 14px -16px -60px; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 2px solid #ffd3d9; border-radius: 26px 26px 0 0; box-shadow: 0 -10px 30px rgba(32,50,79,.14);
}
.turn-cue {
  text-align: center; font-weight: 900; font-size: 20px; color: var(--cherry);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.mic-pulse { font-size: 26px; animation: micpulse 1.3s ease-in-out infinite; }
@keyframes micpulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.18)} }
.turn-hint { text-align: center; color: var(--navy-soft); font-weight: 650; font-size: 14px; margin-top: 4px; }
.reveal-box {
  margin: 12px 0; padding: 14px 16px; border-radius: 16px; background: linear-gradient(135deg,#fff,#ffe9ec);
  border: 1px solid #ffd3d9; font-size: 19px; line-height: 1.5; font-weight: 600; text-align: center; min-height: 30px;
}
.reveal-box .masked { letter-spacing: 1px; color: var(--navy-soft); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.big-btn {
  border: none; border-radius: 16px; padding: 14px 20px; font-size: 16px; font-weight: 850;
  cursor: pointer; color: #fff; box-shadow: var(--shadow-sm); transition: transform .1s, filter .15s;
  display: inline-flex; align-items: center; gap: 8px; min-height: 52px;
}
.big-btn:active { transform: scale(.96); }
.big-btn .key { font-size: 11px; font-weight: 800; opacity: .8; background: rgba(255,255,255,.25); padding: 2px 6px; border-radius: 6px; }
.big-btn.primary { background: linear-gradient(135deg, var(--cherry), var(--cherry-dk)); }
.big-btn.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.big-btn.hint { background: linear-gradient(135deg, var(--gold), var(--amber-dk)); color: var(--navy); }
.big-btn.rec { background: linear-gradient(135deg, #6a4c93, #4a2f6e); }
.big-btn.rec.recording { background: linear-gradient(135deg, var(--red), var(--red-dk)); animation: recblink 1s ease-in-out infinite; }
@keyframes recblink { 0%,100%{filter:brightness(1)} 50%{filter:brightness(1.25)} }
.rate-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.rate-btn {
  border: none; border-radius: 16px; padding: 14px 8px; font-weight: 850; font-size: 15px; cursor: pointer;
  color: #fff; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform .1s; min-height: 64px;
}
.rate-btn:active { transform: scale(.95); }
.rate-btn .em { font-size: 22px; }
.rate-btn .key { font-size: 11px; opacity: .85; }
.rate-btn.got { background: linear-gradient(135deg, var(--green), var(--green-dk)); }
.rate-btn.almost { background: linear-gradient(135deg, var(--amber), var(--amber-dk)); }
.rate-btn.missed { background: linear-gradient(135deg, var(--red), var(--red-dk)); }

/* finished screen */
.finished { text-align: center; padding: 40px 16px; }
.finished .big { font-size: 60px; }
.finished h2 { font-size: 26px; margin: 8px 0; color: var(--cherry); }
.finished p { color: var(--navy-soft); font-weight: 650; }
.finished .stats { display: flex; gap: 14px; justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.finished .stat { background: var(--card); border-radius: 16px; padding: 14px 20px; box-shadow: var(--shadow-sm); min-width: 92px; }
.finished .stat .n { font-size: 28px; font-weight: 900; }
.finished .stat .l { font-size: 12px; font-weight: 700; color: var(--navy-soft); }

/* =================== LISTEN =================== */
.listen-controls {
  position: sticky; bottom: 0; z-index: 20; margin: 0 -16px -60px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 24px rgba(32,50,79,.12);
  display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.listen-controls .round {
  width: 56px; height: 56px; border-radius: 50%; border: none; font-size: 24px; cursor: pointer;
  background: linear-gradient(135deg, var(--cherry), var(--cherry-dk)); color: #fff; box-shadow: var(--shadow-sm);
}
.listen-controls .round.sm { width: 46px; height: 46px; font-size: 19px; background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.listen-controls .round:active { transform: scale(.93); }
.speed-btn, .loop-btn {
  border: 1.5px solid var(--line); background: #fff; color: var(--navy); border-radius: 999px;
  padding: 9px 14px; font-weight: 800; font-size: 13.5px; cursor: pointer;
}
.loop-btn.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.listen-line {
  display: flex; gap: 11px; align-items: flex-start; padding: 9px 10px; border-radius: 14px; cursor: pointer;
  transition: background .2s; margin: 2px 0;
}
.listen-line:hover { background: rgba(255,255,255,.55); }
.listen-line.active { background: #fff; box-shadow: var(--shadow-sm); }
.listen-line.mary .ltext { font-weight: 800; }
.listen-line .ltext { font-size: 16px; line-height: 1.5; }
.listen-line.dir .ltext { font-style: italic; color: var(--navy-soft); font-size: 14px; }
.listen-line.heading { justify-content: center; }
.listen-line.heading .ltext { font-weight: 900; color: var(--cherry); text-transform: uppercase; letter-spacing: .5px; font-size: 13px; }
.lspk { font-weight: 850; font-size: 12.5px; }

/* =================== SETTINGS DRAWER =================== */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(32,50,79,.4); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 88vw); z-index: 50;
  background: #fff; box-shadow: -10px 0 40px rgba(32,50,79,.25);
  display: flex; flex-direction: column; animation: slidein .25s ease;
  padding-top: env(safe-area-inset-top);
}
@keyframes slidein { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-head { display: flex; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; flex: 1; font-size: 19px; }
.drawer-body { padding: 16px; overflow-y: auto; }
.setting { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting .label { flex: 1; }
.setting .label .t { font-weight: 800; font-size: 15px; }
.setting .label .d { font-size: 12.5px; color: var(--navy-soft); font-weight: 600; }
.switch { width: 54px; height: 32px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; border: none; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: left .2s; }
.switch.on { background: var(--green); }
.switch.on::after { left: 25px; }
.seg { display: inline-flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { border: none; background: transparent; padding: 8px 12px; font-weight: 800; font-size: 13px; cursor: pointer; color: var(--navy-soft); }
.seg button.on { background: var(--navy); color: #fff; }
.danger-btn { width: 100%; margin-top: 16px; border: 1.5px solid var(--red); color: var(--red); background: #fff; border-radius: 14px; padding: 12px; font-weight: 800; cursor: pointer; }

/* =================== BOOT / FX =================== */
.boot { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--sky-1), var(--sky-3)); transition: opacity .4s; }
.boot.hide { opacity: 0; pointer-events: none; }
.boot-card { text-align: center; }
.brolly-spin { font-size: 60px; animation: float 3s ease-in-out infinite; }
.boot p { font-weight: 800; color: var(--navy); margin-top: 12px; }
.boot.error .brolly-spin { animation: none; }
.boot.error p { color: var(--cherry); max-width: 460px; padding: 0 20px; line-height: 1.5; }

.fx-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.confetti { position: absolute; font-size: 22px; animation: fall 1.7s ease-in forwards; }
@keyframes fall { 0% { transform: translateY(-30px) rotate(0); opacity: 1; } 100% { transform: translateY(105vh) rotate(540deg); opacity: 0; } }

/* confirmation modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(32,50,79,.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: modalfade .15s ease;
}
@keyframes modalfade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 24px; box-shadow: var(--shadow);
  max-width: 380px; width: 100%; padding: 24px 22px; text-align: center; animation: modalpop .18s ease;
}
@keyframes modalpop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-emoji { font-size: 44px; line-height: 1; }
.modal h3 { margin: 8px 0 6px; font-size: 21px; color: var(--navy); }
.modal p { margin: 0 0 18px; color: var(--navy-soft); font-weight: 600; font-size: 15px; line-height: 1.45; }
.modal-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-btns .big-btn { flex: 1; min-width: 120px; justify-content: center; }
.big-btn.danger { background: linear-gradient(135deg, var(--red), var(--red-dk)); color: #fff; }
.modal-input {
  width: 100%; box-sizing: border-box; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-family: inherit; font-size: 13px; color: var(--navy); background: var(--card-2);
  resize: vertical; margin-bottom: 14px; word-break: break-all;
}
.modal-input:focus { outline: none; border-color: var(--cherry); background: #fff; }

/* settings: backup & transfer */
.backup-setting { border-bottom: none !important; padding-bottom: 4px; }
.backup-btns { display: flex; gap: 10px; margin: 0 0 8px; }
.backup-btns .big-btn { flex: 1; justify-content: center; min-height: 48px; font-size: 14px; }
.backup-codes { display: flex; gap: 14px; justify-content: center; margin: 0 0 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.link-btn { border: none; background: none; color: var(--navy-soft); font-weight: 700; font-size: 13px; cursor: pointer; text-decoration: underline; padding: 4px; }
.link-btn:hover { color: var(--cherry); }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 800;
  z-index: 70; opacity: 0; transition: opacity .25s, transform .25s; box-shadow: var(--shadow); font-size: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* =================== RESPONSIVE =================== */
@media (min-width: 720px) {
  .scene-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 36px; }
}
@media (max-width: 380px) {
  .mode-row { grid-template-columns: 1fr; }
  .topbar-title .brand { font-size: 15px; }
  .line-text { font-size: 16px; }
}
