/* ==========================================================================
   GP.OS secrets — HUD chip, secrets panel, vault, hacker terminal,
   screensaver, self-destruct, gravity banner and one-off effect classes.
   ========================================================================== */

/* ----------------------------------------------------------- page states */
html.sec-lock,
html.sec-lock body {
  overflow: hidden;
}

/* iOS Safari never dispatches a (document-delegated) `click` for a tap on a
   non-interactive element unless it or an ancestor has cursor:pointer, so the
   name-shatter and time-warp hotspots were dead on iPhone/iPad. Touch-only, so
   a desktop hover cursor doesn't give the secrets away. */
@media (hover: none), (pointer: coarse) {
  #hero-name[data-secret],
  #hud-clock[data-secret] {
    cursor: pointer;
    touch-action: manipulation; /* rapid taps are clicks, not a double-tap zoom */
    -webkit-tap-highlight-color: transparent;
  }
}

/* "flip": the whole page turns upside down around the viewport centre */
html.sec-flipping {
  transform-origin: 50% var(--sec-flip-oy, 50vh);
  transition: transform 0.9s var(--ease-in-out);
}
html.sec-flipped {
  transform: rotate(180deg);
}

/* "barrel roll" on #app (transform-origin set inline to the viewport centre) */
/* !important: these one-off effects must win over any id-level animation
   other modules put on #app / #hero-name / #hud-clock. */
.sec-barrel {
  animation: sec-barrel 1.2s var(--ease-in-out) both !important;
}
@keyframes sec-barrel {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(0.86); }
  100% { transform: rotate(360deg) scale(1); }
}

/* time warp: brief hue sweep over the whole page */
html.sec-hue {
  animation: sec-hue 1.6s ease-in-out both;
}
@keyframes sec-hue {
  0% { filter: none; }
  30% { filter: hue-rotate(150deg) saturate(1.7) contrast(1.1); }
  65% { filter: hue-rotate(290deg) saturate(1.4); }
  100% { filter: hue-rotate(360deg); }
}

.sec-timewarp {
  color: var(--magenta) !important;
  text-shadow: 2px 0 var(--cyan), -2px 0 var(--magenta), 0 0 14px rgba(255, 43, 214, 0.85) !important;
  animation: sec-jitter 0.16s steps(2) infinite !important;
}
.sec-warp-readout {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.14em;
  white-space: nowrap;
}
@keyframes sec-jitter {
  0% { translate: 0 0; }
  50% { translate: 1px -1px; }
  100% { translate: -1px 1px; }
}

/* name shatter: clip-path slices + RGB split, then it reassembles.
   Uses the individual translate/rotate/scale properties so it composes with
   whatever transform the element already has. */
.sec-shatter {
  animation: sec-shatter 1.45s var(--ease-out) both !important;
}
@keyframes sec-shatter {
  0% { clip-path: inset(0 0 0 0); translate: 0 0; rotate: 0deg; scale: 1; opacity: 1; filter: none; }
  5% { clip-path: inset(8% 0 64% 0); translate: -22px -6px; rotate: -2deg; filter: drop-shadow(4px 0 #ff2bd6) drop-shadow(-4px 0 #00f0ff); }
  10% { clip-path: inset(46% 0 24% 0); translate: 26px 8px; rotate: 2deg; }
  15% { clip-path: inset(74% 0 2% 0); translate: -34px 16px; rotate: -4deg; opacity: 0.85; }
  20% { clip-path: inset(0 0 82% 0); translate: 40px -20px; rotate: 6deg; opacity: 0.7; }
  27% { clip-path: inset(30% 0 42% 0); translate: -48px 22px; rotate: -8deg; scale: 1.08; opacity: 0.45; }
  36% { clip-path: inset(86% 0 0 0); translate: 12px 44px; rotate: 10deg; opacity: 0.18; }
  50% { clip-path: inset(0 0 0 0); translate: 0 0; rotate: 0deg; scale: 0.7; opacity: 0; filter: blur(8px); }
  66% { clip-path: inset(38% 0 38% 0); scale: 1.22; opacity: 0.6; filter: blur(2px) drop-shadow(0 0 18px rgba(var(--accent-rgb), 0.9)); }
  80% { clip-path: inset(0 0 0 0); scale: 0.97; opacity: 1; filter: drop-shadow(0 0 22px rgba(var(--accent-rgb), 0.8)); }
  100% { clip-path: inset(0 0 0 0); translate: 0 0; rotate: 0deg; scale: 1; opacity: 1; filter: none; }
}

.sec-shards {
  position: fixed;
  z-index: calc(var(--z-hud) + 2);
  pointer-events: none;
}
.sec-shard {
  position: absolute;
  inset: 0;
  clip-path: var(--clip);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.65), rgba(255, 255, 255, 0.25) 45%, rgba(var(--accent-2-rgb), 0.45));
  opacity: 0;
  animation: sec-shard 1.3s var(--ease-out) var(--d, 0ms) both;
}
@keyframes sec-shard {
  0% { opacity: 0; transform: none; }
  8% { opacity: 1; }
  42% { opacity: 0.9; transform: translate(var(--dx), var(--dy)) rotate(var(--dr)); }
  78% { opacity: 0.55; transform: none; }
  100% { opacity: 0; transform: none; }
}

