/* ==========================================================================
   blockmail — Minecraft menu identity
   Stone-grey panels, thick dark frames, beveled edges (light top/left,
   dark bottom/right), blocky geometry, pixel type, green accents.
   Fonts: Silkscreen (OFL, self-hosted) for the menu; mono for values.
   ========================================================================== */

@font-face {
  font-family: 'Silkscreen';
  src: url('/fonts/silkscreen-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Silkscreen';
  src: url('/fonts/silkscreen-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #070b14;

  /* menu stone */
  --panel: #3b3d42;
  --panel-hi: rgba(255, 255, 255, 0.10);
  --panel-lo: rgba(0, 0, 0, 0.38);
  --frame: #0c0d10;
  --frame-inner: #55575d;

  /* buttons */
  --btn: #6e7075;
  --btn-hover: #7e8087;
  --btn-hi: #a2a4a9;
  --btn-lo: #3f4147;

  --ink: #e8eaf0;
  --ink-dim: #b9bfc8;
  --ink-faint: #828a94;
  --grass: #58c95b;
  --grass-bright: #7fe57f;
  --danger: #e86a5f;
  --warn: #e8b55f;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --pixel: 'Silkscreen', var(--mono);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Background: canvas stars + nebulae + WebGL voxel scene
   -------------------------------------------------------------------------- */

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#voxel-scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.nebula {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
  pointer-events: none;
  will-change: transform;
  animation: nebula-drift 160s ease-in-out infinite alternate;
}
.nebula-a {
  width: 60vmax; height: 60vmax;
  left: -15vmax; top: -20vmax;
  background: radial-gradient(circle at 40% 40%, #2a3f66 0%, transparent 65%);
}
.nebula-b {
  width: 55vmax; height: 55vmax;
  right: -20vmax; top: 10vmax;
  background: radial-gradient(circle at 60% 40%, #4d2a66 0%, transparent 65%);
  animation-delay: -50s;
  animation-duration: 210s;
}
.nebula-c {
  width: 45vmax; height: 45vmax;
  left: 20vmax; bottom: -25vmax;
  background: radial-gradient(circle at 50% 50%, #1f5246 0%, transparent 65%);
  animation-delay: -110s;
  animation-duration: 190s;
}

@keyframes nebula-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vmax, -3vmax, 0) scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  .nebula { animation: none !important; }
}

/* --------------------------------------------------------------------------
   Stage
   -------------------------------------------------------------------------- */

.stage {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.view {
  width: min(420px, 100%);
  text-align: center;
}

/* ---- brand + headline ----------------------------------------------------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.brand-logo {
  display: block;
  width: 28px;
  height: 28px;
  image-rendering: auto; /* keep the smooth provided artwork crisp */
}
.brand-name {
  font-family: var(--pixel);
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.7);
  white-space: nowrap;
}

.headline {
  font-family: var(--pixel);
  font-size: clamp(17px, 4.2vw, 22px);
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0 0 20px;
  color: var(--ink);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.7);
}

/* --------------------------------------------------------------------------
   Menu panel — grey stone window with beveled frame
   -------------------------------------------------------------------------- */

.menu-panel {
  background: var(--panel);
  border: 2px solid var(--frame-inner);
  box-shadow:
    0 0 0 2px var(--frame),
    inset 2px 2px 0 var(--panel-hi),
    inset -2px -2px 0 var(--panel-lo),
    0 6px 0 rgba(0, 0, 0, 0.4);
  padding: 18px;
  display: grid;
  /* minmax(0,1fr): the column must never size to content's max-content —
     that is what let the input row push buttons past the panel edge */
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  text-align: left;
}

.panel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.row-label {
  font-family: var(--pixel);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.7);
}

.discord-user {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--grass-bright);
  overflow-wrap: anywhere;
  min-width: 0;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.7);
}

.panel-divider {
  height: 2px;
  border-top: 2px solid rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ---- field ------------------------------------------------------------------ */

.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}

.input-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  background: #17181c;
  border: 2px solid var(--frame);
  box-shadow:
    inset 2px 2px 0 rgba(0, 0, 0, 0.55),
    inset -2px -2px 0 rgba(255, 255, 255, 0.05);
  transition: box-shadow 0.12s ease;
}
.input-wrap:focus-within {
  border-color: var(--grass);
  box-shadow:
    inset 2px 2px 0 rgba(0, 0, 0, 0.55),
    inset -2px -2px 0 rgba(255, 255, 255, 0.05),
    0 0 0 2px rgba(88, 201, 91, 0.35);
}
.input-wrap.bad { border-color: var(--danger); }
.input-wrap.bad:focus-within { box-shadow: 0 0 0 2px rgba(232, 106, 95, 0.3); }

#username {
  flex: 1;
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  padding: 11px 4px 11px 12px;
  caret-color: var(--grass-bright);
}
#username::placeholder { color: var(--ink-faint); }

.domain {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--grass-bright);
  padding-right: 12px;
  white-space: nowrap;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
}

