/* ============================================================
   SECTOR 15 · FINAL PROTOCOL
   ============================================================ */

.final-protocol-console {
  padding: 24px;
  background:
    radial-gradient(
      circle at center,
      rgba(233, 183, 189, 0.08),
      transparent 54%
    ),
    rgba(0, 0, 0, 0.21);
  border: 1px solid rgba(233, 183, 189, 0.18);
  border-radius: 20px;
}

.final-protocol-core {
  display: grid;
  grid-template-columns:
    170px
    1fr;
  gap: 26px;
  align-items: center;
  min-height: 210px;
}

.final-protocol-lock {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 150px;
  margin: auto;
}

.final-protocol-lock strong {
  position: relative;
  z-index: 3;
  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 2.2rem;
}

.final-lock-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(233, 183, 189, 0.24);
  border-radius: 50%;
}

.final-lock-ring:nth-child(2) {
  inset: 18px;
  border-color: rgba(233, 183, 189, 0.17);
}

.final-lock-ring:nth-child(3) {
  inset: 38px;
  border-color: rgba(233, 183, 189, 0.1);
}

.final-protocol-instruction {
  padding: 22px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 15px;
}

.final-protocol-instruction span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: var(--font-label);
  font-weight: 700;
  letter-spacing: 0.14em;
}

.final-protocol-instruction strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ============================================================
   MISSION COMPLETE
   ============================================================ */

.mission-complete-screen {
  position: relative;
  display: flex;
  min-height: calc(100vh - 124px);
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mission-complete-glow {
  position: absolute;
  width: 700px;
  height: 700px;
  background:
    radial-gradient(
      circle,
      rgba(233, 183, 189, 0.12),
      rgba(233, 183, 189, 0.025) 42%,
      transparent 68%
    );
  pointer-events: none;
}

.mission-complete-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns:
    var(--operator-panel-width)
    minmax(0, 1fr);
  width: min(100%, 960px);
  overflow: hidden;
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.07),
      rgba(255, 255, 255, 0.025)
    );
  border: 1px solid rgba(233, 183, 189, 0.17);
  border-radius: 30px;
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.42);
}

.mission-complete-operator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  background: rgba(0, 0, 0, 0.17);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}

.mission-complete-mascot-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--operator-portrait-width);
  height: var(--operator-portrait-height);
  background:
    radial-gradient(
      circle,
      rgba(233, 183, 189, 0.08),
      transparent 68%
    );
}

.mission-complete-mascot {
  width: var(--operator-portrait-width);
  height: var(--operator-portrait-height);
  object-fit: contain;
  filter:
    drop-shadow(
      0 18px 30px
      rgba(0, 0, 0, 0.32)
    );
  animation: completeMascotArrive 760ms cubic-bezier(0.18, 0.8, 0.25, 1) both;
}