/* ----------------------------------------------------- shared components */
.sec-kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
}
.sec-kicker--gold {
  color: var(--gold);
}

.sec-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s var(--ease-out), background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.sec-btn:hover {
  background: rgba(var(--accent-rgb), 0.18);
  box-shadow: var(--glow);
  transform: translateY(-1px);
}
.sec-btn:active {
  transform: translateY(1px) scale(0.98);
}
.sec-btn[hidden] {
  display: none;
}
.sec-btn--gold {
  border-color: rgba(255, 194, 61, 0.7);
  background: linear-gradient(135deg, rgba(255, 194, 61, 0.26), rgba(255, 138, 0, 0.12));
  color: #fff6dc;
  box-shadow: 0 0 18px rgba(255, 194, 61, 0.2);
}
.sec-btn--gold:hover {
  background: linear-gradient(135deg, rgba(255, 194, 61, 0.42), rgba(255, 138, 0, 0.22));
  box-shadow: 0 0 14px rgba(255, 194, 61, 0.6), 0 0 42px rgba(255, 194, 61, 0.25);
}
.sec-btn--ghost {
  border-color: var(--border);
  background: transparent;
  color: var(--text-dim);
}
.sec-btn--ghost:hover {
  border-color: rgba(255, 56, 96, 0.6);
  background: rgba(255, 56, 96, 0.08);
  color: var(--text);
  box-shadow: none;
}
.sec-btn--danger {
  border-color: rgba(255, 56, 96, 0.8);
  background: rgba(255, 56, 96, 0.16);
  color: #fff;
}
.sec-btn--danger:hover {
  background: rgba(255, 56, 96, 0.32);
  box-shadow: 0 0 14px rgba(255, 56, 96, 0.6), 0 0 40px rgba(255, 56, 96, 0.25);
}
.sec-btn.is-armed {
  border-color: var(--red);
  background: rgba(255, 56, 96, 0.24);
  color: #fff;
  animation: sec-armed 0.55s ease-in-out infinite alternate;
}
@keyframes sec-armed {
  from { box-shadow: 0 0 0 rgba(255, 56, 96, 0); }
  to { box-shadow: 0 0 22px rgba(255, 56, 96, 0.65); }
}

.sec-x {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 22px;
  line-height: 1;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.3s var(--ease-out);
}
.sec-x:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  transform: rotate(90deg);
}
.sec-x--gold {
  border-color: rgba(255, 194, 61, 0.45);
  color: var(--gold);
}
.sec-x--gold:hover {
  border-color: var(--gold);
  background: rgba(255, 194, 61, 0.12);
}

.sec-bar {
  position: relative;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.sec-bar__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.7);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.9s var(--ease-out);
}
.sec-bar--gold .sec-bar__fill {
  background: linear-gradient(90deg, #ff8a00, var(--gold), #fff1c2);
  box-shadow: 0 0 12px rgba(255, 194, 61, 0.7);
}

.sec-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 0 solid rgba(var(--accent-rgb), 0.75);
  pointer-events: none;
}
.sec-corner--tl { top: 8px; left: 8px; border-top-width: 2px; border-left-width: 2px; }
.sec-corner--tr { top: 8px; right: 8px; border-top-width: 2px; border-right-width: 2px; }
.sec-corner--bl { bottom: 8px; left: 8px; border-bottom-width: 2px; border-left-width: 2px; }
.sec-corner--br { bottom: 8px; right: 8px; border-bottom-width: 2px; border-right-width: 2px; }

