/* Styles specific to Room 5 (rooms/5/index.html). Loaded after the shared CSS, so it can override it. */

kbd {
  font-family: monospace;
  font-size: 0.8em;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0.1em 0.4em;
  color: var(--text);
}

.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;
}

nav a:focus-visible,
nav a.real-link:focus-visible {
  outline: none;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 3px var(--accent-light);
  pointer-events: auto;
}

/* ── Main ── */
main {
  flex: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
  width: 100%;
}

h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.intro-text {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 48ch;
}

/* ── Hint box ── */
.hint-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--warning);
  border-radius: 0 6px 6px 0;
  padding: 0.875rem 1.25rem;
  margin-bottom: 1.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ── Signal panels grid ── */
.signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.signal-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.panel-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.panel-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

.panel-value {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

/* ── Animations ── */

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-14px); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes drift {
  0%, 100% { transform: translateX(0); }
  33%       { transform: translateX(10px); }
  66%       { transform: translateX(-10px); }
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--border); }
  50%       { border-color: var(--danger); box-shadow: 0 0 12px color-mix(in srgb, var(--danger) 35%, transparent); }
}

@keyframes flicker {
  /* Floor at 0.55 so the flickering value never drops below 4.5:1 contrast */
  0%, 90%, 100% { opacity: 1; }
  92%            { opacity: 0.55; }
  96%            { opacity: 0.8; }
}

@keyframes wander {
  0%   { transform: translate(0px,   0px); }
  20%  { transform: translate(28px, -36px); }
  40%  { transform: translate(-30px, 24px); }
  60%  { transform: translate(34px, 32px); }
  80%  { transform: translate(-36px, -20px); }
  100% { transform: translate(0px,   0px); }
}

.panel-bounce { animation: bounce 1.4s ease-in-out infinite; }

.panel-spin .panel-icon { animation: spin 2s linear infinite; }

.panel-drift { animation: drift 2.8s ease-in-out infinite; }

.panel-pulse {
  animation: pulse-border 1.6s ease-in-out infinite;
}
.panel-pulse .panel-value {
  animation: flicker 3s ease-in-out infinite;
}

.reveal-btn-container {
  display: inline-block;
  animation: wander 1.45s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .panel-bounce,
  .panel-spin .panel-icon,
  .panel-drift,
  .panel-pulse,
  .panel-pulse .panel-value,
  .reveal-btn-container {
    animation: none !important;
  }
  .panel-pulse { box-shadow: none !important; }
}

/* ── Reveal section ── */
.reveal-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem 2rem 2.5rem;
  text-align: center;
}

.reveal-heading {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.reveal-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  max-width: 40ch;
  margin-left: auto;
  margin-right: auto;
}

.reveal-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.75rem 1.75rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.reveal-btn:focus-visible {
  outline: 3px solid var(--accent-light);
  outline-offset: 3px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(5rem);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-muted);
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text);
  z-index: 100;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  max-width: min(420px, calc(100vw - 2rem));
  text-align: center;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: opacity 0.15s ease;
    transform: translateX(-50%);
  }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--success);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.modal .success-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-next {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
}

.btn-close {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
}

@media (max-width: 560px) {
  main   { padding: 2rem 1.25rem 3rem; }
  header { padding: 0.75rem 1.25rem; }
}
