/* ═══════════════════════════════════════════════
   ZCode Chat — Neumorphic Login
   Themes: default (blue-glass) | light | dark
   Used by: index.php, registration.php (via includes/login_view.php)
   ═══════════════════════════════════════════════ */

@font-face {
  font-family: 'Orbitron';
  src: url('../fonts/Orbitron.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  /* 13-glyph subset (~7 KB) of Noto Serif CJK JP Black — only the engraved sentence */
  font-family: 'ZC Mincho';
  src: url('../fonts/ja-engraved.woff2') format('woff2'),
       url('../fonts/ja-engraved.woff')  format('woff');
  font-weight: 900;
  font-display: block;
}

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

/* ── THEME TOKENS ── */
:root,
[data-theme="default"] {
  --bg-body:    #0a1525;
  --bg-body-2:  #2a4a6a;
  --circle-bg:  rgba(14, 30, 55, 0.92);
  --sh-hi:      rgba(255,255,255,.12);
  --sh-lo:      rgba(0,0,0,.72);
  --ring-hi:    rgba(0,170,255,.55);
  --ring-in-hi: rgba(0,170,255,.30);
  --ring-in-lo: rgba(0,0,0,.55);
  --in-hi:      rgba(255,255,255,.06);
  --in-lo:      rgba(0,0,0,.40);
  --text:       #e8f4ff;
  --text-muted: rgba(224,244,255,.50);
  --placeholder:rgba(224,244,255,.22);
  --ink:        #4fc3ff;
  --accent-a:   #1fb6ff;
  --accent-b:   #0094e0;
  --accent-glow:rgba(0,170,255,.35);
  --focus-a:    rgba(0,170,255,.28);
  --focus-b:    rgba(31,182,255,.18);
  --btn-text:   rgba(224,244,255,.70);
  --btn-hi:     rgba(255,255,255,.08);
  --btn-lo:     rgba(0,0,0,.50);
  --btn-hover-hi:rgba(255,255,255,.18);
  --ok:         #4ade80;
  --err:        #f87171;
  --theme-btn-active: rgba(0,170,255,.18);
  --pattern:  rgba(100,180,255,.05);
  --eng-fill: rgba(255,255,255,.22);
  --eng-hi:   rgba(110,190,255,.25);
  --eng-lo:   rgba(0,0,0,.70);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-body:    #d3d3d3;       /* background clearly darker than the circle */
  --bg-body-2:  #bdbdbd;
  --circle-bg:  #ececec;
  --sh-hi:      #ffffff;
  --sh-lo:      #a2a2a2;
  --ring-hi:    rgba(0,0,0,.16);        /* visible grey rim instead of an invisible white one */
  --ring-in-hi: rgba(255,255,255,1);
  --ring-in-lo: rgba(150,150,150,.55);
  --pattern:    rgba(0,0,0,.07);        /* diagonal pattern, clearly visible */
  --field-bg:   #e0e0e0;                /* fields are wells, darker than the circle */
  --in-hi:      rgba(255,255,255,1);
  --in-lo:      rgba(120,120,132,.60);
  --text:       #4a4a4a;
  --text-muted: #8a8a8a;
  --placeholder:#a3a3a3;
  --ink:        #707070;                /* icons + placeholders: better contrast on the grey well */
  --accent-a:   #b21414;
  --accent-b:   #7c0d0d;
  --accent-glow:rgba(120,10,10,.35);
  --focus-a:    rgba(120,10,10,.35);
  --focus-b:    rgba(212,55,55,.25);
  --btn-text:   #838383;
  --btn-hi:     #f8f8f8;
  --btn-lo:     #c8c8c8;
  --btn-hover-hi:rgba(255,255,255,.60);
  --ok:         #1d7a46;
  --err:        #a10f0f;
  --theme-btn-active: rgba(161,15,15,.12);
  --eng-fill: rgba(0,0,0,.16);
  --eng-hi:   rgba(255,255,255,.95);
  --eng-lo:   rgba(0,0,0,.20);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg-body:    #1e2227;
  --bg-body-2:  #14171a;
  --circle-bg:  #25292f;
  --sh-hi:      #30353d;
  --sh-lo:      #16181c;
  --ring-hi:    rgba(255,255,255,.14);
  --ring-in-hi: rgba(255,255,255,.10);
  --ring-in-lo: rgba(0,0,0,.60);
  --in-hi:      rgba(52,58,67,.75);
  --in-lo:      rgba(8,10,13,.70);
  --text:       #d9dce1;
  --text-muted: #7d8591;
  --placeholder:#59606b;
  --ink:        #7d8591;
  --accent-a:   #c4262c;
  --accent-b:   #7f1519;
  --accent-glow:rgba(196,38,44,.35);
  --focus-a:    rgba(0,0,0,.65);
  --focus-b:    rgba(255,90,95,.18);
  --btn-text:   #a3a9b3;
  --btn-hi:     #2e333a;
  --btn-lo:     #1a1d21;
  --btn-hover-hi:rgba(255,255,255,.07);
  --ok:         #4ade80;
  --err:        #f87171;
  --theme-btn-active: rgba(196,38,44,.15);
  --pattern:  rgba(100,180,255,.05);
  --eng-fill: rgba(255,255,255,.20);
  --eng-hi:   rgba(255,255,255,.30);
  --eng-lo:   rgba(0,0,0,.75);
  color-scheme: dark;
}

/* ── LAYOUT TOKENS ── */
:root {
  --field-h:   44px;
  --orb:       75px;          /* stats circles AND theme circles share this size */
  --btn-orb:   72px;
  --form-h:    460px;
}

/* ── BASE ── */
html { font-family: 'Orbitron', 'Segoe UI', system-ui, sans-serif; }

body {
  min-height: 100vh;
  min-height: 100dvh;           /* mobile: excludes the browser bars, no extra scroll */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px 16px 100px;
  background:
    repeating-linear-gradient(45deg, var(--pattern) 0px, var(--pattern) 2px, transparent 2px, transparent 4px),
    radial-gradient(circle at center, var(--bg-body-2) 0%, var(--bg-body) 100%);
  transition: background .4s ease;
  -webkit-tap-highlight-color: transparent;
}

svg.i {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── STAGE: wraps the big circle; the engraved text is as tall as the circle ── */
.stage {
  position: relative;
  align-self: stretch;          /* full row width, height = the circle's height */
  display: flex;
  justify-content: center;
}

/* ── ENGRAVED VERTICAL TEXT ── */
.engraved-wrap {
  position: absolute;
  top: 0; bottom: 0;            /* exactly the height of the big circle */
  right: clamp(0px, 2.5vw, 48px);
  z-index: -1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: clamp(8px, 1.5vw, 22px);
  user-select: none;
  pointer-events: none;
}

/* one <span> per character, spread from the top edge to the bottom edge */
.engraved-ja {
  --ja-size: calc(min(540px, 92vw) / 13 * .94);   /* 13 characters fill the circle height */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  /* served from /fonts (ja-engraved.woff2); system serifs are only a last-resort safety net */
  font-family: 'ZC Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', 'MS Mincho', 'Noto Serif CJK JP', serif;
  font-weight: 900;
  font-size: var(--ja-size);
  color: var(--eng-fill);
  /* deeper carving: wide highlight + wide shadow, plus a tight inner edge */
  text-shadow:
     2px  2px 2px var(--eng-hi),
    -2px -2px 3px var(--eng-lo),
     1px  1px 0   var(--eng-hi),
    -1px -1px 0   var(--eng-lo);
  transition: color .4s ease, text-shadow .4s ease;
}
.engraved-ja span {
  display: block;
  line-height: 1;
  writing-mode: vertical-rl;    /* keeps the vertical form of ー */
  text-orientation: upright;
}

.engraved-en {
  align-self: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: 'Orbitron', monospace;
  font-weight: 400;
  font-size: clamp(8px, 1.3vh, 13px);
  letter-spacing: .30em;
  white-space: nowrap;
  color: var(--eng-fill);
  text-shadow:
     1px  1px 0px var(--eng-hi),
    -1px -1px 0px var(--eng-lo);
  opacity: .85;
  filter: contrast(1.4);
  transition: color .4s ease, text-shadow .4s ease;
}

/* ── THEME SWITCHER (same size as the stat circles) ── */
.theme-bar {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.theme-bar button {
  position: relative;
  width: var(--orb); height: var(--orb);
  padding: 0;
  border-radius: 50%;
  border: none; outline: none;
  cursor: pointer;
  font: 700 14px/1 'Orbitron', sans-serif;
  letter-spacing: .3px;
  color: var(--text-muted);
  background: var(--circle-bg);
  box-shadow: -6px -6px 14px var(--sh-hi), 6px 6px 16px var(--sh-lo);
  transition: color .25s, box-shadow .25s, background .25s, transform .2s;
}
.theme-bar button::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--ring-hi);
  box-shadow:
    inset 2px 2px 5px var(--ring-in-lo),
    inset -2px -2px 5px var(--ring-in-hi);
  pointer-events: none;
}
.theme-bar button:hover { color: var(--text); transform: translateY(-2px); }
.theme-bar button:focus-visible { color: var(--text); box-shadow: -6px -6px 14px var(--sh-hi), 6px 6px 16px var(--sh-lo), 0 0 0 2px var(--accent-a); }
.theme-bar button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--theme-btn-active);
  transform: none;
  box-shadow: inset 4px 4px 9px var(--sh-lo), inset -4px -4px 9px var(--sh-hi);
}