/* ------------------------------------------------------------ HUD chip */
.sec-chip {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: var(--z-hud);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 14px 0 4px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--panel-strong);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.35s var(--ease-out), border-color 0.3s ease, box-shadow 0.3s ease;
}
.sec-chip:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 194, 61, 0.6);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45), 0 0 18px rgba(255, 194, 61, 0.3);
}
.sec-chip__ring {
  position: absolute;
  left: 4px;
  top: 50%;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  transform: rotate(-90deg);
  overflow: visible;
  pointer-events: none;
}
.sec-chip__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.09);
  stroke-width: 3;
}
.sec-chip__fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 100 100;
  stroke-dashoffset: 100;
  filter: drop-shadow(0 0 3px rgba(255, 194, 61, 0.85));
  transition: stroke-dashoffset 1s var(--ease-out);
}
.sec-chip__star {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--gold);
  font-size: 15px;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 194, 61, 0.85);
}
.sec-chip__label {
  white-space: nowrap;
}
.sec-chip__n {
  font-weight: 700;
  color: #fff;
}
.sec-chip__t {
  color: var(--text-faint);
}
.sec-chip.is-ping {
  animation: sec-chip-ping 0.9s var(--ease-out);
}
.sec-chip.is-ping .sec-chip__star {
  animation: sec-star-spin 0.9s var(--ease-out);
}
@keyframes sec-chip-ping {
  0% { box-shadow: 0 0 0 0 rgba(255, 194, 61, 0.7), 0 8px 30px rgba(0, 0, 0, 0.45); }
  30% { transform: scale(1.12); }
  100% { box-shadow: 0 0 0 22px rgba(255, 194, 61, 0), 0 8px 30px rgba(0, 0, 0, 0.45); transform: none; }
}
@keyframes sec-star-spin {
  from { transform: rotate(0) scale(1.6); }
  to { transform: rotate(360deg) scale(1); }
}
.sec-chip.is-vault {
  border-color: rgba(255, 194, 61, 0.75);
  animation: sec-vault-pulse 1.8s ease-in-out infinite;
}
.sec-chip.is-complete {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(60, 40, 4, 0.92), rgba(12, 10, 4, 0.92));
}
@keyframes sec-vault-pulse {
  0%, 100% { box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(255, 194, 61, 0.45); }
  50% { box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45), 0 0 0 8px rgba(255, 194, 61, 0); }
}

/* ------------------------------------------------------- secrets panel */
.sec-panel {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.45s;
}
.sec-panel.is-open {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
.sec-panel__backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 35%, rgba(var(--accent-rgb), 0.1), rgba(2, 3, 10, 0.86) 70%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.sec-panel.is-open .sec-panel__backdrop {
  opacity: 1;
}
.sec-panel__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1040px, 100%);
  max-height: min(88vh, 920px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(14, 20, 48, 0.95), rgba(5, 7, 18, 0.97));
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.7), 0 0 60px rgba(var(--accent-rgb), 0.12);
  overflow: hidden;
  opacity: 0;
  transform: translateY(26px) scale(0.97);
  transition: opacity 0.35s ease, transform 0.55s var(--ease-out);
}
@supports (max-height: 1dvh) {
  .sec-panel__dialog {
    max-height: min(88dvh, 920px);
  }
}
.sec-panel.is-open .sec-panel__dialog {
  opacity: 1;
  transform: none;
}
.sec-panel__head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 24px 26px 16px;
}
.sec-panel__heading {
  min-width: 0;
}
.sec-panel__title {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(24px, 4vw, 38px);
  letter-spacing: 0.08em;
  line-height: 1.05;
  background: linear-gradient(90deg, #fff, var(--gold) 55%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 194, 61, 0.25));
}
.sec-panel__score {
  font-family: var(--font-display);
  white-space: nowrap;
}
.sec-panel__n {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 194, 61, 0.55);
}
.sec-panel__of {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
}
.sec-panel__bar {
  margin: 0 26px;
  flex: none;
}
.sec-panel__grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  padding: 18px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb), 0.35) transparent;
}
.sec-slot {
  position: relative;
  min-height: 108px;
  padding: 12px 14px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.018);
  overflow: hidden;
  animation: sec-slot-in 0.5s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}
.sec-slot:not(.is-found)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.018) 0 6px, transparent 6px 14px);
  pointer-events: none;
}
.sec-slot.is-found {
  border-color: rgba(255, 194, 61, 0.42);
  background: linear-gradient(150deg, rgba(255, 194, 61, 0.12), rgba(255, 43, 214, 0.04) 70%);
  box-shadow: inset 0 0 26px rgba(255, 194, 61, 0.06);
}
@keyframes sec-slot-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.sec-slot__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-faint);
}
.sec-slot.is-found .sec-slot__state {
  color: var(--gold);
}
.sec-slot__title {
  margin-top: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.06em;
  line-height: 1.25;
  color: #fff;
}
.sec-slot:not(.is-found) .sec-slot__title {
  color: var(--text-faint);
  letter-spacing: 0.32em;
}
.sec-slot__desc {
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-dim);
}
.sec-slot:not(.is-found) .sec-slot__desc {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-faint);
}
.sec-panel__foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 22px;
  padding: 16px 26px 22px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}
.sec-vaultbox {
  flex: 1 1 280px;
  min-width: 0;
}
.sec-vaultbox__row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}
.sec-vaultbox__count {
  color: var(--gold);
}
.sec-vaultbox__msg {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--text-faint);
}
.sec-vaultbox.is-open .sec-vaultbox__msg {
  color: var(--gold);
}
.sec-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.sec-panel__open {
  animation: sec-vault-pulse 1.8s ease-in-out infinite;
}
/* Closed overlays stay in the DOM (visibility:hidden), where infinite animations
   (vault rays/shimmer, OPEN VAULT pulse) would keep ticking every frame forever. */
.sec-panel:not(.is-open) *,
.sec-vault:not(.is-open) * {
  animation-play-state: paused !important;
}

/* ---------------------------------------------------------------- vault */
.sec-vault {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) + 5);
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow: hidden;
  color: #fff8e6;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}
