/* ==========================
   Theme (matches login page)
   ========================== */
:root{
  /* Background (main page color) */
  --bg0: #071225;   /* deep navy */
  --bg1: #050a14;   /* near-black blue */

  /* Text / whites */
  --text: rgba(255,255,255,0.94);
  --muted: rgba(255,255,255,0.68);

  /* Glass card */
  --card: rgba(255,255,255,0.08);
  --cardBorder: rgba(255,255,255,0.16);

  /* Brand accents (ORANGE + BLUE) as RGB for easy alpha */
  --accent-rgb: 255 122 24;   /* orange */
  --accent2-rgb: 59 130 246;  /* blue */

  /* Feedback colors */
  --good: rgba(34,197,94,0.20);
  --goodBorder: rgba(34,197,94,0.42);
  --bad: rgba(244,63,94,0.18);
  --badBorder: rgba(244,63,94,0.42);

  --shadow: 0 22px 70px rgba(0,0,0,0.45);
  --radius: 18px;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }

/* ==========================
   Layout (keep your behavior)
   ========================== */
body{
  margin:0;
  min-height:100vh;
  display:grid;
  place-items:center;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);

  /* Same “cool” background as login */
  background:
    radial-gradient(1200px 700px at 15% 10%, rgb(var(--accent-rgb) / 0.26), transparent 55%),
    radial-gradient(900px 600px at 85% 30%, rgb(var(--accent2-rgb) / 0.22), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(255,255,255,0.08), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  padding: 28px 16px;
}

/* ==========================
   Animations (keep yours)
   ========================== */
@keyframes pop-in{
  0%{ opacity:0; transform: scale(0.1); }
  100%{ opacity:1; transform: scale(1); }
}

/* Optional: a gentle “float” on the card (subtle) */
@keyframes floaty{
  0%,100%{ transform: translateY(0); }
  50%{ transform: translateY(-2px); }
}

/* ==========================
   Card (new look, same sizing)
   ========================== */
.card{
  width:min(700px, 92vw);
  /* Let the card grow if results/buttons need more space */
  min-height: 680px;
  height: auto;

  background: var(--card);
  border: 1px solid var(--cardBorder);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  padding:48px 28px;
  text-align:center;

  position: relative;
  overflow: hidden;

  /* keeps it feeling “alive” without being distracting */
  animation: floaty 6s ease-in-out infinite;
}

/* top glow line */
.card::before{
  content:"";
  position:absolute;
  top:0; left:0;
  width:100%;
  height:2px;
  background: linear-gradient(
    90deg,
    rgb(var(--accent-rgb) / 0.60),
    rgb(var(--accent2-rgb) / 0.50)
  );
  opacity: 0.9;
}

/* corner glow blob */
.card::after{
  content:"";
  position:absolute;
  width:240px;
  height:240px;
  border-radius:999px;
  top:-110px;
  right:-110px;
  background: radial-gradient(circle at 30% 30%, rgba(124,58,237,0.35), transparent 60%);
  filter: blur(4px);
  pointer-events:none;
}

/* ==========================
   Typography
   ========================== */
h1{
  margin:0 0 24px;
  font-size: 48px;
  line-height: 1.05;
  letter-spacing: 0.2px;
  font-weight: 850;
  text-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

/* ==========================
   Controls (same flex behavior)
   ========================== */
.controls{
  display:flex;
  justify-content:center;
  gap:12px;
  margin-bottom:18px;
  flex-wrap:wrap;
}

/* ==========================
   Buttons (new look)
   ========================== */
button{
  font-size:16px;
  padding:10px 14px;

  border-radius:12px;
  cursor:pointer;

  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);

  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

button:hover{
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}

button:active{
  transform: translateY(1px); /* keep your press effect */
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

button:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px rgba(34,211,238,0.12), 0 10px 25px rgba(0,0,0,0.25);
}

/* Make “Enter” feel primary (if present) */
#submitBtn{
  background: linear-gradient(
    135deg,
    rgb(var(--accent-rgb) / 0.92),
    rgb(var(--accent2-rgb) / 0.82)
  );
  border: 1px solid rgba(255,255,255,0.18);
}
#submitBtn:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0,0,0,0.35);
}
#logoutBtn{
  margin-top: 2px;
}