@keyframes completeMascotArrive {
  from { opacity: 0; transform: translateY(18px) scale(0.88); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .mission-complete-mascot { animation: none; }
}

.mission-complete-content {
  padding: 42px 44px;
}

.mission-complete-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.mission-complete-header .eyebrow { margin: 0; }

.mission-complete-header > span {
  color: var(--accent);
  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.mission-complete-content h1 {
  margin: 12px 0 28px;
  font-size:
    clamp(
      3rem,
      5vw,
      4.4rem
    );
  line-height: 0.98;
}

.mission-complete-summary {
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
}

.mission-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  min-height: 52px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mission-result-row:last-child { border-bottom: 0; }

.mission-result-row span {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.mission-result-row strong {
  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.mission-result-row--final {
  background: rgba(116, 185, 138, 0.055);
}

.mission-result-row--final strong {
  color: #74b98a;
}

.mission-complete-message {
  margin: 24px 0;
  color: var(--muted);
  line-height: 1.6;
}

.mission-complete-message p {
  margin: 0 0 5px;
}

.mission-complete-content .open-hatch {
  width: 100%;
  margin: 0;
}

@media (max-width: 950px) {
  .deduction-options {
    grid-template-columns: 1fr;
  }

  .final-protocol-core {
    grid-template-columns: 1fr;
  }

  .mission-complete-card {
    grid-template-columns: 1fr;
  }

  .mission-complete-operator {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }
}

/* ============================================================
   FINAL PROTOCOL · THREE PART AUTHORIZATION
   ============================================================ */

.final-code-parts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
}

.final-code-part label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.final-code-part .final-part-input {
  width: 100%;
  margin: 0;
  text-align: center;
  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.final-execute-button {
  width: 100%;
  margin-top: 14px;
}

.final-lock-ring {
  transition:
    border-color 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease,
    transform 220ms ease;
}

.final-lock-ring.active {
  border-color: rgba(231, 162, 77, 0.92);
  box-shadow:
    0 0 12px rgba(231, 162, 77, 0.22),
    inset 0 0 12px rgba(231, 162, 77, 0.05);
}

.final-lock-ring.correct {
  border-color: rgba(116, 185, 138, 0.95);
  box-shadow:
    0 0 17px rgba(116, 185, 138, 0.32),
    inset 0 0 14px rgba(116, 185, 138, 0.07);
}

.final-lock-ring.error {
  border-color: rgba(210, 104, 104, 0.95);
  box-shadow:
    0 0 18px rgba(210, 104, 104, 0.34),
    inset 0 0 14px rgba(210, 104, 104, 0.08);
}

.final-protocol-lock:has(.final-lock-ring.correct) strong {
  color: #74b98a;
}

.final-protocol-lock:has(.final-lock-ring.error) strong {
  color: #d26868;
}

.final-protocol-lock:has(.final-lock-ring.active) strong {
  color: #e7a24d;
}

/* ============================================================
   FINAL GIFT REVEAL
   ============================================================ */

.final-gift-screen {
  position: relative;
  display: flex;
  min-height: calc(100vh - 124px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  overflow: hidden;
  padding: 32px 0 48px;
  text-align: center;
}

.final-gift-atmosphere {
  position: absolute;
  inset: -80px -25vw;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 430px 340px at 50% 67%, rgba(207, 126, 143, 0.16), transparent 75%),
    radial-gradient(ellipse 600px 420px at 50% 43%, rgba(255, 222, 183, 0.055), transparent 73%);
}

.final-gift-header {
  position: relative;
  z-index: 20;
}

.final-gift-header .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 13px;
}

.final-gift-header .eyebrow::before,
.final-gift-header .eyebrow::after {
  content: "";
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233, 183, 189, 0.8));
}

.final-gift-header .eyebrow::after {
  transform: rotate(180deg);
}

.final-gift-header h1 {
  margin: 0;
  line-height: 1.06;
  text-shadow: 0 14px 42px rgba(0, 0, 0, 0.3);
}

.final-gift-header h1 span {
  background: linear-gradient(125deg, #fffaf3 15%, #f2c8ca 88%);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.final-gift-area {
  position: relative;
  z-index: 5;
  width: 100%;
  margin-top: 15px;
}

.final-gift-stage {
  position: relative;
  width: min(760px, 100%);
  height: 535px;
  margin: 0 auto;
  outline: none;
  cursor: pointer;
}

.final-gift-stage:focus-visible {
  outline: 2px solid rgba(255, 221, 189, 0.8);
  outline-offset: 5px;
  border-radius: 24px;
}

.final-gift-stage.opened {
  cursor: default;
}

.final-gift-stage::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 47px;
  width: 480px;
  height: 74px;
  border: 1px solid rgba(241, 197, 185, 0.13);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(237, 169, 156, 0.13), transparent 70%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  transform: translateX(-50%);
}

.final-gift-action {
  position: absolute;
  right: 0;
  bottom: 9px;
  left: 0;
  color: #d9bdc0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: var(--font-label);
  font-weight: 700;
  letter-spacing: 0.22em;
  transition: opacity 300ms ease;
}

.final-gift-action.hidden {
  opacity: 0;
}

.final-gift-aura {
  position: absolute;
  left: 50%;
  bottom: 65px;
  width: 500px;
  height: 400px;
  border-radius: 50%;
  opacity: 0.72;
  pointer-events: none;
  background: radial-gradient(ellipse, rgba(235, 178, 184, 0.19), rgba(233, 183, 189, 0.045) 49%, transparent 71%);
  filter: blur(14px);
  transform: translateX(-50%) scale(0.88);
  transition: opacity 800ms ease, transform 1100ms ease;
}

.final-gift-stage.opened .final-gift-aura {
  opacity: 1;
  transform: translateX(-50%) scale(1.28);
}

.final-gift-halo {
  position: absolute;
  left: 50%;
  top: 20px;
  width: 485px;
  height: 485px;
  border: 1px solid rgba(241, 202, 190, 0.1);
  border-radius: 50%;
  box-shadow: inset 0 0 80px rgba(233, 183, 189, 0.025), 0 0 80px rgba(233, 183, 189, 0.035);
  pointer-events: none;
  transform: translateX(-50%);
  transition: border-color 1000ms ease, transform 1200ms ease;
}

.final-gift-halo::before,
.final-gift-halo::after {
  content: "✦";
  position: absolute;
  color: rgba(244, 205, 186, 0.58);
  font-size: 18px;
  text-shadow: 0 0 20px rgba(233, 183, 189, 0.65);
}

.final-gift-halo::before { top: 54px; left: 34px; }
.final-gift-halo::after { right: 45px; bottom: 62px; font-size: 12px; }

.final-gift-stage.opened .final-gift-halo {
  border-color: rgba(241, 202, 190, 0.22);
  transform: translateX(-50%) scale(1.08);
}

.final-gift-box {
  position: absolute;
  left: 50%;
  bottom: 78px;
  z-index: 4;
  width: 340px;
  height: 285px;
  transform-origin: center bottom;
  animation: finalGiftIdle 3.4s ease-in-out infinite;
}

@keyframes finalGiftIdle {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

.final-gift-stage.opened .final-gift-box {
  animation: none;
  transform: translateX(-50%) translateY(45px) scale(0.76);
  transition: transform 1050ms cubic-bezier(0.2, 0.7, 0.2, 1) 350ms;
}

.final-gift-body {
  position: absolute;
  left: 18px;
  bottom: 0;
  width: 304px;
  height: 210px;
  overflow: hidden;
  border: 1px solid rgba(255, 233, 228, 0.4);
  border-radius: 11px 11px 28px 28px;
  background: linear-gradient(120deg, #d99ba6, #bf7c89 52%, #8f4e5d);
  box-shadow: inset -18px -12px 30px rgba(82, 27, 44, 0.23), inset 12px 9px 22px rgba(255, 234, 230, 0.14), 0 34px 62px rgba(0, 0, 0, 0.48);
}

.final-gift-body::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0.2), transparent 32%, rgba(68, 22, 36, 0.13) 82%);
}