/* ── FLIP SCENE ── */
.flip-scene {
  width: min(540px, 92vw);
  aspect-ratio: 1;
  perspective: 1800px;
  flex-shrink: 0;
}

.flip-card {
  position: relative;
  display: grid;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.22,1,.36,1);
}

.flip-scene.flipped .flip-card { transform: rotateY(180deg); }

/* ── CIRCLE FACE ── */
.face {
  position: relative;
  grid-area: 1 / 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--circle-bg);
  box-shadow:
    -18px -18px 38px var(--sh-hi),
     18px  18px 45px var(--sh-lo);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: background .4s ease, box-shadow .4s ease;
  overflow: hidden;
}

.face::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: inherit;
  border: 1px solid var(--ring-hi);
  box-shadow:
    inset 5px 5px 16px var(--ring-in-lo),
    inset -5px -5px 16px var(--ring-in-hi),
    0 0 8px var(--ring-hi);
  pointer-events: none;
  transition: border-color .4s, box-shadow .4s;
}

.face.back { transform: rotateY(180deg); }
.face.front { --field-h: 50px; }
.face.back  { --field-h: 42px; }            /* 6 fields: slightly smaller so the title keeps away from the rim */
.face.back .form { gap: 12px; }

/* no outer shadow while turning: the shadow layer can show up as a square in some browsers */
.flip-scene.flipping .face { box-shadow: none; }

