:root {
  --bg-void: #05060c;
  --bg-panel: #0d0f1a;
  --border-dim: #262b42;
  --primary: #7b5cff;
  --primary-bright: #a98cff;
  --sapphire: #3a86ff;
  --amethyst: #a259e6;
  --ruby: #e0334f;
  --emerald: #2ecc71;
  --silver: #c7ccd6;
  --text-main: #e9edf5;
  --text-dim: #8791a3;
  --success: #2ecc71;
  --danger: #e0334f;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  background:
    repeating-linear-gradient(115deg, rgba(123,92,255,0.05) 0px, rgba(123,92,255,0.05) 1px, transparent 1px, transparent 90px),
    repeating-linear-gradient(25deg, rgba(58,134,255,0.04) 0px, rgba(58,134,255,0.04) 1px, transparent 1px, transparent 90px),
    radial-gradient(circle at 50% -10%, #1a1230 0%, var(--bg-void) 60%);
  color: var(--text-main);
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  margin: 0;
  padding: 0 0 60px 0;
  min-height: 100vh;
}

.heist-nav {
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #090a13;
  border-bottom: 1px solid var(--primary);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 20px rgba(123,92,255,0.15);
}

.heist-nav li { float: left; }

.heist-nav li a {
  display: block;
  color: var(--primary-bright);
  text-align: center;
  padding: 14px 20px;
  text-decoration: none;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 13px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.heist-nav li a:hover:not(.active) {
  background-color: var(--primary);
  color: #05060c;
}

.heist-nav .active {
  background: linear-gradient(90deg, var(--primary), var(--amethyst));
  color: #05060c;
}

.heist-title {
  text-align: center;
  padding: 34px 20px 8px;
  font-size: 2.1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--sapphire), var(--primary-bright), var(--amethyst));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(123,92,255,0.35);
}

.heist-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.95rem;
  letter-spacing: 2px;
  margin-bottom: 24px;
}

.heist-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

.panel {
  background: linear-gradient(160deg, rgba(18,20,34,0.9), rgba(13,15,26,0.9));
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin: 22px 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(123,92,255,0.07) 50%, transparent 100%);
  pointer-events: none;
}

.panel::after {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 40px; height: 40px;
  border-top: 2px solid var(--primary);
  border-left: 2px solid var(--primary);
  border-radius: var(--radius) 0 0 0;
  opacity: 0.5;
}

.panel h2 {
  margin-top: 0;
  color: var(--primary-bright);
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-dim);
  padding-bottom: 10px;
}

.mission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid var(--border-dim);
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
}

.tag.gem {
  color: #05060c;
  font-weight: 600;
  border: none;
}

.tag.mission-num { color: var(--primary-bright); border-color: var(--primary); }
.tag.security-high { color: var(--ruby); border-color: var(--ruby); }
.tag.security-med { color: var(--primary-bright); border-color: var(--primary); }
.tag.security-low { color: var(--emerald); border-color: var(--emerald); }

.briefing {
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.6;
  border-left: 3px solid var(--primary);
  padding-left: 14px;
  margin: 14px 0 20px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--silver);
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

input[type="text"], input[type="password"] {
  background: #05060c;
  border: 1px solid var(--border-dim);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 6px;
  width: 100%;
  max-width: 320px;
  font-family: inherit;
  margin-bottom: 12px;
}

input[type="text"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(123,92,255,0.25);
}

input[type="submit"], button {
  background: linear-gradient(135deg, var(--primary), var(--amethyst));
  border: none;
  color: #f5f2ff;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 22px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

input[type="submit"]:hover, button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(123,92,255,0.4);
}

.hint-text {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 6px;
  background: rgba(58, 134, 255, 0.08);
  border: 1px dashed var(--sapphire);
  color: var(--silver);
  font-size: 0.9rem;
  line-height: 1.5;
}

.result-msg {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
  display: none;
}

.result-msg.show { display: block; }