.status {
  margin: 0 2px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-dim);
  font-family: var(--mono);
  overflow-wrap: anywhere;
}
.status:empty { display: none; }
.status.ok { color: var(--grass-bright); }
.status.err { color: var(--danger); }
.status.busy { color: var(--ink-faint); }

/* --------------------------------------------------------------------------
   Minecraft menu buttons — grey stone slab, beveled, no gradients
   -------------------------------------------------------------------------- */

.mc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  background: var(--btn);
  border: 2px solid var(--frame);
  color: #fff;
  font-family: var(--pixel);
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
  cursor: pointer;
  box-shadow:
    inset 2px 2px 0 var(--btn-hi),
    inset -2px -2px 0 var(--btn-lo),
    0 4px 0 rgba(0, 0, 0, 0.5);
  transition: background 0.1s ease, color 0.1s ease;
}
.mc-btn:hover {
  background: var(--btn-hover, #7e8087);
  color: #ffefa8; /* the classic menu hover tint */
}
.mc-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.mc-btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 2px 2px 0 var(--btn-lo),
    inset -2px -2px 0 var(--btn-hi),
    0 2px 0 rgba(0, 0, 0, 0.5);
}
.mc-btn:disabled {
  cursor: wait;
  filter: saturate(0.35) brightness(0.72);
}

.btn-spinner {
  width: 14px; height: 14px;
  display: none;
  background:
    conic-gradient(from 0deg, currentColor 0 25%, transparent 25% 100%);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-spinner { animation-duration: 3s; } }

.mc-btn.loading .btn-label { opacity: 0.8; }
.mc-btn.loading .btn-spinner { display: inline-block; }

/* mini chips (copy/show) */
.chip-row { display: inline-flex; gap: 6px; }
.mc-chip {
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--btn);
  border: 2px solid var(--frame);
  box-shadow:
    inset 2px 2px 0 var(--btn-hi),
    inset -2px -2px 0 var(--btn-lo),
    0 3px 0 rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: background 0.1s ease;
}
.mc-chip:hover { background: var(--btn-hover, #7e8087); }
.mc-chip:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45); }
.mc-chip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mc-chip.copied { color: var(--grass-bright); }

.captcha-slot { display: grid; place-items: center; }
.captcha-slot:empty { display: none; }
.gate-slot { display: grid; place-items: center; }
.gate-slot:empty { display: none; }

/* ---- gate view ---------------------------------------------------------------- */

.gate-card { text-align: center; }
.gate-copy {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-dim);
  line-height: 1.6;
}
#ad-slot { min-height: 40px; }

/* --------------------------------------------------------------------------
   Success screen
   -------------------------------------------------------------------------- */

.success-card { text-align: left; }

.cred-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.3);
}
.cred-row + .cred-row { padding-top: 12px; }

.cred-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.cred-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.email-value, .password-value {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
  word-break: break-all;
  min-width: 0;
}
.password-value {
  color: var(--grass-bright);
  letter-spacing: 0.12em;
}

.note {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--ink-dim);
  text-align: center;
  line-height: 1.5;
}
.note.dim { color: var(--ink-faint); font-family: var(--mono); font-size: 11.5px; }

.disclaimer {
  margin: 16px 0 0;
  font-size: 11px;
  color: var(--ink-faint);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Achievement toasts
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
  width: min(380px, calc(100vw - 24px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px 10px 12px;
  background: var(--panel);
  border: 2px solid var(--frame-inner);
  box-shadow:
    0 0 0 2px var(--frame),
    inset 2px 2px 0 var(--panel-hi),
    inset -2px -2px 0 var(--panel-lo),
    0 6px 0 rgba(0, 0, 0, 0.4);
  animation: toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  pointer-events: auto;
}
.toast.leaving { animation: toast-out 0.3s ease forwards; }
@keyframes toast-in { from { transform: translateY(-16px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation-duration: 0.01s; }
}

.toast-icon {
  width: 26px; height: 26px;
  flex: none;
  border: 2px solid var(--frame);
  background:
    linear-gradient(#57a64d 0 30%, transparent 30%),
    #6b4a2f;
  image-rendering: pixelated;
}
.toast.info .toast-icon {
  background:
    radial-gradient(circle at 50% 50%, #7fe0ef 0 34%, transparent 36%),
    #8a8f96;
}
.toast.warn .toast-icon,
.toast.err .toast-icon {
  background:
    linear-gradient(#e8b55f 0 30%, transparent 30%),
    #6b4a2f;
}

.toast-title {
  font-family: var(--pixel);
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.7);
}
.toast.ok .toast-title { color: var(--grass-bright); }
.toast.err .toast-title { color: var(--danger); }
.toast.warn .toast-title { color: var(--warn); }

.toast-sub {
  font-size: 12px;
  color: var(--ink-dim);
  margin: 1px 0 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .stage { padding: 24px 12px; }
  .menu-panel { padding: 14px; }
  #username { font-size: 15px; padding-left: 10px; }
  .domain { font-size: 11.5px; padding-right: 10px; }
  .cred-value { align-items: flex-start; flex-direction: column; }
}