:root {
  --l7-cream: #f7ead9;
  --l7-ink: #211a16;
  --l7-bg: #111a21;
  --l7-panel: rgba(18, 27, 35, 0.78);
  --l7-panel-strong: rgba(18, 27, 35, 0.92);
  --l7-blue: #82d8ff;
  --l7-gold: #e1b85e;
  --l7-copper: #c77558;
  --l7-green: #74c894;
  --l7-red: #ef6d5a;
  --l7-shadow: 0 16px 55px rgba(0, 0, 0, 0.35);
  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Lora", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background: var(--l7-bg);
  color: var(--l7-cream);
  font-family: var(--font-body);
}

button,
input {
  font: inherit;
}

.lock7-app {
  position: fixed;
  inset: 0;
  isolation: isolate;
}

#lock7-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(#162431, #102031);
}

.l7-hud {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  left: max(1rem, env(safe-area-inset-left));
  right: max(1rem, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  pointer-events: none;
  z-index: 4;
}

.l7-objective,
.l7-status-strip,
.l7-prompt,
.l7-bluebox,
.l7-controls-hint,
.l7-result-panel,
.l7-book-callout {
  border: 1px solid rgba(247, 234, 217, 0.18);
  background: var(--l7-panel);
  box-shadow: var(--l7-shadow);
  backdrop-filter: blur(10px);
}

.l7-objective {
  width: min(410px, 48vw);
  padding: 0.85rem 1rem;
  border-radius: 8px;
}

.l7-objective span,
.l7-kicker,
.l7-meter span,
.l7-result-stats dt {
  display: block;
  color: var(--l7-gold);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.l7-objective strong {
  display: block;
  margin: 0.18rem 0 0.32rem;
  color: #fff7ec;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.35rem);
  letter-spacing: 0;
}

.l7-objective p {
  margin: 0;
  color: rgba(247, 234, 217, 0.84);
  line-height: 1.45;
}

.l7-status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 0.55rem;
  width: min(520px, 48vw);
  padding: 0.65rem;
  border-radius: 8px;
}

.l7-meter b {
  display: block;
  margin: 0.12rem 0 0.35rem;
  color: #fff7ec;
  font-size: 0.96rem;
}

.l7-meter i,
.l7-prompt i {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(247, 234, 217, 0.14);
}

.l7-meter em,
.l7-prompt em {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--l7-green);
  transform-origin: left center;
  transition: width 0.25s ease, background 0.25s ease;
}

.l7-prompt {
  position: absolute;
  left: 50%;
  bottom: 18%;
  z-index: 5;
  width: min(360px, calc(100vw - 2rem));
  transform: translateX(-50%);
  border-radius: 8px;
  padding: 0.8rem;
  text-align: center;
  pointer-events: none;
}

.l7-prompt span {
  display: inline-grid;
  place-items: center;
  min-width: 2.4rem;
  min-height: 2.4rem;
  margin-bottom: 0.45rem;
  border-radius: 8px;
  background: rgba(247, 234, 217, 0.13);
  color: var(--l7-gold);
  font-weight: 700;
}

.l7-prompt strong {
  display: block;
  margin-bottom: 0.65rem;
}

.l7-bluebox {
  position: absolute;
  left: max(1rem, env(safe-area-inset-left));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 5;
  width: min(470px, calc(100vw - 2rem));
  border-left: 4px solid var(--l7-blue);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  color: #e9f8ff;
  font: 0.92rem/1.55 "Courier New", monospace;
}

.l7-controls-hint {
  position: absolute;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 4;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  max-width: min(520px, 45vw);
  padding: 0.6rem;
  border-radius: 999px;
  color: rgba(247, 234, 217, 0.84);
  font-size: 0.78rem;
}

.l7-controls-hint span {
  white-space: nowrap;
}

.l7-start,
.l7-result {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    linear-gradient(90deg, rgba(13, 19, 25, 0.92) 0%, rgba(13, 19, 25, 0.76) 42%, rgba(13, 19, 25, 0.22) 100%),
    radial-gradient(circle at 72% 45%, rgba(225, 184, 94, 0.14), transparent 34%),
    url("/images/lock7/lock7-splash.webp") center / cover no-repeat;
}

.l7-start[hidden],
.l7-result[hidden],
.l7-prompt[hidden],
.l7-bluebox[hidden] {
  display: none;
}

.l7-start > div {
  width: min(760px, 100%);
  margin-right: auto;
  padding-left: clamp(0rem, 4vw, 5rem);
}

.l7-start h1 {
  margin: 0.35rem 0 0.75rem;
  color: #fff7ec;
  text-shadow: 0 3px 28px rgba(0, 0, 0, 0.62);
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 6rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.l7-start p {
  max-width: 56ch;
  color: rgba(247, 234, 217, 0.9);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.65;
}

.l7-start-actions,
.l7-cta-row,
.l7-newsletter div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.l7-start button,
.l7-start a,
.l7-cta-row a,
.l7-cta-row button,
.l7-newsletter button {
  min-height: 46px;
  padding: 0.78rem 1rem;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.l7-start button:first-child,
.l7-cta-row a {
  background: #ff9900;
  border-color: #ff9900;
  color: #fff;
}

.l7-start button:not(:first-child),
.l7-start a,
.l7-cta-row button {
  background: rgba(247, 234, 217, 0.09);
  border-color: rgba(247, 234, 217, 0.24);
  color: var(--l7-cream);
}

.l7-start button:hover,
.l7-start a:hover,
.l7-cta-row a:hover,
.l7-cta-row button:hover,
.l7-newsletter button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22);
}