.sec-vault.is-open {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.3s ease, visibility 0s linear 0s;
}
.sec-vault__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 194, 61, 0.24), rgba(60, 34, 0, 0.88) 42%, rgba(4, 3, 0, 0.97) 78%);
}
.sec-vault__rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 180vmax;
  height: 180vmax;
  margin: -90vmax 0 0 -90vmax;
  background: repeating-conic-gradient(from 0deg, rgba(255, 194, 61, 0.1) 0deg 5deg, transparent 5deg 15deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  opacity: 0;
  pointer-events: none;
  will-change: transform;
  transition: opacity 1.2s ease 0.3s;
  animation: sec-spin 70s linear infinite;
}
.sec-vault.is-unlocked .sec-vault__rays {
  opacity: 1;
}
@keyframes sec-spin {
  to { transform: rotate(360deg); }
}

.sec-vault__door {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sec-vault__half {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50.5%;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 26px),
    radial-gradient(circle at 50% 50%, rgba(255, 194, 61, 0.18), transparent 60%),
    linear-gradient(180deg, #3d2c08, #171003 50%, #3d2c08);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.7);
  transition: transform 1s var(--ease-in-out);
}
.sec-vault__half--l {
  left: 0;
  border-right: 2px solid rgba(255, 194, 61, 0.85);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.7), 6px 0 30px rgba(255, 194, 61, 0.35);
}
.sec-vault__half--r {
  right: 0;
  border-left: 2px solid rgba(255, 194, 61, 0.85);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.7), -6px 0 30px rgba(255, 194, 61, 0.35);
}
.sec-vault.is-unlocked .sec-vault__half--l {
  transform: translateX(-103%);
}
.sec-vault.is-unlocked .sec-vault__half--r {
  transform: translateX(103%);
}
.sec-vault__wheel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(220px, 52vw);
  height: min(220px, 52vw);
  border: 6px solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(circle, #6b4e12 0 16%, #2a1d05 17% 100%);
  box-shadow: 0 0 46px rgba(255, 194, 61, 0.55), inset 0 0 30px rgba(255, 194, 61, 0.35);
  transform: translate(-50%, -50%);
  transition: opacity 0.5s ease, scale 0.6s var(--ease-out);
}
.sec-vault.is-open .sec-vault__wheel {
  animation: sec-wheel 1s var(--ease-in-out) both;
}
.sec-vault__wheel span {
  position: absolute;
  left: 50%;
  top: 7%;
  bottom: 7%;
  width: 8px;
  margin-left: -4px;
  border-radius: 4px;
  background: linear-gradient(#ffe08a, #a87810);
  box-shadow: 0 0 10px rgba(255, 194, 61, 0.6);
}
.sec-vault__wheel span:nth-child(2) { transform: rotate(60deg); }
.sec-vault__wheel span:nth-child(3) { transform: rotate(120deg); }
.sec-vault__wheel i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26%;
  height: 26%;
  border: 3px solid var(--gold);
  border-radius: 50%;
  background: #1a1203;
  transform: translate(-50%, -50%);
}
.sec-vault.is-unlocked .sec-vault__wheel {
  opacity: 0;
  scale: 1.5;
}
@keyframes sec-wheel {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(270deg); }
}

.sec-vault__dialog {
  position: relative;
  z-index: 2;
  width: min(780px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: clamp(24px, 4vw, 44px) clamp(18px, 4vw, 44px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(255, 194, 61, 0.55);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(52, 34, 4, 0.88), rgba(14, 9, 2, 0.94));
  box-shadow: 0 0 0 1px rgba(255, 194, 61, 0.08), 0 30px 120px rgba(0, 0, 0, 0.7), 0 0 90px rgba(255, 194, 61, 0.18);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(0.9);
  transition: opacity 0.6s ease 0.35s, transform 0.9s var(--ease-out) 0.35s;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 194, 61, 0.4) transparent;
}
.sec-vault.is-unlocked .sec-vault__dialog {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.sec-vault__dialog .sec-x {
  position: absolute;
  top: 14px;
  right: 14px;
}
.sec-vault__dialog .sec-kicker {
  padding: 0 46px;
  line-height: 1.6;
}
.sec-vault__title {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(26px, 5.4vw, 48px);
  line-height: 1.1;
  letter-spacing: 0.04em;
  background: linear-gradient(100deg, #fff4cf 0%, var(--gold) 35%, #ff9d1c 55%, #fff4cf 75%, var(--gold) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 194, 61, 0.45));
  animation: gp-shimmer 5s linear infinite;
}
.sec-vault__msg {
  max-width: 58ch;
  margin: 18px auto 0;
  font-size: clamp(15px, 2.2vw, 17px);
  line-height: 1.7;
  color: #f3e6c4;
}
.sec-vault__sig {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--gold);
}
.sec-vault__stats {
  margin: 22px 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: rgba(255, 228, 160, 0.75);
}
.sec-vault__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 18px;
  margin: 0 auto;
  padding: 14px 16px;
  max-width: 600px;
  list-style: none;
  border: 1px solid rgba(255, 194, 61, 0.2);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  text-align: left;
}
.sec-vault__item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(255, 240, 210, 0.38);
}
.sec-vault__item.is-found {
  color: #fff3d1;
}
.sec-vault__mark {
  flex: none;
  width: 1.2em;
  color: rgba(255, 194, 61, 0.5);
}
.sec-vault__item.is-found .sec-vault__mark {
  color: var(--lime);
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.7);
}
.sec-vault__num {
  flex: none;
  color: rgba(255, 194, 61, 0.55);
}
.sec-vault__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sec-vault__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

