/*
 * © Rosario Cybernetics & ENI6MA Co. All rights reserved worldwide.
 * Intellectual property: https://eni6ma.com/about/ip
 * Unauthorized use, copying, reverse engineering, or redistribution is prohibited
 * except by express written authorization. See ENI6MA-WEB-6ELF/IP-NOTICE.md.
 */

/* Pass+ bank chrome — navy mobile-first ceremony (no Daisy/Tailwind) */

:root {
  --bg: #0b1f3a;
  --surface: #121a24;
  --surface-2: #1a2433;
  --border: #2a3544;
  --text: #f5f7fa;
  --muted: #9aa3b2;
  --accent: #1e4e8c;
  --accent-hover: #2a63ad;
  --danger: #c45c5c;
  --success: #3d9a6a;
  --zone-blue: #3b6ea5;
  --zone-yellow: #c4a035;
  --zone-red: #a84848;
  --zone-white: #d8dde6;
  --zone-green: #3a8a5c;
  --zone-black: #1a1a1a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --pad-cell: min(44px, 11vmin);
  --header-h: 2rem;
  --pad-gap: 0.35rem;
  --zone-gap: 0.35rem;
  --glyph-min: 0.85rem;
  --glyph-pref: 18cqmin;
  --glyph-max: 1.35rem;
}

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

html,
body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

#app-container,
#hero {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

#hero {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

#hero.loaded {
  opacity: 1;
}

.hero {
  opacity: 1;
}

#mobileStatus {
  display: none !important;
}

/* —— Login —— */
.auth-section {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 1.25rem;
}

.auth-card {
  width: min(22rem, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.25rem 1.1rem 1.35rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.auth-card legend {
  padding: 0 0.25rem;
}

.auth-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-title {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
}

.auth-label {
  display: block;
  margin: 1rem 0 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.auth-input {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}

.auth-input:focus {
  border-color: var(--accent);
}

.auth-submit-btn,
.reset-btn,
.modal-confirm-btn,
.modal-cancel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.85rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.35rem;
  background: var(--accent);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.auth-submit-btn:hover,
.reset-btn:hover,
.modal-confirm-btn:hover {
  background: var(--accent-hover);
}

.auth-hint {
  margin: 0.75rem 0 0;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--muted);
}

.auth-hint a {
  color: #7eb0e8;
  text-decoration: underline;
}

/* —— Ceremony shell —— */
#cypher.cypher-section {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  touch-action: none;
}

.cypher-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100dvh;
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  padding: 0.4rem 0.55rem calc(0.35rem + var(--safe-bottom));
  overflow: hidden;
  gap: 0.35rem;
}

.ceremony-header {
  flex: 0 0 auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

#alphabet-toggle {
  display: none;
}

.zones-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: var(--zone-gap);
  width: 100%;
}

.color-zone {
  position: relative;
  container-type: size;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  gap: 0.1rem;
  align-content: center;
  justify-items: center;
  padding: 0.2rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  min-height: 0;
}

.color-zone .zone-label {
  display: none;
}

.blue-zone { background: var(--zone-blue); }
.yellow-zone { background: var(--zone-yellow); color: #1a1a1a; }
.red-zone { background: var(--zone-red); }
.white-zone { background: var(--zone-white); color: #121a24; border-color: #8a93a3; }
.green-zone { background: var(--zone-green); }
.black-zone { background: var(--zone-black); border-color: #3a3a3a; }

.color-zone .kbd,
.color-zone kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: clamp(var(--glyph-min), var(--glyph-pref), var(--glyph-max));
  font-weight: 600;
  line-height: 1;
  user-select: none;
}

@supports not (font-size: 1cqmin) {
  .color-zone .kbd,
  .color-zone kbd {
    font-size: clamp(0.85rem, 3.6vmin, 1.35rem);
  }
}

/* —— Bearing pad: left cluster | submit | right cluster —— */
.bearing-pad {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: var(--pad-gap);
  width: 100%;
  padding: 0.15rem 0 0.1rem;
  touch-action: manipulation;
}

.bearing-cluster {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: calc(var(--pad-gap) * 0.75);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--pad-cell);
  height: var(--pad-cell);
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: background 80ms ease, transform 80ms ease, border-color 80ms ease;
  flex: 0 0 auto;
}

.nav-btn:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.nav-btn.is-pressed,
.nav-btn:active {
  background: var(--accent);
  border-color: var(--accent-hover);
  transform: scale(0.94);
}

.nav-btn.submit-btn {
  background: var(--accent);
  border-color: var(--accent-hover);
  font-size: 1.15rem;
}

.nav-btn.submit-btn.is-pressed,
.nav-btn.submit-btn:active {
  background: var(--accent-hover);
}

/* —— Success / fail —— */
.results-section {
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
  background: var(--bg);
}

.success-panel {
  width: min(28rem, 100%);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.1rem;
}

.success-header {
  margin-bottom: 0.85rem;
  text-align: center;
}

.success-title {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--success);
}