/* the hidden face must never catch clicks */
.flip-scene:not(.flipped) .face.back,
.flip-scene.flipped .face.front { pointer-events: none; }

/* ── FORM ── */
.form {
  position: relative;
  z-index: 2;
  width: 300px;
  min-height: var(--form-h);
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: space-between;
}

.form-head { 
  position: relative; 
  display: flex;
  flex-direction: column;
  align-items: center;
}

.form h1 {
  width: 100%;
  text-align: center;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .4px;
  text-shadow: 1px 1px 1px var(--sh-hi), -1px -1px 2px var(--sh-lo);
  transition: color .4s ease, text-shadow .4s ease;
}

.subtitle {
  /* Floating Notification Style - No Layout Shift */
  position: absolute;
  top: 0;
  left: 50%;
  width: 90%;
  max-width: 280px;
  transform: translateX(-50%) translateY(-100%); /* Start hidden above */
  margin: 0;
  padding: 6px 15px;
  border-radius: 12px;
  text-align: center;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.3s, background .4s ease, border-color .4s ease, color .4s ease;
  
  background: var(--circle-bg);
  border: 1px solid var(--ring-hi);
  box-shadow: 0 8px 25px rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.subtitle:not(:empty) {
  transform: translateX(-50%) translateY(-4px); /* resting position: 4px above the top of the form (keeps 2-line messages clear of the first field) */
  opacity: 1;
  pointer-events: auto;
}

.subtitle.err, .subtitle.ok {
  border: 1px solid currentColor;
}
@supports (color: color-mix(in srgb, red, blue)) {
  .subtitle.err, .subtitle.ok {
    border-color: color-mix(in srgb, currentColor 60%, transparent);
    background: color-mix(in srgb, var(--circle-bg) 95%, currentColor);
  }
}
.subtitle.err { color: var(--err); animation: floating-shake .4s ease; }
.subtitle.ok  { color: var(--ok); }

/* while a message is shown it replaces the title */
.form-head:has(> .subtitle:not(:empty)) h1 { opacity: 0; }

@keyframes floating-shake {
  0%, 100% { transform: translateX(-50%) translateY(-4px); }
  20%, 60% { transform: translateX(calc(-50% - 3px)) translateY(-4px); }
  40%, 80% { transform: translateX(calc(-50% + 3px)) translateY(-4px); }
}

/* ── FIELD ── */
.field {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: var(--field-h);
  border-radius: 30px;
  background: var(--field-bg, var(--circle-bg));
  box-shadow:
    inset -4px -4px 8px var(--in-hi),
     inset 4px  4px 8px var(--in-lo);
  transition: background .4s ease, box-shadow .35s ease, transform .35s ease;
}
.field:focus-within {
  transform: translateY(-2px);
  box-shadow:
    inset 3px 3px 7px var(--focus-a),
    inset -3px -3px 7px var(--focus-b);
}

.field .ico {
  position: absolute;
  left: 19px; top: 50%;
  transform: translateY(-50%);
  width: 19px; height: 19px;
  color: var(--ink);
  pointer-events: none;
  transition: color .3s;
}
.field:focus-within .ico { color: var(--accent-a); }

.field input,
.field select {
  flex: 1; width: 100%; height: 100%;
  border: none; outline: none;
  background: transparent;
  padding: 0 18px 0 51px;
  color: var(--text);
  font: 500 clamp(11px,1.8vw,13px)/1 'Orbitron', sans-serif;
  letter-spacing: .09em;               /* Orbitron letters were touching each other */
  -webkit-appearance: none; appearance: none;
  border-radius: inherit;
  transition: color .4s ease;
}
.field input::placeholder { color: var(--ink); opacity: 1; font-weight: 400; letter-spacing: .09em; transition: color .3s; }
.field:focus-within input::placeholder { color: var(--accent-a); }   /* always the same colour as the icon */
.field select:required:invalid { color: var(--ink); }                /* 'Choose Gender' = placeholder */
.field:focus-within select:required:invalid { color: var(--accent-a); }
.field select { cursor: pointer; padding-right: 44px; }
.field select option { background: var(--bg-body); color: var(--text); }

.field .chev {
  position: absolute;
  right: 19px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--ink);
  pointer-events: none;
  transition: color .3s, transform .3s;
}
.field:focus-within .chev {
  color: var(--accent-a);
  transform: translateY(-50%) rotate(180deg);
}