/* ------------------------------------------------------------- terminal */
.sec-term {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--sec-vvt, 0px);
  height: var(--sec-vvh, 100%);
  z-index: var(--z-terminal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.sec-term.is-visible {
  display: flex;
}
.sec-term__backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(2, 3, 10, 0.35), rgba(2, 3, 10, 0.72));
  -webkit-backdrop-filter: blur(3px) saturate(1.2);
  backdrop-filter: blur(3px) saturate(1.2);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sec-term.is-open .sec-term__backdrop {
  opacity: 1;
}
.sec-term__win {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(860px, 100%);
  height: min(560px, 100%);
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(var(--accent-rgb), 0.08), transparent 60%),
    linear-gradient(180deg, rgba(6, 10, 24, 0.93), rgba(3, 5, 14, 0.96));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 30px 100px rgba(0, 0, 0, 0.65),
    0 0 60px rgba(var(--accent-rgb), 0.18),
    inset 0 0 80px rgba(var(--accent-rgb), 0.05);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-family: var(--font-mono);
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transform-origin: 50% 60%;
  transition: opacity 0.25s ease, transform 0.4s var(--ease-out), width 0.35s var(--ease-out), height 0.35s var(--ease-out), border-radius 0.35s ease;
}
.sec-term.is-open .sec-term__win {
  opacity: 1;
  transform: none;
}
.sec-term.is-max .sec-term__win {
  width: 100%;
  height: 100%;
}

.sec-term__bar {
  flex: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
  -webkit-user-select: none;
  user-select: none;
}
.sec-term__lights {
  display: flex;
  gap: 8px;
}
.sec-term__light {
  position: relative;
  width: 13px;
  height: 13px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), 0 0 8px rgba(255, 95, 87, 0.55);
  transition: transform 0.2s var(--ease-back), filter 0.2s ease;
}
.sec-term__light::after {
  content: '';
  position: absolute;
  inset: -4px; /* bigger hit area without overlapping the neighbours */
}
.sec-term__light:hover {
  transform: scale(1.18);
  filter: brightness(1.2);
}
.sec-term__light.is-min {
  background: #febc2e;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), 0 0 8px rgba(254, 188, 46, 0.5);
}
.sec-term__light.is-max {
  background: #28c840;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), 0 0 8px rgba(40, 200, 64, 0.5);
}
.sec-term__title {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.sec-term__tag {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(var(--accent-rgb), 0.75);
}
.sec-term__exit {
  display: none;
  padding: 6px 10px;
  border: 1px solid rgba(255, 95, 87, 0.55);
  border-radius: 8px;
  background: rgba(255, 95, 87, 0.1);
  color: #ffb3ae;
  font: 700 11px var(--font-mono);
  letter-spacing: 0.14em;
}

.sec-term__screen {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 18px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  font-size: 13.5px;
  line-height: 1.55;
  color: #cfe9ff;
  text-shadow: 0 0 6px rgba(var(--accent-rgb), 0.3);
  cursor: text;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb), 0.4) transparent;
  animation: sec-flicker 7s infinite;
}
@keyframes sec-flicker {
  0%, 96%, 100% { opacity: 1; }
  97% { opacity: 0.92; }
  98% { opacity: 1; }
  99% { opacity: 0.95; }
}
.sec-term__row {
  min-height: 1.55em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sec-term__row.is-echo {
  margin-top: 6px;
}
.sec-term__row.is-head {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.18em;
}
.sec-term__row.is-head::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--accent-2-rgb), 0.5), transparent);
}
.sec-term__row.is-help {
  display: grid;
  grid-template-columns: minmax(150px, 24ch) minmax(0, 1fr);
  gap: 14px;
  white-space: normal;
}
.sec-term__row.is-kv .t-key,
.sec-term__row.is-game .t-gid {
  display: inline-block;
  min-width: 13ch;
  margin-right: 1ch;
}
.sec-term__row.is-neo {
  white-space: normal;
  margin: 6px 0;
}
.sec-term__ascii,
.t-pre,
.t-neo__logo {
  margin: 0;
  font-family: var(--font-mono);
  white-space: pre;
  line-height: 1.08;
  overflow-x: auto;
  scrollbar-width: none;
}
.sec-term__ascii {
  padding: 4px 0 8px;
  font-size: clamp(8px, 2.5vw, 14px);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.45));
  text-shadow: none;
}
.t-pre {
  font-size: 13px;
  line-height: 1.2;
}
.t-neo {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 26px;
}
.t-neo__logo {
  flex: none;
  font-size: 13px;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(var(--accent-rgb), 0.6);
}
.t-neo__info {
  flex: 1 1 260px;
  min-width: 0;
}
.t-neo__kv {
  overflow-wrap: anywhere;
}
.t-swatches {
  display: flex;
  gap: 3px;
  margin-top: 8px;
}
.t-sw {
  display: inline-block;
  width: 22px;
  height: 14px;
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
}

