* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --background: #111111;
  --panel: #171717;
  --line: #77736a;
  --text: #d7d2c7;
  --dim: #77736a;
  --lamp-off: #302b24;
  --lamp-on: #b37a38;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 35%, #1d1a17 0, var(--background) 58%);
  color: var(--text);
  font-family: "Courier New", Courier, monospace;
}

.ritual-box {
  width: min(100%, 360px);
  padding: 30px 24px 26px;
  border: 1px solid var(--line);
  background: rgba(18, 18, 18, 0.94);
  text-align: center;
  box-shadow:
    0 18px 55px rgba(0, 0, 0, 0.55),
    inset 0 0 28px rgba(255, 255, 255, 0.018);
}

h1 {
  margin: 0;
  font-size: clamp(1.18rem, 5vw, 1.55rem);
  font-weight: 400;
  letter-spacing: 0.18em;
  line-height: 1.35;
}

.subtitle {
  margin: 9px 0 24px;
  color: var(--dim);
  font-size: 0.67rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 22px;
  margin-bottom: 20px;
  color: var(--dim);
  font-size: 0.69rem;
  letter-spacing: 0.18em;
}

.lamp {
  width: 8px;
  height: 8px;
  border: 1px solid #635848;
  border-radius: 50%;
  background: var(--lamp-off);
  box-shadow: inset 0 0 3px #000;
  transition: background 500ms ease, box-shadow 500ms ease;
}

.lamp.active {
  background: var(--lamp-on);
  box-shadow:
    0 0 7px rgba(179, 122, 56, 0.75),
    0 0 16px rgba(179, 122, 56, 0.28);
  animation: flicker 3.8s infinite steps(1);
}

button {
  min-width: 190px;
  padding: 11px 16px;
  border: 1px solid #8a857b;
  background: #121212;
  color: #efebe2;
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  cursor: pointer;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  background: #211d18;
  outline: none;
  box-shadow: 0 0 0 1px #b2a58f;
}

button:disabled {
  color: #625f59;
  border-color: #45423e;
  cursor: wait;
}

.load-text {
  min-height: 1em;
  margin: 16px 0 0;
  color: #625f59;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

@keyframes flicker {
  0%, 8%, 12%, 48%, 55%, 82%, 100% { opacity: 1; }
  9%, 49%, 83% { opacity: 0.58; }
  10%, 50%, 84% { opacity: 0.86; }
}

@media (prefers-reduced-motion: reduce) {
  .lamp.active {
    animation: none;
  }
}