.success-title.is-fail {
  color: var(--danger);
}

.success-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.validation-details,
.api-response {
  margin-bottom: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--surface-2);
  text-align: left;
}

.details-title,
.api-response-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.details-list {
  margin: 0;
}

.detail-item {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
}

.detail-label {
  color: var(--muted);
  font-weight: 500;
}

.detail-value {
  margin: 0;
  color: var(--text);
  word-break: break-all;
}

#apiResponseMeta {
  margin-bottom: 0.4rem;
  font-size: 0.65rem;
  color: var(--muted);
  word-break: break-all;
}

#apiResponseJson {
  margin: 0;
  max-height: 12rem;
  overflow: auto;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  background: var(--bg);
  font-size: 0.65rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.action-buttons {
  display: flex;
  justify-content: center;
}

.reset-btn {
  width: auto;
  min-width: 12rem;
  margin-top: 0.25rem;
}

/* —— Traffic drawer —— */
.traffic-toggle {
  position: fixed;
  top: calc(0.5rem + var(--safe-top));
  right: calc(0.5rem + var(--safe-right));
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: rgba(18, 26, 36, 0.92);
  color: var(--muted);
  font: inherit;
  font-size: 0.7rem;
  cursor: pointer;
}

.traffic-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

.traffic-toggle svg {
  width: 1rem;
  height: 1rem;
}

.traffic-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: min(24rem, 90vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow: hidden;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
}

.traffic-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.traffic-drawer-header h3 {
  margin: 0;
  font-size: 0.8rem;
  color: #7eb0e8;
}

.traffic-drawer-close {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

#debugPayloadList {
  height: calc(100% - 2.5rem);
  overflow-y: auto;
  padding: 0.5rem;
}

.debug-log-entry {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem;
  font-size: 0.7rem;
}

.debug-log-entry .text-cyan-400 { color: #7eb0e8; }
.debug-log-entry .text-amber-400 { color: #d4a84b; }
.debug-log-entry .text-slate-500 { color: var(--muted); }
.debug-log-entry .text-slate-300 { color: #c8d0dc; }
.debug-log-entry pre {
  margin: 0.35rem 0 0;
  max-height: 10rem;
  overflow: auto;
}

/* —— Toast / modal —— */
.toast-container {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(1rem + var(--safe-bottom));
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-notification {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0.4rem;
  padding: 0.75rem;
  color: var(--text);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  animation: slideInFromBottom 0.3s ease-out forwards;
  position: relative;
  overflow: hidden;
}

.toast-notification.info { border-left-color: var(--accent); }
.toast-notification.success { border-left-color: var(--success); }
.toast-notification.warning { border-left-color: #d4a84b; }
.toast-notification.error { border-left-color: var(--danger); }

.toast-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.modal-content {
  position: relative;
  width: min(24rem, calc(100% - 2rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  color: var(--text);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.modal-close-btn {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.15rem;
}

.modal-body {
  padding: 1rem;
}

.modal-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
}

.modal-confirm-btn,
.modal-cancel-btn {
  width: auto;
  margin-top: 0;
  min-width: 5rem;
}

.modal-cancel-btn {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

@keyframes slideInFromBottom {
  0% { transform: translateY(100px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes slideOutToBottom {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(100px); opacity: 0; }
}

@keyframes progressShrink {
  0% { width: 100%; }
  100% { width: 0%; }
}

@supports not (height: 100dvh) {
  html,
  body,
  #app-container,
  #hero,
  #cypher.cypher-section,
  .cypher-shell {
    height: 100vh;
    max-height: 100vh;
  }
}


/* IP notice footer */
.passplus-ip-footer {
  margin: 1.25rem auto 2rem;
  padding: 0 1rem;
  max-width: 28rem;
  text-align: center;
  font-size: 0.7rem;
  line-height: 1.45;
  color: rgba(232, 240, 255, 0.55);
}
.passplus-ip-footer a {
  color: rgba(180, 210, 255, 0.85);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.eni6ma-ip-notice[hidden] {
  display: none !important;
}
