/* ================================================================
   SHADOW PACT — Secret 2-Player Daily Puzzle
   Triggered by Konami Code
   — same DNA as the site, shifted darker —
   ================================================================ */

:root {
  --kg-accent:   #c0392b;        /* site's #ff6b6b dragged toward crimson */
  --kg-accent2:  #e05050;        /* softer hover/highlight variant */
  --kg-p1:       #c0392b;
  --kg-p2:       #e07050;
  --kg-text:     #ffffff;
  --kg-subtext:  rgba(255,255,255,0.65);
  --kg-dim:      rgba(255,255,255,0.35);
  --kg-success:  #6fcf97;
  --kg-danger:   #eb5757;
  --kg-glass:    rgba(0, 0, 0, 0.55);      /* site uses rgba(255,255,255,0.1) — we invert */
  --kg-border:   rgba(255, 255, 255, 0.15);
}

/* ──────────────── OVERLAY ──────────────── */
#kg-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(5, 0, 0, 0.82);   /* barely-there red tint over the site backdrop */
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Arial', sans-serif;   /* matches the site */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(10px);        /* same as site cards */
}
#kg-overlay.kg-visible {
  opacity: 1;
  pointer-events: all;
}

/* ──────────────── PANEL ──────────────── */
#kg-panel {
  position: relative;
  background: var(--kg-glass);        /* dark glass instead of light glass */
  border: 1px solid var(--kg-border);
  border-radius: 10px;                /* exactly matches .nav-section */
  width: min(580px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(192, 57, 43, 0.12);  /* faint red outline — the only "dark side" tell */
  padding: 2rem;                      /* same as .nav-section */
  animation: kg-enter 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}
#kg-panel::-webkit-scrollbar { width: 4px; }
#kg-panel::-webkit-scrollbar-track { background: transparent; }
#kg-panel::-webkit-scrollbar-thumb { background: rgba(192,57,43,0.4); border-radius: 2px; }

@keyframes kg-enter {
  from { transform: translateY(-20px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0)     scale(1);    opacity: 1; }
}

/* ──────────────── HEADER ──────────────── */
.kg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.kg-title {
  font-size: 1.1rem;                  /* matches .nav-section h3 size roughly */
  font-weight: bold;
  color: var(--kg-accent);            /* same as site headings, but darker red */
  letter-spacing: 0.02em;
}
.kg-close {
  background: none;
  border: none;
  color: var(--kg-dim);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: color 0.2s;
  padding: 0.2rem 0.5rem;
}
.kg-close:hover { color: var(--kg-danger); }

/* ──────────────── SCREENS ──────────────── */
.kg-screen { display: none; }
.kg-screen.kg-active { display: block; }

/* ──────────────── INTRO / STATUS ──────────────── */
.kg-access-banner {
  text-align: center;
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--kg-accent);
  margin: 0.5rem 0 1.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);  /* same as site h1 */
}

.kg-streak-wrap {
  text-align: center;
  margin: 0.5rem 0 1.2rem;
}
.kg-streak-num {
  display: block;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--kg-accent);
  text-shadow: 2px 2px 6px rgba(0,0,0,0.6);
  line-height: 1;
}
.kg-streak-lbl {
  font-size: 0.85rem;
  color: var(--kg-subtext);
  margin-top: 0.3rem;
}

.kg-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 1rem 0;
}
.kg-status-item {
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 0.8rem;
  background: rgba(0,0,0,0.3);
  color: var(--kg-subtext);
  text-align: center;
}
.kg-status-item.done    { border-color: var(--kg-success); color: var(--kg-success); background: rgba(111,207,151,0.08); }
.kg-status-item.pending { border-color: rgba(255,255,255,0.2); color: var(--kg-subtext); }
.kg-status-item.warn    { border-color: var(--kg-accent2); color: var(--kg-accent2); background: rgba(192,57,43,0.1); }

/* ──────────────── SETUP ──────────────── */
.kg-setup-label {
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--kg-accent);
  margin-bottom: 0.5rem;
  display: block;
}
.kg-code-box {
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 0.4em;
  color: var(--kg-text);
  text-align: center;
  padding: 0.9rem;
  border-radius: 8px;
  border: 1px solid rgba(192,57,43,0.5);
  background: rgba(0,0,0,0.4);
  margin: 0.8rem 0;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  user-select: all;
}
.kg-code-box:hover {
  background: rgba(192,57,43,0.1);
  border-color: rgba(192,57,43,0.8);
}
.kg-copy-hint {
  font-size: 0.75rem;
  color: var(--kg-dim);
  text-align: center;
  margin-bottom: 0.5rem;
}

/* ──────────────── BUTTONS ──────────────── */
/* Match site's implicit button style with the dark-side tint */
.kg-btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: var(--kg-text);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-decoration: none;
}
.kg-btn:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.4);
}
.kg-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* primary = site's #ff6b6b style action */
.kg-btn.primary {
  background: rgba(192, 57, 43, 0.25);
  border-color: rgba(192, 57, 43, 0.6);
  color: #f0a090;
}
.kg-btn.primary:hover {
  background: rgba(192, 57, 43, 0.4);
  border-color: rgba(192, 57, 43, 0.9);
  color: #ffffff;
}