/* terminal colour markup */
.t-acc { color: var(--accent); }
.t-acc2 { color: var(--accent-2); }
.t-ok { color: var(--lime); text-shadow: 0 0 8px rgba(57, 255, 20, 0.4); }
.t-err { color: var(--red); text-shadow: 0 0 8px rgba(255, 56, 96, 0.5); }
.t-warn { color: var(--yellow); text-shadow: 0 0 8px rgba(255, 230, 0, 0.35); }
.t-gold { color: var(--gold); text-shadow: 0 0 8px rgba(255, 194, 61, 0.45); }
.t-violet { color: var(--violet); text-shadow: 0 0 8px rgba(162, 107, 255, 0.5); }
.t-dim { color: var(--text-faint); text-shadow: none; }
.t-b { font-weight: 700; }
.t-ps1 { color: var(--lime); font-weight: 700; text-shadow: 0 0 8px rgba(57, 255, 20, 0.5); }
.t-cmd { color: #fff; }
.t-key { color: var(--text-dim); }
.t-gid { color: var(--accent); }
.t-cmdname { color: var(--accent); white-space: nowrap; }
.t-desc { color: var(--text-dim); }
.t-ph { color: var(--text-dim); }
.t-indent { display: block; padding-left: 3ch; color: var(--text-dim); }
.t-tag {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.86em;
  line-height: 1.5;
}

/* prompt line + block caret */
.sec-term__line {
  display: flex;
  align-items: baseline;
  gap: 1ch;
  margin-top: 6px;
}
.sec-term__ps1 {
  flex: none;
  color: var(--lime);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.5);
  transition: opacity 0.2s ease;
}
.sec-term.is-busy .sec-term__ps1 {
  opacity: 0.35;
}
.sec-term__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.sec-term__input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  text-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}
.sec-term__input::selection {
  background: rgba(var(--accent-rgb), 0.35);
  color: transparent;
}
.sec-term__input:focus-visible {
  outline: none;
}
.sec-term__mirror {
  position: absolute;
  inset: 0;
  overflow: hidden;
  white-space: pre;
  color: #fff;
  pointer-events: none;
}
.sec-term__caret {
  display: inline-block;
  min-width: 1ch;
  background: var(--accent);
  color: var(--bg);
  text-shadow: none;
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.85);
  animation: sec-blink 1.05s steps(1) infinite;
}
.sec-term.is-typing .sec-term__caret {
  animation: none;
}
.sec-term:not(.is-focused) .sec-term__caret {
  background: transparent;
  color: inherit;
  box-shadow: inset 0 0 0 1px var(--accent);
  animation: none;
}
.sec-term__mirror.is-sel .sec-term__caret {
  display: none;
}
@keyframes sec-blink {
  50% { background: transparent; color: inherit; box-shadow: none; }
}

/* tappable suggestion chips (touch / small screens) */
.sec-term__chips {
  flex: none;
  display: none;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  overflow-x: auto;
  border-top: 1px solid rgba(var(--accent-rgb), 0.18);
  background: rgba(0, 0, 0, 0.28);
  scrollbar-width: none;
}
.sec-term__chips::-webkit-scrollbar {
  display: none;
}
.sec-term__chip {
  flex: none;
  padding: 8px 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  font: 600 12.5px var(--font-mono);
  letter-spacing: 0.04em;
  -webkit-tap-highlight-color: transparent;
}
.sec-term__chip:active {
  background: rgba(var(--accent-rgb), 0.25);
  transform: scale(0.96);
}

/* CRT: scanlines + vignette + a slow scan beam */
.sec-term__crt {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.5) 100%);
}
.sec-term__crt::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 90px;
  background: linear-gradient(180deg, transparent, rgba(var(--accent-rgb), 0.05), transparent);
  animation: sec-beam 6s linear infinite;
}
@keyframes sec-beam {
  from { transform: translateY(-100px); }
  to { transform: translateY(600px); }
}

@media (pointer: coarse), (max-width: 640px) {
  .sec-term__chips {
    display: flex;
  }
  .sec-term__line {
    font-size: 16px; /* keeps iOS from zooming into the input */
  }
}