#playArchiveBtn2{
  margin-top: 22px;
}

#showStatsBtn{
  margin-top: 22px;
}

/* ==========================
   Input (keep your sizing logic)
   ========================== */
.word-input{
  border:none;
  background: rgba(10, 12, 22, 0.30);
  outline:none;

  width: 8ch;
  min-width: 6ch;
  max-width: 90%;

  font-size:28px;
  padding: 10px 10px;
  text-align:center;

  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 10px 25px rgba(0,0,0,0.18);

  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}

.word-input::placeholder{
  color: rgba(255,255,255,0.50);
}

.word-input:focus{
  border-color: rgba(34,211,238,0.55);
  box-shadow: 0 0 0 4px rgba(34,211,238,0.12), 0 10px 25px rgba(0,0,0,0.25);
}

.word-input:active{
  transform: translateY(0.5px);
}

/* Keep your spacing under input */
#guessForm{
  margin-bottom: 28px;
}

/* ==========================
   Results (keep your display/grid)
   ========================== */
.results{
  margin-top: 28px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

/* Results cards — upgraded look but same sizes/classes */
.results-card{
  width: min(200px, 90%);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(10, 12, 22, 0.28);
  box-shadow: 0 10px 25px rgba(0,0,0,0.18);
  color: rgba(255,255,255,0.88);
}

/* Keep your pop-in animation + new “success/fail” styling */
.results-card.correct{
  animation-name: pop-in;
  animation-duration: 0.25s;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;

  background: var(--good);
  border-color: var(--goodBorder);
  color: rgba(220, 255, 235, 0.95);
}

.results-card.wrong{
  animation-name: pop-in;
  animation-duration: 0.5s;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;

  background: var(--bad);
  border-color: var(--badBorder);
  color: rgba(255, 220, 230, 0.95);
}

/* ==========================
   Utility
   ========================== */
.hidden{ display: none; }

/* Restart button (keep your animation + upgrade style) */
.restart-btn{
  animation-name: pop-in;
  animation-duration: 0.35s;
  animation-delay: 0.25s; /* fixed: needs "s" */
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;

  width: min(320px, 90%);
  margin-top: 12px;

  font-size: 16px;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;

  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.92);

  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.restart-btn:hover{
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}

.restart-btn:active{
  transform: translateY(2px); /* keep your deeper press */
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

/* ==========================
   Small screens
   ========================== */
@media (max-width: 420px){
  .card{
    padding: 28px 18px;
    height: auto; /* helps on very small screens */
  }

  h1{
    font-size: 34px;
    margin-bottom: 18px;
  }

  .word-input{
    font-size: 22px;
  }
}

/* ==========================
   Feedback + User meta card
   ========================== */
.feedback{
  min-height: 20px;
  margin: -6px 0 14px;
  color: rgba(255,255,255,0.75);
  font-size: 14px;
}

.meta-card{
  margin-top: 18px;
  width: min(520px, 92%);
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(10, 12, 22, 0.28);
  box-shadow: 0 10px 25px rgba(0,0,0,0.18);
  color: rgba(255,255,255,0.9);
  text-align: center;

  opacity: 0;
  transform: translateY(10px);
  transition: opacity 650ms ease, transform 650ms ease;
}

.meta-card.show{
  opacity: 1;
  transform: translateY(0);
}


/* ==========================
   Results overlay (logged-in users)
   ========================== */
.overlay{
  flex-direction: column;
  gap: 12px;
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;

  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);

  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
  z-index: 999;
}
.overlay.hidden{ display: none; }
.overlay.show{
  opacity: 1;
  pointer-events: auto;
}

.overlay-card{
  position: relative;
  width: min(300px, 96vw);
  transform: translateY(10px) scale(0.99);
  transition: transform 260ms ease;
}
.overlay.show .overlay-card{
  transform: translateY(0) scale(1);
}

.overlay .meta-card{
  margin-top: 0;
  width: 100%;
}

.overlay-close{
  position: static;
  align-self: center;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(10, 12, 22, 0.55);
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
.overlay-close:hover{
  filter: brightness(1.08);
}

.meta-card h2{
  margin: 0 0 8px;
  font-size: 18px;
}

.meta-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  font-size: 14px;
}

.meta-item{
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}
.meta-item .label{
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  margin-bottom: 3px;
}
.meta-item .value{
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

/* Footer stays at the bottom */
.site-footer {
  margin-top: auto;          /* key: pushes footer to bottom */
  padding: 16px 12px;
  text-align: center;
  opacity: 0.7;
  font-size: 0.9rem;
}

/* ==========================
   Clues (hint feedback)
   ========================== */
.clues{
  width: min(210px, 90%);
  margin: 6px auto 12px;
  padding: 10px 12px;

  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);

  background:
    linear-gradient(
      135deg,
      rgb(var(--accent2-rgb) / 0.14),
      rgba(255,255,255,0.06)
    );

  box-shadow:
    0 10px 22px rgba(0,0,0,0.16),
    0 0 0 1px rgba(255,255,255,0.05) inset;

  color: rgba(240, 250, 255, 0.92);
  font-size: 13.5px;
  line-height: 1.25;
  letter-spacing: 0.15px;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  /* Layout: icon + text evenly across fixed width */
  display: grid;
  grid-template-columns: 22px 1fr; /* icon column + text column */
  align-items: center;
  column-gap: 10px;
}

/* Lightbulb icon */
.clues::before{
  content: "💡";
  font-size: 16px;
  line-height: 1;
  opacity: 0.92;
  transform: translateY(-0.5px);
  justify-self: center;
}

/* Text span (keeps line breaks like "\n") */
.clues .clueText{
  display: block;
  text-align: left;
  white-space: pre-line; /* respects \n in textContent */
}

/* Pop-in animation (same keyframes you already have) */
.clues.reveal{
  animation-name: pop-in;
  animation-duration: 0.25s;
  animation-timing-function: ease-out;
  animation-fill-mode: both;
}

/* Optional: make the second clue feel more “urgent” (since you already use .urgent) */
.clues.urgent{
  background:
    linear-gradient(
      135deg,
      rgb(var(--accent-rgb) / 0.18),
      rgba(255,255,255,0.06)
    );
  border-color: rgba(255,255,255,0.18);
}

.clues.hidden { display: none; }

@media (max-width: 420px){
  .meta-grid{ grid-template-columns: 1fr; }
}

/* ==========================
   Mobile: normal page flow + scroll
   ========================== */
@media (max-width: 520px), (max-height: 740px){
  body{
    /* stop “center everything” behavior */
    display: block;
    min-height: 100vh;
    height: auto;

    /* allow natural scrolling */
    overflow-y: auto;

    /* comfortable mobile padding */
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 12px
             calc(env(safe-area-inset-bottom, 0px) + 14px);
  }

  .card{
    /* IMPORTANT: remove forced tall card */
    min-height: 0 !important;
    height: auto;

    /* normal proportions */
    width: min(700px, 94vw);
    padding: 22px 16px;
    margin: 0 auto 14px;

    /* optional: remove float animation on mobile */
    animation: none;
  }

  h1{
    font-size: 34px;
    margin: 0 0 16px;
  }

  .results{
    margin-top: 18px;
  }

  .site-footer{
    margin-top: 10px;
  }
}

/* Very small phones: keep buttons usable but don’t blow up layout */
@media (max-width: 380px){
  button{
    width: 100%;
  }

  .word-input{
    font-size: 22px;
  }
}

@media (max-width: 380px){
  .clues{
    width: min(220px, 94%);
    padding: 9px 11px;
    font-size: 13px;
  }
}