.final-gift-ribbon,
.final-gift-lid-ribbon {
  position: absolute;
  left: 50%;
  top: 0;
  width: 48px;
  height: 100%;
  background: linear-gradient(90deg, #b88458, #f8dfac 26%, #fff3d2 51%, #d2a672 82%, #a76e4c);
  box-shadow: -4px 0 9px rgba(81, 40, 31, 0.15), 4px 0 9px rgba(81, 40, 31, 0.16);
  transform: translateX(-50%);
}

.final-gift-lid {
  position: absolute;
  left: 0;
  top: 24px;
  z-index: 12;
  width: 340px;
  height: 78px;
  border: 1px solid rgba(255, 237, 229, 0.52);
  border-radius: 15px;
  background: linear-gradient(155deg, #efb7bf, #d894a0 55%, #af6574);
  box-shadow: inset 0 8px 15px rgba(255, 246, 239, 0.15), inset 0 -8px 12px rgba(113, 46, 58, 0.18), 0 17px 31px rgba(0, 0, 0, 0.31);
  transform-origin: center bottom;
  transition: transform 1100ms cubic-bezier(0.18, 0.78, 0.22, 1), opacity 450ms ease 650ms;
}

.final-gift-stage.opened .final-gift-lid {
  opacity: 0;
  transform: translate(130px, -200px) rotate(25deg) scale(0.77);
}

.final-gift-bow {
  position: absolute;
  left: 50%;
  top: -39px;
  width: 128px;
  height: 66px;
  transform: translateX(-50%);
}

.final-gift-bow span {
  position: absolute;
  top: 5px;
  width: 56px;
  height: 45px;
  border: 1px solid rgba(255, 247, 220, 0.7);
  background: linear-gradient(145deg, #fff0cc, #e1b883 75%, #ba875a);
  box-shadow: inset 0 4px 8px rgba(255, 255, 255, 0.28), 0 7px 11px rgba(86, 48, 42, 0.17);
  border-radius: 75% 30% 68% 30%;
}

.final-gift-bow span:first-child { left: 4px; transform: rotate(-18deg); }
.final-gift-bow span:nth-child(2) { right: 4px; transform: scaleX(-1) rotate(-18deg); }

.final-gift-bow i {
  position: absolute;
  left: 50%;
  top: 17px;
  z-index: 3;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff0d0, #d2a572 75%);
  box-shadow: 0 4px 8px rgba(87, 47, 35, 0.2);
  transform: translateX(-50%);
}

.final-gift-beam {
  position: absolute;
  left: 50%;
  bottom: 130px;
  z-index: 3;
  width: 320px;
  height: 390px;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(to top, rgba(255, 225, 181, 0.62), rgba(238, 186, 183, 0.18) 52%, transparent);
  clip-path: polygon(41% 100%, 59% 100%, 100% 0, 0 0);
  filter: blur(9px);
  transform: translateX(-50%) scaleY(0);
  transform-origin: center bottom;
  transition: opacity 700ms ease 260ms, transform 950ms ease 260ms;
}

.final-gift-stage.opened .final-gift-beam {
  opacity: 0.78;
  transform: translateX(-50%) scaleY(1);
}

.final-reward-card {
  position: absolute;
  left: 50%;
  top: 32px;
  z-index: 15;
  width: 440px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translateX(-50%) translateY(130px) rotateX(12deg) scale(0.68);
  transition: opacity 600ms ease 580ms, transform 1050ms cubic-bezier(0.16, 0.82, 0.22, 1) 450ms;
}

.final-gift-stage.opened .final-reward-card {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) rotateX(0) scale(1);
}

.final-reward-card.gift-card-reward { width: 440px; }

.final-reward-card .redeem-card {
  width: 100%;
  padding: 29px 30px 28px;
  border: 1px solid transparent;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 0, rgba(223, 168, 168, 0.19), transparent 47%) padding-box, linear-gradient(148deg, #302931, #1a1820 62%, #15151b) padding-box,
    linear-gradient(145deg, rgba(255, 231, 207, 0.66), rgba(219, 151, 163, 0.38) 46%, rgba(255, 222, 196, 0.2)) border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 32px 70px rgba(0, 0, 0, 0.54), 0 0 70px rgba(233, 183, 189, 0.11);
}

.final-reward-card .redeem-card::before {
  right: -95px;
  bottom: -125px;
  width: 260px;
  height: 260px;
  border-color: rgba(237, 190, 186, 0.13);
}

.final-reward-card .redeem-card::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(248, 216, 201, 0.1);
  border-radius: 18px;
  pointer-events: none;
}

.final-reward-card .redeem-card-top,
.final-reward-card .redeem-card-symbol,
.final-reward-card .gift-title,
.final-reward-card .gift-description,
.final-reward-card .redeem-code-wrap,
.final-reward-card .redeem-instruction {
  position: relative;
  z-index: 1;
}

.final-reward-card .redeem-card-top { margin-bottom: 12px; }
.final-reward-card .redeem-card-label { color: #f0c6c9; }
.final-reward-card .redeem-card-operator { font-size: var(--font-label); }

.final-reward-card .redeem-card-symbol {
  margin: 4px 0 9px;
  color: #f7d8b9;
  font-size: 3.7rem;
  line-height: 1;
  text-shadow: 0 0 30px rgba(246, 205, 170, 0.65);
}

.final-reward-card .redeem-card .gift-title {
  font-size: 2rem;
  letter-spacing: -0.035em;
}

.final-reward-card .redeem-card .gift-description {
  margin: 12px 0 22px;
  color: #c4bdc4;
}

.final-reward-card .redeem-code-wrap {
  padding: 17px 16px 19px;
  border: 1px solid rgba(245, 204, 174, 0.36);
  border-radius: 14px;
  background: linear-gradient(110deg, rgba(255, 230, 192, 0.085), rgba(13, 13, 19, 0.32));
  box-shadow: inset 0 1px 0 rgba(255, 237, 217, 0.06);
}

.final-reward-card .redeem-code-wrap > span { color: #d4bcc0; }

.final-reward-card .redeem-code {
  color: #fff8ee;
  font-size: 1.55rem;
  letter-spacing: 0.12em;
  text-shadow: 0 0 20px rgba(255, 238, 211, 0.23);
}

.final-reward-card .redeem-instruction {
  margin-top: 18px;
  line-height: 1.5;
}

.final-gift-particles {
  position: absolute;
  left: 50%;
  bottom: 200px;
  z-index: 8;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.final-gift-particles span {
  position: absolute;
  width: 7px;
  height: 7px;
  opacity: 0;
  border-radius: 50%;
  background: #ffe4be;
  box-shadow: 0 0 15px rgba(255, 217, 175, 0.9);
}

.final-gift-particles span:nth-child(3n) {
  width: 4px;
  height: 4px;
  background: #efb8c4;
}

.final-gift-stage.opened .final-gift-particles span {
  animation: finalGiftParticle 1450ms ease-out var(--delay) forwards;
}

@keyframes finalGiftParticle {
  0% { opacity: 0; transform: translate(0, 0) scale(0); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1.2); }
}

@media (max-height: 800px) {
  .final-gift-screen { padding-top: 20px; padding-bottom: 24px; }
  .final-gift-stage { height: 475px; }
  .final-gift-box { bottom: 57px; }
  .final-gift-halo { top: -10px; }
  .final-reward-card { top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .final-gift-box { animation: none; }
  .final-gift-screen *,
  .final-gift-screen *::before,
  .final-gift-screen *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

.final-gift-complete {
  display: none !important;
}