@media (max-width: 640px) {
  .sec-term {
    padding: 0;
  }
  .sec-term__win,
  .sec-term.is-max .sec-term__win {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    padding-top: env(safe-area-inset-top);
  }
  .sec-term__bar {
    height: 46px;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .sec-term__tag {
    display: none;
  }
  .sec-term__exit {
    display: block;
  }
  .sec-term__light {
    width: 14px;
    height: 14px;
  }
  .sec-term__screen {
    padding: 12px 14px 16px;
    font-size: 12.5px;
  }
  .sec-term__row.is-help {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin-bottom: 6px;
  }
  .sec-term__row.is-kv .t-key,
  .sec-term__row.is-game .t-gid {
    min-width: 11ch;
  }
  .t-neo__logo {
    font-size: 11px;
  }
}

/* ---------------------------------------------------------- screensaver */
.sec-ss {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-terminal) + 10);
  background: #02030a;
  cursor: none;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.sec-ss.is-in {
  opacity: 1;
}
.sec-ss.is-out {
  opacity: 0;
  transition-duration: 0.4s;
}
.sec-ss__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.sec-ss__clock {
  position: absolute;
  top: max(22px, env(safe-area-inset-top));
  right: 26px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(18px, 4vw, 30px);
  letter-spacing: 0.12em;
  color: rgba(232, 243, 255, 0.5);
  pointer-events: none;
}
.sec-ss__badge {
  position: absolute;
  top: max(28px, env(safe-area-inset-top));
  left: 26px;
  max-width: calc(100vw - 200px);
  font: 700 10.5px var(--font-mono);
  letter-spacing: 0.24em;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 194, 61, 0.6);
  pointer-events: none;
}
.sec-ss__hint {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(28px, env(safe-area-inset-bottom));
  text-align: center;
  font: 600 11px var(--font-mono);
  letter-spacing: 0.4em;
  color: rgba(232, 243, 255, 0.45);
  pointer-events: none;
  animation: sec-breathe 2.6s ease-in-out infinite;
}
@keyframes sec-breathe {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

/* -------------------------------------------------------- self-destruct */
.sec-sd {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-toast) - 2);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, rgba(130, 0, 22, 0.88), rgba(22, 0, 5, 0.97) 70%);
  color: #fff;
  font-family: var(--font-display);
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sec-sd.is-in {
  opacity: 1;
}
.sec-sd.is-out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.sec-sd__strobe {
  position: absolute;
  inset: 0;
  background: #ff1f4b;
  opacity: 0;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: sec-strobe 1s steps(1) infinite;
}
@keyframes sec-strobe {
  0% { opacity: 0.32; }
  50% { opacity: 0; }
}
.sec-sd__stripes {
  position: absolute;
  left: 0;
  right: 0;
  height: 30px;
  background: repeating-linear-gradient(-45deg, #ffe600 0 18px, #111 18px 36px);
  box-shadow: 0 0 30px rgba(255, 230, 0, 0.35);
  animation: sec-stripes 1s linear infinite;
}
.sec-sd__stripes--top { top: 0; }
.sec-sd__stripes--bot { bottom: 0; animation-direction: reverse; }
@keyframes sec-stripes {
  from { background-position: 0 0; }
  to { background-position: 50.91px 0; }
}
.sec-sd__core {
  position: relative;
  z-index: 1;
  max-width: 900px;
}
.sec-sd__warn {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5em;
  color: var(--yellow);
  animation: sec-breathe 0.5s steps(1) infinite;
}
.sec-sd__title {
  margin-top: 10px;
  font-weight: 900;
  font-size: clamp(18px, 4.6vw, 40px);
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-shadow: 0 0 20px rgba(255, 56, 96, 0.9), 3px 0 rgba(0, 240, 255, 0.5), -3px 0 rgba(255, 43, 214, 0.5);
}
.sec-sd__count {
  margin: 4px 0;
  font-weight: 900;
  font-size: clamp(110px, 32vw, 260px);
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 30px #ff3860, 0 0 80px rgba(255, 56, 96, 0.8);
}
.sec-sd__count.is-pop {
  animation: sec-pop 0.6s var(--ease-out);
}
@keyframes sec-pop {
  from { transform: scale(1.5); opacity: 0.3; filter: blur(6px); }
  to { transform: none; opacity: 1; filter: none; }
}
.sec-sd__sub {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.16em;
  color: rgba(255, 220, 225, 0.8);
}
.sec-sd__abort {
  margin-top: 22px;
}
.sec-sd__flash {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.sec-sd.is-boom .sec-sd__flash {
  animation: sec-flash 0.75s ease-out forwards;
}
.sec-sd.is-boom .sec-sd__core {
  animation: sec-boom 0.6s ease-out forwards;
}
@keyframes sec-flash {
  0% { opacity: 0; }
  12% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes sec-boom {
  0% { transform: none; }
  20% { transform: translate(-12px, 8px) scale(1.06); }
  40% { transform: translate(10px, -10px) scale(1.1); }
  100% { transform: scale(1.6); opacity: 0; filter: blur(12px); }
}
.sec-sd__reboot {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 16px;
  background: #000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}
.sec-sd.is-reboot .sec-sd__reboot {
  opacity: 1;
  visibility: visible;
}
.sec-sd__rtext {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(16px, 3.5vw, 24px);
  letter-spacing: 0.3em;
  color: var(--lime);
  text-shadow: 0 0 12px rgba(57, 255, 20, 0.6);
  animation: sec-breathe 0.8s ease-in-out infinite;
}
.sec-sd__rbar {
  width: min(320px, 70vw);
  height: 4px;
  border-radius: 4px;
  background: rgba(57, 255, 20, 0.15);
  overflow: hidden;
}
.sec-sd__rbar span {
  display: block;
  height: 100%;
  background: var(--lime);
  box-shadow: 0 0 12px var(--lime);
  transform-origin: left;
  transform: scaleX(0);
}
.sec-sd.is-reboot .sec-sd__rbar span {
  animation: sec-rbar 2.2s ease-in-out forwards;
}
@keyframes sec-rbar {
  to { transform: scaleX(1); }
}
.sec-sd__joke {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 7vw, 64px);
  color: #fff;
  text-shadow: 0 0 24px rgba(var(--accent-rgb), 0.8);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.5s ease, transform 0.7s var(--ease-back);
}
.sec-sd.is-joke .sec-sd__rtext,
.sec-sd.is-joke .sec-sd__rbar {
  display: none;
}
.sec-sd.is-joke .sec-sd__joke {
  opacity: 1;
  transform: none;
}

/* -------------------------------------------------------- gravity banner */
.sec-gravity {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) - 10);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sec-gravity:focus-visible {
  outline: none;
}
.sec-gravity__banner {
  position: absolute;
  left: 50%;
  top: calc(var(--nav-h) + 14px);
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border: 1px solid rgba(255, 230, 0, 0.6);
  border-radius: 999px;
  background: rgba(22, 18, 0, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--yellow);
  font: 600 11px var(--font-mono);
  letter-spacing: 0.16em;
  text-align: center;
  box-shadow: 0 0 30px rgba(255, 230, 0, 0.25);
  opacity: 0;
  transform: translate(-50%, -16px);
  transition: opacity 0.35s ease, transform 0.5s var(--ease-out);
}
.sec-gravity.is-in .sec-gravity__banner {
  opacity: 1;
  transform: translate(-50%, 0);
}
.sec-gravity__banner b {
  font-weight: 700;
  letter-spacing: 0.22em;
}
.sec-gravity__sub {
  color: rgba(255, 240, 160, 0.8);
}
.sec-gravity__dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 10px var(--yellow);
  vertical-align: 1px;
  animation: sec-breathe 0.9s ease-in-out infinite;
}

/* ----------------------------------------------------------- responsive */
@media (max-width: 640px) {
  .sec-chip {
    height: 40px;
    padding-right: 12px;
    font-size: 11.5px;
  }
  .sec-chip__ring {
    width: 32px;
    height: 32px;
    margin-top: -16px;
  }
  .sec-chip__star {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
  .sec-panel {
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }
  .sec-panel__dialog {
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 16px;
  }
  .sec-panel__head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    padding: 18px 16px 12px;
  }
  .sec-panel__score {
    grid-column: 1;
    grid-row: 2;
  }
  .sec-panel__head .sec-x {
    grid-column: 2;
    grid-row: 1;
  }
  .sec-panel__bar {
    margin: 0 16px;
  }
  .sec-panel__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 14px 16px;
  }
  .sec-slot {
    min-height: 96px;
    padding: 10px 10px 12px;
  }
  .sec-slot__top {
    font-size: 9px;
    letter-spacing: 0.1em;
  }
  .sec-slot__title {
    font-size: 12px;
  }
  .sec-slot:not(.is-found) .sec-slot__title {
    letter-spacing: 0.2em;
  }
  .sec-slot__desc,
  .sec-slot:not(.is-found) .sec-slot__desc {
    font-size: 11px;
  }
  .sec-panel__foot {
    padding: 14px 16px 18px;
  }
  .sec-panel__actions,
  .sec-panel__actions .sec-btn {
    width: 100%;
  }
  .sec-vault__list {
    grid-template-columns: minmax(0, 1fr);
  }
  .sec-vault__actions .sec-btn {
    flex: 1 1 100%;
  }
  .sec-btn {
    white-space: normal;
    text-align: center;
  }
  .sec-ss__badge {
    left: 16px;
    max-width: calc(100vw - 150px);
  }
  .sec-ss__clock {
    right: 16px;
  }
}

@media (max-width: 380px) {
  .sec-panel__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html.sec-flipping {
    transition: none;
  }
  .sec-barrel,
  .sec-shatter,
  .sec-timewarp {
    animation: none !important;
  }
  .sec-term__screen,
  .sec-term__crt::after,
  .sec-vault__rays,
  .sec-sd__strobe,
  .sec-sd__stripes,
  .sec-chip.is-vault,
  .sec-panel__open {
    animation: none;
  }
  .sec-shards {
    display: none;
  }
}
