@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Roboto', sans-serif;
  background: #f1f2f6;
  min-height: 100vh;
  overscroll-behavior: none;
  color: #000;
}

/* ─── Layout ─── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: auto;
  padding-top: 12px; /* give extra space above the title image */
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
}

#header-title {
  text-align: center;
  pointer-events: all;
}

#header-title img {
  height: 72px; /* larger logo */
  max-width: 240px;
  margin-top: 6px; /* nudge image down from very top */
}

#header-level {
  color: #888;
  font-size: 17px;
  font-weight: 300;
  margin-top: 4px;
}

#content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 16px 80px;
}

#footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: #191919;
  z-index: 50;
}

#footer-reset {
  background: #1f9845;
  color: #fff;
  cursor: pointer;
  padding: 10px 15px;
  user-select: none;
  margin: 20px;
}

#footer-reset:hover { background: #14652d; }

#footer-text {
  background: #f6f6f6;
  border-top-left-radius: 10px;
  padding: 10px 16px;
}


/* ─── Grid Captcha (shared) ─── */
.captcha-container {
  border: 1px solid #d3d3d3;
  border-radius: 0;
  box-shadow: 0 1px 3px 1px rgba(0,0,0,.06);
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  margin: 0 auto;
  max-width: 460px;
  padding: 6px;
  width: 100%;
}

.captcha-title {
  background: #1c74e0;
  color: #fff;
  font-size: 16px;
  padding: 16px;
}

.captcha-title-type {
  font-size: 25px;
  font-weight: 700;
  margin-top: 1px;
}

.captcha-content { margin-top: 2px; position: relative; }

.captcha-controls {
  align-items: center;
  border-top: 1px solid #d3d3d3;
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  padding-left: 8px;
  padding-top: 4px;
}

.captcha-refresh {
  cursor: pointer;
  height: 24px;
  user-select: none;
  user-drag: none;
  -webkit-user-drag: none;
  width: 24px;
  margin-right: 15px;
}

.captcha-refresh.spinning { animation: rotate .5s ease-out forwards; }

@keyframes rotate { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.captcha-timer {
  font-size: 24px;
  color: red;
  font-weight: bold;
}

.captcha-timer.negative {
  color: red;
  animation: panic 0.3s infinite alternate;
}

@keyframes panic {
  from {
    transform: rotate(-2deg);
  }
  to {
    transform: rotate(2deg);
  }
}


.verify-btn {
  background: #1c74e0;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 17px;
  margin-left: auto;
  margin-top: 3px;
  padding: 10px 20px;
  transition: background-color .15s ease-in-out;
}

.verify-btn:hover { background: #1559ad; }
.verify-btn:active { transform: scale(.98); }

.verify-btn.wrong {
  animation: wrongShake .25s ease-in-out 3;
  pointer-events: none;
  transform-origin: center center;
}

@keyframes wrongShake {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(6deg); }
  50% { transform: rotate(0deg); }
  75% { transform: rotate(-6deg); }
}


/* ─── Grid ─── */
.grid-inner {
  display: grid;
  position: relative;
}

.grid-item {
  aspect-ratio: 1/1;
  border: 2px solid #fff;
  cursor: pointer;
  height: 100%;
  position: relative;
  transition: scale .12s ease-out;
  user-select: none;
  width: 100%;
  z-index: 3;
}

.grid-item.selected { outline-offset: -4px; scale: .75; }

.grid-item.selected::after {
  background-color: #1c74e0;
  background-image: url("assets/checkmark-white.svg");
  background-position: 50%;
  background-repeat: no-repeat;
  background-size: 20px;
  border-radius: 50%;
  box-shadow: 0 1px 3px 1px rgba(0,0,0,.1);
  content: "";
  height: 32px;
  left: -14px;
  position: absolute;
  top: -14px;
  width: 32px;
}

.grid-item.disabled { pointer-events: none; }


/* ─── Reset Modal ─── */
#modal-overlay {
  display: none;
  font-size: 17px;
  height: 100%;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 999999;
}

#modal-overlay.visible { display: block; }

#modal-bg {
  animation: bgFade .15s linear forwards;
  background: rgba(0,0,0,.35);
  height: 100%;
  left: 0;
  opacity: 0;
  position: fixed;
  top: 0;
  width: 100%;
}

@keyframes bgFade { 0% { opacity: 0; } 100% { opacity: 1; } }

#modal-box {
  background: #fff;
  border-radius: 10px;
  left: 50%;
  max-width: 330px;
  padding: 30px 0;
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%,-50%);
  width: 100%;
}

#modal-box h2 { font-size: 17px; font-weight: 400; padding: 0 20px; }

.modal-btns { display: flex; gap: 5px; justify-content: center; margin-top: 15px; }

.modal-btn {
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 3px;
  box-shadow: 2px 2px 4px rgba(0,0,0,.05);
  color: #000;
  cursor: pointer;
  font-size: 15px;
  padding: 8px 30px;
}

.modal-btn:hover { background: #1c74e0; border-color: #000; color: #fff; }
.modal-btn.cancel:hover { background: #eee; border-color: #000; color: #000; }

/* ─── Responsive ─── */
@media (max-width: 700px) {
  #content { padding-top: 120px; }
  #header { height: 100px; flex-direction: column; }
}

/* ─── Timer easter egg ─── */
.captcha-timer-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.captcha-timer-tooltip {
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #222;
  color: white;
  font-size: 12px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 9999;
}

.captcha-timer-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #222 transparent transparent transparent;
}

.captcha-timer-wrap:hover .captcha-timer-tooltip {
  opacity: 1;
}