/* ============================================================
   PRE-BONK: deliberately bland phishing-quality login.
   No personality on purpose. The blandness is the trap.
   ============================================================ */

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

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  background: #fff;
  color: #111;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100dvh;
}

.shake-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-form {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.25rem;
}

.login-form label {
  font-size: clamp(1.5rem, 5.5vw, 2.25rem);
  font-weight: 500;
  text-align: center;
  color: #111;
  letter-spacing: -0.01em;
}

.input-shell {
  position: relative;
  width: 100%;
}

#password {
  width: 100%;
  font: inherit;
  font-size: clamp(4.5rem, 18vw, 9rem);
  line-height: 1.1;
  letter-spacing: 0.15em;
  padding: 0.2rem 0.4rem 0.35rem;
  border: none;
  border-bottom: 4px solid #111;
  background: transparent;
  color: #111;
  outline: none;
  border-radius: 0;
  text-align: center;
  position: relative;
  z-index: 0;
}

/* When the dots overflow, fade the edge that has hidden content. */
.input-shell.overflow-left #password {
  -webkit-mask-image: linear-gradient(to right, transparent 0, rgba(0,0,0,0.2) 8%, #000 22%);
          mask-image: linear-gradient(to right, transparent 0, rgba(0,0,0,0.2) 8%, #000 22%);
}
.input-shell.overflow-right #password {
  -webkit-mask-image: linear-gradient(to left, transparent 0, rgba(0,0,0,0.2) 8%, #000 22%);
          mask-image: linear-gradient(to left, transparent 0, rgba(0,0,0,0.2) 8%, #000 22%);
}
.input-shell.overflow-left.overflow-right #password {
  -webkit-mask-image: linear-gradient(to right,
    transparent 0, rgba(0,0,0,0.2) 6%, #000 18%, #000 82%, rgba(0,0,0,0.2) 94%, transparent 100%);
          mask-image: linear-gradient(to right,
    transparent 0, rgba(0,0,0,0.2) 6%, #000 18%, #000 82%, rgba(0,0,0,0.2) 94%, transparent 100%);
}

.overflow-arrow {
  position: absolute;
  top: 50%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(2.5rem, 8vw, 4rem);
  line-height: 1;
  color: #111;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease-out;
  z-index: 2;
  transform: translateY(-55%);
  font-weight: 700;
}
.overflow-arrow.left  { left:  -0.1rem; }
.overflow-arrow.right { right: -0.1rem; }

.input-shell.overflow-left  .overflow-arrow.left  { opacity: 1; animation: overflowNudgeLeft  1.1s ease-in-out infinite; }
.input-shell.overflow-right .overflow-arrow.right { opacity: 1; animation: overflowNudgeRight 1.1s ease-in-out infinite; }

@keyframes overflowNudgeLeft {
  0%, 100% { transform: translate(0, -55%); }
  50%      { transform: translate(-7px, -55%); }
}
@keyframes overflowNudgeRight {
  0%, 100% { transform: translate(0, -55%); }
  50%      { transform: translate(7px, -55%); }
}

@media (prefers-reduced-motion: reduce) {
  .input-shell.overflow-left  .overflow-arrow.left,
  .input-shell.overflow-right .overflow-arrow.right { animation: none; }
}

#password:focus {
  border-bottom-color: #2f6fed;
}

#submit-btn {
  font: inherit;
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  background: #111;
  border: none;
  border-radius: 0;
  padding: 0.75rem 1rem;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: background 0.12s;
}
#submit-btn:hover  { background: #2a2a2a; }
#submit-btn:active { background: #000; }

/* ============================================================
   SCREEN SHAKE on submit. Triggered by .shaking class on body.
   ============================================================ */

@keyframes screenShake {
  0%   { transform: translate(0, 0)         rotate(0); }
  10%  { transform: translate(-12px, -8px)  rotate(-1deg); }
  20%  { transform: translate(10px, 6px)    rotate(1deg); }
  30%  { transform: translate(-9px, 9px)    rotate(-0.8deg); }
  40%  { transform: translate(8px, -7px)    rotate(0.6deg); }
  50%  { transform: translate(-6px, 5px)    rotate(-0.4deg); }
  60%  { transform: translate(5px, -4px)    rotate(0.3deg); }
  70%  { transform: translate(-3px, 3px)    rotate(-0.2deg); }
  80%  { transform: translate(2px, -2px)    rotate(0.1deg); }
  90%  { transform: translate(-1px, 1px)    rotate(0); }
  100% { transform: translate(0, 0)         rotate(0); }
}

body.shaking .shake-wrap {
  animation: screenShake 0.7s cubic-bezier(.36,.07,.19,.97) both;
}

/* ============================================================
   RED FLASH on bonk impact.
   ============================================================ */

.flash {
  position: fixed;
  inset: 0;
  background: #ff2a2a;
  pointer-events: none;
  opacity: 0;
  z-index: 999;
}

@keyframes flashImpact {
  0%   { opacity: 0; }
  8%   { opacity: 0.85; }
  100% { opacity: 0; }
}

body.flashing .flash {
  animation: flashImpact 0.5s ease-out both;
}

/* ============================================================
   BONK OVERLAY — total tonal whiplash. Yellow + red, heavy type.
   ============================================================ */

.bonk-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  background: #fde047;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.0) 0 24px,
      rgba(255,42,42,0.08) 24px 48px
    );
  overflow-y: auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