.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 100px var(--field-bg, var(--circle-bg)) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out;
}

.field.captcha .q {
  margin-left: 51px;
  letter-spacing: .09em;
  font-size: clamp(11px,1.8vw,13px);
  font-weight: 700;
  color: var(--accent-a);
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}
.field.captcha input { padding-left: 10px; }


/* ── EMBLEM ── */
.emblem {
  position: relative;
  width: 90px; height: 90px;
  border-radius: 50%;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  background: var(--circle-bg);
  box-shadow: -4px -4px 10px var(--sh-hi), 4px 4px 10px var(--sh-lo);
  transition: all .4s;
}
.emblem::before {
  content: '';
  position: absolute; inset: 0;
  z-index: 2;
  border-radius: 50%;
  border: 1px solid var(--ring-hi);
  box-shadow:
    inset 2px 2px 5px var(--ring-in-lo),
    inset -2px -2px 5px var(--ring-in-hi);
  pointer-events: none;
  transition: all .4s;
}

.emblem { overflow: hidden; }
.emblem img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transform: scale(1.2); /* raise to fill more, lower to crop less */
}

/* ── BUTTONS (round) ── */
.btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--btn-orb); height: var(--btn-orb);
  border: none; outline: none;
  border-radius: 50%;
  cursor: pointer;
  font: 600 10px/1 'Orbitron', sans-serif;
  letter-spacing: .5px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--btn-text);
  background: var(--circle-bg);
  box-shadow: -5px -5px 10px var(--btn-hi), 5px 5px 10px var(--btn-lo);
  transition: color .35s, background .35s, box-shadow .35s, transform .2s;
}
.btn::before {
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,.50), transparent);
  transform: skewX(-20deg);
  transition: left .55s ease;
  pointer-events: none;
}
.btn:hover::before,
.btn:focus-visible::before { left: 130%; }
.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
  color: #f5e9c8;
  background: linear-gradient(155deg, var(--accent-a) 0%, var(--accent-b) 100%);
  box-shadow: 0 8px 20px var(--accent-glow), -4px -4px 12px var(--btn-hover-hi), inset 0 1px 1px rgba(255,255,255,.20);
}
.btn:active {
  transform: scale(.97);
  box-shadow: inset 4px 4px 8px rgba(0,0,0,.4), inset -4px -4px 8px rgba(255,255,255,.05);
}
.btn.loading { pointer-events: none; opacity: .8; }
.btn .spin {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.loading .spin { display: block; }
.btn.loading .lbl  { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-row { display: flex; justify-content: center; gap: 22px; }

/* ── STATS CIRCLES ── */
.stats {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.stat-circle {
  position: relative;
  width: var(--orb); height: var(--orb);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: var(--circle-bg);
  box-shadow:
    -6px -6px 14px var(--sh-hi),
     6px  6px 16px var(--sh-lo);
  transition: background .4s, box-shadow .4s;
}
.stat-circle::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid var(--ring-hi);
  box-shadow:
    inset 2px 2px 5px var(--ring-in-lo),
    inset -2px -2px 5px var(--ring-in-hi);
  pointer-events: none;
  transition: all .4s;
}

.stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.stat-num.sm {
  font-size: 13px;
  max-width: 58px;            /* long usernames must not escape the circle */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-label {
  font: 500 9px/1.2 'Orbitron', sans-serif;
  letter-spacing: .8px;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-muted);
}

/* ── FOOTER ── */
.footer {
  font-size: 10px;
  color: var(--text-muted);
  opacity: .6;
  text-align: center;
}

/* ── COOKIE BANNER ── */
.cookie-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  width: min(720px, calc(100% - 28px));
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--circle-bg);
  box-shadow:
    -8px -8px 18px var(--sh-hi),
     8px  8px 18px var(--sh-lo);
  z-index: 999;
  transition: transform .5s cubic-bezier(.22,1,.36,1), opacity .4s ease, background .4s, box-shadow .4s;
}
.cookie-banner.hidden {
  transform: translateX(-50%) translateY(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}

.cookie-icon {
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  box-shadow:
    inset 3px 3px 6px var(--in-lo),
    inset -3px -3px 6px var(--in-hi);
}
.cookie-icon svg { width: 20px; height: 20px; }

.cookie-text {
  flex: 1;
  min-width: 200px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}
.cookie-text strong {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
}

.cookie-accept {
  height: 36px;
  padding: 0 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font: 600 12px/1 'Orbitron', sans-serif;
  letter-spacing: .5px;
  flex-shrink: 0;
  color: var(--btn-text);
  background: var(--circle-bg);
  box-shadow: -4px -4px 8px var(--btn-hi), 4px 4px 8px var(--btn-lo);
  transition: color .3s, background .3s, box-shadow .3s, transform .2s;
}
.cookie-accept:hover {
  transform: translateY(-1px);
  color: #fff;
  background: linear-gradient(155deg, var(--accent-a) 0%, var(--accent-b) 100%);
  box-shadow: 0 6px 16px var(--accent-glow);
}

/* cookies blocked by the browser: no accept button, error tint */
.cookie-banner.blocked .cookie-accept { display: none; }
.cookie-banner.blocked .cookie-icon   { color: var(--err); }
.cookie-banner.blocked .cookie-text strong { color: var(--err); }

/* ── RESPONSIVE ── */
@media (max-width: 620px) {
  :root { --orb: 52px; --face-r: 36px; }
  body { gap: 12px; padding: 12px 16px 28px; }
  .emblem { width: 56px; height: 56px; }
  .face.front, .face.back { --field-h: 44px; }
  .theme-bar button { font-size: 12px; }
  .flip-scene { width: min(380px, 92vw); aspect-ratio: auto; }
  .face { border-radius: var(--face-r); padding: 14px 0; }
  .face::before { inset: 8px; border-radius: 30px; }
  .form { width: calc(100% - 64px); height: auto; min-height: 0; gap: 10px; }
  .stat-num { font-size: 15px; }
  .stat-num.sm { font-size: 12px; max-width: 50px; }
  .engraved-wrap { right: 6px; gap: 4px; }
  .engraved-ja { --ja-size: clamp(20px, 6vw, 34px); }
  .engraved-en { font-size: clamp(7px, 1.2vh, 11px); }
}

@media (max-height: 680px) {
  :root { --orb: 52px; }
  .theme-bar button { font-size: 11px; }
  body { padding: 12px 16px 28px; gap: 12px; }
  .stat-num { font-size: 14px; }
  .stat-num.sm { font-size: 11px; max-width: 46px; }
  .stats { gap: 10px; }
}

/* ── MOBILE: stats become one pill, split in three (same width as the form) ── */
@media (max-width: 620px) {
  .stats {
    width: min(380px, 92vw);
    flex-wrap: nowrap;
    gap: 0;
    padding: 22px 0;
    border-radius: var(--face-r);
    border: 1px solid var(--ring-hi);
    background: var(--circle-bg);
    box-shadow:
      -6px -6px 14px var(--sh-hi),
       6px  6px 16px var(--sh-lo),
      inset 2px 2px 5px var(--ring-in-lo),
      inset -2px -2px 5px var(--ring-in-hi);
  }
  .stat-circle {
    flex: 1;
    min-width: 0;
    width: auto; height: auto;
    padding: 0 8px;
    border-radius: 0;
    background: none;
    box-shadow: none;
    overflow: hidden;
  }
  .stat-circle::before { display: none; }
  .stat-circle + .stat-circle { border-left: 1px solid var(--ring-hi); }
  .stat-num.sm { max-width: 100%; }
  .stat-label { font-size: 8px; letter-spacing: .5px; white-space: nowrap; }
}


/* ── ZCODE: ENERGY CIRCLE ── */
.emblem::after {
  content: '';
  position: absolute;
  inset: 0px;
  z-index: 7;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 0 50%,
              #ffffff 0 3px,
              var(--accent-a) 2px 4px,
              transparent 10px);
  filter: drop-shadow(0 0 3px var(--accent-a));
  animation: e-spin 8.5s linear infinite;
}
@keyframes e-spin { from { transform: rotate(0) } to { transform: rotate(360deg) } }