/* accent = secondary action */
.kg-btn.accent {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
  color: var(--kg-subtext);
}
.kg-btn.accent:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.35);
  color: var(--kg-text);
}

/* danger = destructive action (leave room) */
.kg-btn.danger {
  background: rgba(235,87,87,0.12);
  border-color: rgba(235,87,87,0.45);
  color: #eb8a8a;
}
.kg-btn.danger:hover {
  background: rgba(235,87,87,0.25);
  border-color: rgba(235,87,87,0.75);
  color: #ffffff;
}

/* leave room link-style trigger */
.kg-leave-row {
  text-align: center;
  margin-top: 0.8rem;
}
.kg-btn-leave {
  background: none;
  border: none;
  color: rgba(255,255,255,0.25);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.1);
  padding: 0.2rem 0.5rem;
  transition: color 0.2s;
}
.kg-btn-leave:hover { color: var(--kg-danger); text-decoration-color: var(--kg-danger); }

/* leave confirm inline block */
.kg-confirm-row {
  margin-top: 0.8rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  background: rgba(235,87,87,0.07);
  border: 1px solid rgba(235,87,87,0.25);
}
.kg-confirm-msg {
  display: block;
  font-size: 0.8rem;
  color: #eb8a8a;
  text-align: center;
}

.kg-btn-row {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  margin: 1.1rem 0;
  flex-wrap: wrap;
}

/* ──────────────── INPUT ──────────────── */
.kg-input {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: var(--kg-text);
  font-family: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.8rem;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.kg-input:focus { border-color: rgba(192,57,43,0.7); }
.kg-input.lg {
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  text-align: center;
  text-transform: uppercase;
}
.kg-input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0;
}
.kg-input-lbl {
  font-size: 0.8rem;
  color: var(--kg-subtext);
  white-space: nowrap;
  min-width: 60px;
}

/* ──────────────── PUZZLE SCREEN ──────────────── */
.kg-puzzle-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}
.kg-puzzle-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--kg-accent);
  text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
}
.kg-role-tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.25);
  color: var(--kg-subtext);
  background: rgba(0,0,0,0.3);
}
.kg-role-tag.p1 {
  border-color: rgba(192,57,43,0.6);
  color: #f0a090;
  background: rgba(192,57,43,0.1);
}
.kg-role-tag.p2 {
  border-color: rgba(224,112,80,0.6);
  color: #f0c0a0;
  background: rgba(224,112,80,0.1);
}

.kg-puzzle-desc {
  font-size: 0.88rem;
  color: var(--kg-subtext);
  line-height: 1.65;
  margin-bottom: 1rem;
}
.kg-puzzle-desc b { color: var(--kg-text); }

/* Canvas wrapper */
.kg-canvas-wrap {
  display: flex;
  justify-content: center;
  margin: 0.8rem 0;
  overflow: hidden;
  border-radius: 8px;
}
#kg-canvas {
  display: block;
  cursor: pointer;
  image-rendering: pixelated;
  border-radius: 6px;
}

/* Memory countdown */
.kg-countdown {
  font-size: 3rem;
  font-weight: bold;
  text-align: center;
  color: var(--kg-accent);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
  margin: 0.5rem 0;
  animation: kg-pulse 1s infinite;
}
@keyframes kg-pulse { 0%,100% { opacity:1; } 50% { opacity:0.55; } }

/* Symbol palette for memory puzzle */
.kg-sym-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin: 0.6rem 0;
}
.kg-sym-btn {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  color: var(--kg-text);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.kg-sym-btn:hover  { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.12); }
.kg-sym-btn.kg-sel {
  border-color: rgba(192,57,43,0.8);
  background: rgba(192,57,43,0.2);
  color: #f0a090;
}

/* Weight inputs */
.kg-weight-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin: 0.8rem 0;
}
.kg-weight-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}
.kg-weight-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid currentColor;
}
.kg-weight-inp {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  color: var(--kg-text);
  font-family: inherit;
  font-size: 1rem;
  text-align: center;
  padding: 0.3rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.kg-weight-inp:focus { border-color: rgba(192,57,43,0.7); }

/* ──────────────── RESULT ──────────────── */
.kg-result-score {
  font-size: 3.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--kg-success);
  text-shadow: 1px 1px 8px rgba(111,207,151,0.35);
  margin: 0.5rem 0;
  display: block;
}
.kg-result-label {
  font-size: 0.8rem;
  color: var(--kg-subtext);
  text-align: center;
  display: block;
  margin-bottom: 1rem;
}

/* ──────────────── SHARED ──────────────── */
.kg-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.12);
  margin: 1.1rem 0;
}
.kg-msg {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--kg-subtext);
  text-align: center;
}
.kg-msg.left { text-align: left; }
.kg-msg b { color: var(--kg-text); }
.kg-msg .accent { color: var(--kg-accent2); }
.kg-loading {
  text-align: center;
  color: var(--kg-dim);
  font-size: 0.85rem;
  padding: 1rem 0;
  animation: kg-pulse 1.2s infinite;
}
.kg-error {
  color: var(--kg-danger);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(235,87,87,0.4);
  background: rgba(235,87,87,0.08);
  margin: 0.5rem 0;
}
.kg-info {
  font-size: 0.8rem;
  color: var(--kg-subtext);
  text-align: center;
  margin: 0.4rem 0;
  line-height: 1.5;
}