body.bonked .bonk-overlay {
  display: block;
  animation: overlayIn 0.18s ease-out both;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Dog comes SWINGING down from upper-right corner. */

.bonk-img {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto 1rem;
  transform-origin: 80% 20%;
  transform: translate(60%, -80%) rotate(45deg) scale(1.1);
  opacity: 0;
}

body.bonked .bonk-img {
  animation: bonkSwing 0.55s cubic-bezier(.55,.085,.68,.53) both;
}

@keyframes bonkSwing {
  0% {
    transform: translate(60%, -80%) rotate(45deg) scale(1.1);
    opacity: 0;
  }
  35% {
    transform: translate(30%, -40%) rotate(25deg) scale(1.1);
    opacity: 1;
  }
  70% {
    transform: translate(0, 0) rotate(-6deg) scale(1.05);
    opacity: 1;
  }
  85% {
    transform: translate(0, 0) rotate(2deg) scale(1.02);
  }
  100% {
    transform: translate(0, 0) rotate(0) scale(1);
    opacity: 1;
  }
}

.bonk-content {
  max-width: 38rem;
  margin: 0 auto;
  text-align: center;
  color: #1a1a1a;
}

.bonk-headline {
  font-family: Impact, "Haettenschweiler", "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.6rem, 12vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: #c81d1d;
  -webkit-text-stroke: 2px #000;
  text-shadow: 4px 4px 0 #000;
  margin: 0.25rem 0 0.6rem;
  transform: rotate(-2deg);
}

.bonk-subhead {
  font-family: "Comic Sans MS", "Chalkboard SE", cursive;
  font-size: clamp(1.05rem, 4vw, 1.5rem);
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 auto 1.4rem;
  max-width: 28rem;
  line-height: 1.25;
}

.bonk-explainer {
  background: #1a1a1a;
  color: #fde047;
  padding: 1rem 1.1rem;
  border-radius: 2px;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: left;
  margin: 0 auto 1.2rem;
  max-width: 26rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.bonk-explainer p { margin: 0 0 0.5rem; }
.bonk-explainer p:last-child { margin: 0; }
.bonk-cta {
  color: #fff;
  font-weight: 700;
  padding-top: 0.4rem;
  border-top: 1px dashed #fde04766;
}

.counter {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.95rem;
  color: #1a1a1a;
  background: #fff;
  border: 2px solid #1a1a1a;
  padding: 0.5rem 0.85rem;
  display: inline-block;
  margin: 0 auto 1.3rem;
  transform: rotate(1.2deg);
}
.counter #counter-num {
  font-weight: 700;
  color: #c81d1d;
  font-size: 1.1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.6rem;
}

.actions button {
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  border: 3px solid #1a1a1a;
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  border-radius: 0;
  box-shadow: 4px 4px 0 #1a1a1a;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
}
.actions button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 #1a1a1a;
}
.actions button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #1a1a1a;
}

.btn-share { background: #1a1a1a; color: #fde047; }
.btn-again { background: #fff; color: #1a1a1a; }

.footer-tiny {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: #1a1a1a99;
  margin-top: 1.5rem;
}
.footer-tiny a {
  color: inherit;
  text-decoration: underline;
}

/* Copy-confirmation toast styled to match the bonk vibe. */
.bonk-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) rotate(-1.5deg);
  padding: 0.55rem 0.95rem;
  background: #1a1a1a;
  color: #fde047;
  border: 2px solid #fde047;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.18s;
}

/* Respect reduced-motion: skip the shake + swing, keep the rest. */
@media (prefers-reduced-motion: reduce) {
  body.shaking .shake-wrap { animation: none; }
  body.bonked .bonk-img { animation: none; opacity: 1; transform: none; }
  body.flashing .flash { animation: none; }
}

@media (max-width: 480px) {
  .login-card { padding: 1.5rem 1.25rem; }
  .bonk-overlay { padding: 1rem 0.9rem 2rem; }
  .bonk-headline { text-shadow: 3px 3px 0 #000; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions button { width: 100%; }
}
