:root {
  --bg: #0b0b0d;
  --panel: rgba(18, 18, 21, 0.88);
  --text: #e6e0d6;
  --muted: #8f887e;
  --line: rgba(230, 224, 214, 0.12);
  --accent: #b89a61;
  --error: #9f8060;
  --success: #d2b97f;
  --shadow: rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, #1b1b1f 0%, #0b0b0d 58%, #060607 100%);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}

body {
  min-height: 100vh;
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
}

.puzzle-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px var(--shadow);
}

.image-wrap {
  margin: 0;
  align-self: start;
}

.image-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--bg);
  cursor: pointer;
}

.image-button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

.image-button:disabled { cursor: default; }

.flash-image {
  position: absolute;
  inset: 0;
  height: 100% !important;
  object-fit: contain;
  background: var(--bg);
  visibility: hidden;
}

.flash-image.visible { visibility: visible; }

.meta-marker {
  margin-left: 8px;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  opacity: 0.65;
}

.thunderbolt {
  width: 14px;
  height: 14px;
  margin-left: 12px;
  vertical-align: middle;
  fill: var(--accent);
  opacity: 0.65;
}

.thunderbolt + .thunderbolt { margin-left: 4px; }

#lightning-flash {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: #dce5f1;
  opacity: 0;
}

#lightning-flash.active { opacity: 0.08; }

@media (prefers-reduced-motion: reduce) {
  #lightning-flash.active { opacity: 0.025; }
}

.puzzle-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  filter: saturate(0.92) contrast(1.04);
}

.content-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.phase-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
}

.riddle {
  margin: 0 0 26px;
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  line-height: 1.15;
  font-weight: 400;
}

.answer-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.answer-input {
  flex: 1 1 250px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  outline: none;
}

.answer-input::placeholder {
  color: #716b63;
}

.answer-input:focus {
  border-color: rgba(184, 154, 97, 0.6);
  box-shadow: 0 0 0 1px rgba(184, 154, 97, 0.18);
}

.submit-button {
  padding: 14px 20px;
  border: 1px solid rgba(184, 154, 97, 0.38);
  background: rgba(184, 154, 97, 0.08);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.submit-button:hover {
  background: rgba(184, 154, 97, 0.14);
  border-color: rgba(184, 154, 97, 0.6);
}

.submit-button:active {
  transform: translateY(1px);
}

.response-message {
  min-height: 1.5em;
  margin: 0 0 18px;
  color: var(--error);
  font-size: 0.96rem;
}

.success-panel {
  padding: 16px 18px;
  border-left: 2px solid rgba(210, 185, 127, 0.5);
  background: rgba(210, 185, 127, 0.05);
  color: var(--success);
}

.success-panel p {
  margin: 0 0 10px;
}

.success-panel p:last-child {
  margin-bottom: 0;
}

.proceed-control {
  display: block;
  width: fit-content;
  margin: 16px 0 0 auto;
  padding: 7px 0;
  color: var(--success);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.proceed-control:hover,
.proceed-control:focus-visible {
  border-bottom-color: transparent;
}

.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  .puzzle-panel {
    grid-template-columns: 1fr;
  }
}

.proceed-control:focus:not(:focus-visible) { outline: none; }