/* ── ZCODE: DUAL EYE ENERGY PULSE ── */
.emblem::before {
  z-index: 8;
  opacity: 1;
  background:
    radial-gradient(circle at var(--eye-left) var(--eye-y),
      #ffffff 0px,
      #ffffff 1px,
      var(--accent-a) 2px,
      transparent 7px
    ),
    radial-gradient(circle at var(--eye-right) var(--eye-y),
      #ffffff 0px,
      #ffffff 1px,
      var(--accent-a) 2px,
      transparent 7px
    );

  animation: eye-energy-pulse var(--eye-speed) ease-in-out infinite;
}

@keyframes eye-energy-pulse {
  0%, 72%, 100% {
    filter: brightness(1);
  }

  76% {
    filter:
      brightness(2)
      drop-shadow(0 0 5px #fff)
      drop-shadow(0 0 12px var(--accent-a));
  }

  82% {
    filter: brightness(1.2);
  }

  88% {
    filter:
      brightness(2)
      drop-shadow(0 0 7px #fff)
      drop-shadow(0 0 var(--eye-glow) var(--accent-a));
  }
}

/* ── ZCODE: DUAL EYE ENERGY CONTROL ── */
.emblem {
  --eye-y: 75%;          /* ارتفاع النقطتين */
  --eye-left: 25%;       /* النقطة اليسرى */
  --eye-right: 75%;      /* النقطة اليمنى */
  --eye-speed: 3s;       /* دورة النبض */
  --eye-glow: 72px;      /* قوة التوهج */
}

/* ── Password eye + live validation messages ── */
.field.has-eye { position: relative; }
/* show / hide password (eye) — appears once something is typed */
.field .eye {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  padding: 0; margin: 0;
  border: none; outline: none;
  box-shadow: none;
  -webkit-appearance: none; appearance: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity .2s, visibility .2s, color .3s, background .3s;
}
.field .eye svg { width: 19px; height: 19px; }
.field.filled .eye { visibility: visible; opacity: 1; }
.field:focus-within .eye { color: var(--accent-a); }          /* same colour as the field icon */
.field .eye:hover { background: var(--theme-btn-active); color: var(--accent-a); }
.field .eye:focus-visible { box-shadow: 0 0 0 2px var(--accent-a); }
.field.has-eye.filled input { padding-right: 56px; }          /* text never runs under the eye */

/* live validation message (registration) — shown inside the pill, on the right */
.field .val {
  position: absolute;
  right: 22px; top: 50%;
  transform: translateY(-50%);
  font: 600 9px/1 'Orbitron', sans-serif;
  letter-spacing: .08em;
  color: var(--err);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
.field.invalid .val { opacity: 1; }
.field.invalid input { padding-right: 118px; }      /* typed text never runs under the message */

/* validation message sits to the left of the eye when both are visible */
.field.has-eye.filled .val { right: 54px; }
.field.has-eye.filled.invalid input { padding-right: 174px; }
