/* Hide any element with [hidden] attribute */
[hidden] { display: none !important; }

/* =========================
   BRANDING
   ========================= */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 6px 0 10px 0;
}
.brand-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #2d3748;
}
.brand-sub {
  font-size: .95rem;
  font-weight: 700;
  color: #64748b;
}

/* =========================
   BASE (theme & structure)
   ========================= */
body {
  font-family: 'Inter', sans-serif;
  color: #333;
  padding: 20px;
  min-height: 100vh;
  position: relative;
  background: linear-gradient(180deg, #f6f7fb 0%, #eef2f7 100%);
  background-attachment: fixed;
  background-position: center;
}

/* Abbie-only theme (parchment + Hufflepuff-ish accent) */
body.theme-abbie {
  background-image: url('https://media.posterstore.com/site_images/68631b2525436f8361d7683a_591036804_WB0015-5.jpg');
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}

.hidden { display: none !important; }

/* Read-only visual hint */
.app.readonly { opacity: 0.92; filter: saturate(0.85); }

/* =========================
   FAMILY GATE
   ========================= */
.gate {
  position: fixed;
  inset: 0;
  background: #fff;
  display: grid;
  place-items: center;
  z-index: 1000;
}
.gate-card {
  width: min(560px, 92vw);
  padding: 28px;
  border-radius: 16px;
  text-align: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 40px rgba(0,0,0,.08);
}
.gate-card h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 8px;
}
.gate-help { margin: 0 0 18px; color: #4a5568; }
.gate-inputs {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.gate-box {
  width: 48px;
  height: 56px;
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
  text-align: center;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 0;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(0,0,0,.03);
  transition: border-color .15s, box-shadow .15s, transform .05s;
}
.gate-box:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102,126,234,.25);
}
.gate-btn {
  display: inline-block;
  width: 100%;
  margin-top: .5rem;
  padding: 10px 16px;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  background: #667eea;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(102,126,234,.25);
}
.gate-btn:hover { filter: brightness(1.05); }
.gate-error { margin-top: 10px; color: #b00020; min-height: 1.2em; }

.gate-code-help {
  margin: 14px 0 0;
  text-align: center;
}

.gate-code-help a {
  font-weight: 700;
}

/* Help link under inputs */
#open-help{
  display:inline-block;
  font-weight:700;
  color:#4f46e5;
  text-decoration:none;
  opacity:.95;
}
#open-help:hover{ text-decoration:underline; opacity:1; }

/* Help modal (opened inline on this page) */
#help-modal { background: rgba(0,0,0,.45) !important; }
#help-modal > div{
  background:#ffffff !important;
  color:#000 !important;
  border:1px solid #e5e7eb !important;
  border-radius:16px !important;
  box-shadow:0 20px 60px rgba(0,0,0,.25) !important;
}

/* ===== Gate styles restore ===== */
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(15,23,42,.72); z-index: 50; }
.gate-card {
  width: min(720px, 92vw);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  padding: 20px;
  text-align: center;
}
#gate-title { font-size: 1.6rem; font-weight: 800; margin: 6px 0 4px; }
.gate-help { color: #475569; margin-bottom: 14px; }
.gate-inputs { display: grid; grid-auto-flow: column; gap: 14px; justify-content: center; margin: 10px 0 16px; }
.gate-box {
  width: 64px; height: 72px;
  border: 1px solid #e5e7eb; border-radius: 14px;
  text-align: center; font-size: 1.7rem; font-weight: 800;
  box-shadow: 0 2px 0 #f1f5f9 inset;
}
.gate-box:focus { outline: 3px solid #93c5fd; border-color: #93c5fd; }
.gate-actions { margin-top: 6px; }

/* Button matches your blue rounded version */
#gate-join {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-radius: 12px;
  background: #6366f1;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(99,102,241,.35);
  transition: background .15s ease-in-out, transform .02s;
}
#gate-join:hover { background: #4f46e5; }
#gate-join:active { transform: translateY(1px); }

/* “Need a family code? Learn how” link */
.gate-card a { color: #6366f1; text-decoration: underline; }
.gate-card a:hover { color: #4f46e5; }

/* ===== Gate styles restore ===== */
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(15,23,42,.72); z-index: 50; }
.gate-card {
  width: min(720px, 92vw);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  padding: 20px;
  text-align: center;
}
#gate-title { font-size: 1.6rem; font-weight: 800; margin: 6px 0 4px; }
.gate-help { color: #475569; margin-bottom: 14px; }
.gate-inputs { display: grid; grid-auto-flow: column; gap: 14px; justify-content: center; margin: 10px 0 16px; }
.gate-box {
  width: 64px; height: 72px;
  border: 1px solid #e5e7eb; border-radius: 14px;
  text-align: center; font-size: 1.7rem; font-weight: 800;
  box-shadow: 0 2px 0 #f1f5f9 inset;
}
.gate-box:focus { outline: 3px solid #93c5fd; border-color: #93c5fd; }
.gate-actions { margin-top: 6px; }

/* Button matches your blue rounded version */
#gate-join {
  width: 100%;
  padding: 12px 0;
  border: none;
  border-radius: 12px;
  background: #6366f1;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(99,102,241,.35);
  transition: background .15s ease-in-out, transform .02s;
}
#gate-join:hover { background: #4f46e5; }
#gate-join:active { transform: translateY(1px); }

/* “Need a family code? Learn how” link */
.gate-card a { color: #6366f1; text-decoration: underline; }
.gate-card a:hover { color: #4f46e5; }

/* Keep all eight family-code boxes visible on phones.
   This must remain after the restored desktop gate rules above. */
@media (max-width: 600px) {
  .gate {
    box-sizing: border-box;
    overflow-y: auto;
    padding: 12px;
  }

  .gate-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 420px;
    padding: 20px 14px;
  }

  .gate-inputs {
    grid-auto-flow: initial;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
  }

  .gate-box {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 52px;
    border-radius: 10px;
    font-size: 1.35rem;
  }
}