.l7-result-panel {
  width: min(880px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border-radius: 8px;
  padding: clamp(1rem, 3vw, 2rem);
  background:
    linear-gradient(rgba(16, 25, 32, 0.92), rgba(16, 25, 32, 0.94)),
    url("/images/lock7/lock7-splash.webp") right center / cover no-repeat;
}

.l7-rank {
  float: right;
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin-left: 1rem;
  border: 2px solid var(--l7-gold);
  border-radius: 50%;
  color: var(--l7-gold);
  font: 700 3rem var(--font-display);
}

.l7-result h2 {
  margin: 0.35rem 0 0.4rem;
  color: #fff7ec;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: 0;
}

.l7-result p {
  color: rgba(247, 234, 217, 0.88);
  line-height: 1.65;
}

.l7-result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 1rem 0;
}

.l7-result-stats div,
.l7-evidence {
  border: 1px solid rgba(247, 234, 217, 0.13);
  border-radius: 8px;
  background: rgba(247, 234, 217, 0.06);
  padding: 0.85rem;
}

.l7-result-stats dd {
  margin: 0.25rem 0 0;
  color: #fff7ec;
  font-size: 1.15rem;
  font-weight: 700;
}

.l7-evidence h3,
.l7-newsletter label {
  margin: 0 0 0.55rem;
  color: var(--l7-gold);
  font-family: var(--font-display);
  letter-spacing: 0;
}

.l7-evidence ul {
  margin: 0;
  padding-left: 1.2rem;
  color: rgba(247, 234, 217, 0.88);
}

.l7-cta-row {
  margin-top: 1rem;
}

.l7-newsletter {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(247, 234, 217, 0.15);
}

.l7-book-callout {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  border-radius: 8px;
  padding: 0.8rem;
  background: rgba(247, 234, 217, 0.07);
  box-shadow: none;
}

.l7-book-callout img {
  display: block;
  width: 96px;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
}

.l7-book-callout p {
  margin: 0;
}

.l7-newsletter input[type="email"] {
  flex: 1;
  min-width: 220px;
  min-height: 44px;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(247, 234, 217, 0.28);
  border-radius: 8px;
  color: var(--l7-ink);
}

.l7-newsletter span {
  position: absolute;
  left: -9999px;
}

.l7-newsletter button {
  background: var(--l7-gold);
  border-color: var(--l7-gold);
  color: #241911;
}

.l7-mobile-controls {
  position: absolute;
  inset: auto 0 max(1rem, env(safe-area-inset-bottom));
  z-index: 6;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 1rem;
  pointer-events: none;
}

.l7-joystick {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(247, 234, 217, 0.11);
  border: 1px solid rgba(247, 234, 217, 0.2);
  pointer-events: auto;
}

.l7-joystick i {
  position: absolute;
  left: 34px;
  top: 34px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(247, 234, 217, 0.42);
}

.l7-mobile-actions {
  display: grid;
  gap: 0.7rem;
  pointer-events: auto;
}

.l7-mobile-actions button {
  width: 108px;
  min-height: 54px;
  border: 1px solid rgba(247, 234, 217, 0.25);
  border-radius: 999px;
  background: rgba(18, 27, 35, 0.76);
  color: var(--l7-cream);
  font-weight: 700;
}

@media (pointer: coarse), (max-width: 760px) {
  .l7-mobile-controls {
    display: flex;
  }

  .l7-controls-hint {
    display: none;
  }
}

@media (max-width: 860px) {
  .l7-hud {
    display: grid;
  }

  .l7-objective,
  .l7-status-strip {
    width: auto;
    max-width: none;
  }

  .l7-status-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .l7-bluebox {
    bottom: 9rem;
  }
}

@media (max-width: 560px) {
  .l7-hud {
    left: 0.7rem;
    right: 0.7rem;
    top: 0.7rem;
  }

  .l7-objective {
    padding: 0.7rem;
  }

  .l7-objective p {
    display: none;
  }

  .l7-status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0.55rem;
  }

  .l7-result-panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 1rem);
    padding: 1rem;
  }

  .l7-result h2 {
    font-size: clamp(1.5rem, 9vw, 2.1rem);
  }

  .l7-result p {
    margin: 0.35rem 0;
    font-size: 1rem;
    line-height: 1.45;
  }

  .l7-result-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    margin: 0.65rem 0;
  }

  .l7-result-stats div {
    padding: 0.55rem;
  }

  .l7-result-stats dt {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
  }

  .l7-result-stats dd {
    font-size: 1rem;
  }

  .l7-cta-row {
    order: 4;
    display: grid;
    margin-top: 0.35rem;
  }

  .l7-cta-row a,
  .l7-cta-row button {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.75rem;
    text-align: center;
  }

  .l7-evidence {
    order: 5;
    max-height: 9rem;
    margin-top: 0.75rem;
    overflow: auto;
  }

  .l7-book-callout {
    order: 6;
    grid-template-columns: 70px 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
  }

  .l7-book-callout img {
    width: 70px;
  }

  .l7-newsletter {
    order: 7;
  }

  .l7-newsletter div {
    display: grid;
    grid-template-columns: 1fr;
  }

  .l7-rank {
    float: none;
    margin: 0 0 0.75rem;
    width: 74px;
    height: 74px;
    font-size: 2.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