.result-msg.success {
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid var(--success);
  color: #baf5d0;
}

.result-msg.fail {
  background: rgba(224, 51, 79, 0.1);
  border: 1px solid var(--danger);
  color: #f7bcc6;
}

.gem-stone {
  width: 70px;
  height: 70px;
  margin: 18px auto 6px;
  opacity: 0;
  transform: scale(0.2) rotate(45deg);
  pointer-events: none;
}

.gem-stone.reveal {
  animation: gemReveal 1.2s cubic-bezier(.34,1.56,.64,1) forwards;
}

.gem-shape {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gem-c1, var(--primary)), var(--gem-c2, var(--amethyst)));
  box-shadow: 0 0 10px var(--gem-c1, var(--primary)), 0 0 40px var(--gem-c1, var(--primary)), inset 0 0 16px rgba(255,255,255,0.5);
}

.gem-caption {
  text-align: center;
  color: var(--primary-bright);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 0.8rem;
  opacity: 0;
}

.gem-stone.reveal ~ .gem-caption {
  animation: captionFade 1s ease 0.4s forwards;
}

@keyframes gemReveal {
  0% { opacity: 0; transform: scale(0.2) rotate(45deg); }
  55% { opacity: 1; transform: scale(1.2) rotate(45deg); }
  75% { transform: scale(0.95) rotate(45deg); }
  100% { opacity: 1; transform: scale(1) rotate(45deg); }
}

@keyframes captionFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.scanline {
  position: relative;
  overflow: hidden;
}

.scanline::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: rgba(123,92,255,0.55);
  top: 0;
  animation: scan 4s linear infinite;
  box-shadow: 0 0 10px rgba(123,92,255,0.6);
}

@keyframes scan {
  0% { top: 0; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.alarm-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  margin-right: 6px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.footer-nav {
  text-align: center;
  margin-top: 30px;
}

.footer-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 1px;
  border: 1px solid var(--border-dim);
  padding: 8px 16px;
  border-radius: 6px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.footer-nav a:hover {
  color: var(--primary-bright);
  border-color: var(--primary);
}

@media (prefers-reduced-motion: reduce) {
  .scanline::before, .alarm-dot, .gem-stone.reveal, .gem-stone.reveal ~ .gem-caption {
    animation: none;
  }
  .gem-stone.reveal { opacity: 1; transform: scale(1) rotate(45deg); }
  .gem-stone.reveal ~ .gem-caption { opacity: 1; }
}

@media (max-width: 600px) {
  .heist-title { font-size: 1.4rem; }
  .heist-container { padding: 0 12px; }
}

/* ---------------------------------------------------------- */
/* Gem vault case - used on the final "Heist Complete" screen */
/* to display every recovered gem together as the reward.     */
/* ---------------------------------------------------------- */

.gem-case {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 26px;
  padding: 30px 10px 10px;
}

.gem-case-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 92px;
}

.gem-case-item .gem-stone {
  width: 56px;
  height: 56px;
  margin: 0 0 10px;
}

.gem-case-item .gem-stone.reveal {
  animation-name: gemReveal, gemShine;
  animation-duration: 1s, 2.4s;
  animation-timing-function: cubic-bezier(.34,1.56,.64,1), ease-in-out;
  animation-iteration-count: 1, infinite;
  animation-fill-mode: forwards, none;
  animation-delay: var(--gem-delay, 0s), calc(var(--gem-delay, 0s) + 1s);
}

.gem-case-item .gem-caption {
  opacity: 1;
  font-size: 0.68rem;
  text-align: center;
  animation: none;
}

@keyframes gemShine {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

.gem-case-crown .gem-stone {
  width: 74px;
  height: 74px;
}

.gem-case-crown .gem-caption {
  color: #f4d871;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .gem-case-item .gem-stone.reveal { animation: none; opacity: 1; transform: scale(1) rotate(45deg); }
}
