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

/* Bootstrap icon base */
.bi {
  vertical-align: -.125em;
  line-height: 1
}

:root {
  --bg: #0a0e1a;
  --surface: #111827;
  --surface2: #1a2235;
  --border: #1e2d45;
  --accent: #3b82f6;
  --accent2: #6366f1;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --text: #e2e8f0;
  --muted: #64748b;
  --radius: 14px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  min-height: 100vh
}

.screen.active {
  display: flex;
  flex-direction: column
}

/* ===== MODE SCREEN ===== */
#screen-mode {
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden
}

.mode-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 40%, rgba(59, 130, 246, .15), transparent 60%), radial-gradient(ellipse at 70% 70%, rgba(99, 102, 241, .12), transparent 55%)
}

.mode-hero {
  position: relative;
  text-align: center;
  padding: 2rem;
  max-width: 860px;
  width: 100%
}

.logo-badge {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
  color: #60a5fa
}

.logo-badge .bi {
  font-size: 3.5rem
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-10px)
  }
}

.mode-hero h1 {
  font-size: 2.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent
}

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

.desc {
  color: #94a3b8;
  font-size: .9rem;
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto 2rem
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.8rem
}

.mode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: all .25s;
  text-align: left;
  position: relative
}

.mode-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .4)
}

.mode-card.danger {
  border-color: rgba(239, 68, 68, .3)
}

.mode-card.danger:hover {
  border-color: var(--red);
  box-shadow: 0 12px 36px rgba(239, 68, 68, .15)
}

.mode-card.success {
  border-color: rgba(16, 185, 129, .3)
}

.mode-card.success:hover {
  border-color: var(--green);
  box-shadow: 0 12px 36px rgba(16, 185, 129, .15)
}

.mode-icon {
  font-size: 2rem;
  margin-bottom: .6rem
}

.mode-icon .bi {
  font-size: 2rem
}

.mode-card.danger .mode-icon {
  color: var(--red)
}

.mode-card.success .mode-icon {
  color: var(--green)
}

.mode-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .4rem
}

.mode-card p {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.5
}

.risk-badge {
  display: inline-block;
  margin-top: .8rem;
  font-size: .7rem;
  font-weight: 700;
  padding: .25rem .7rem;
  border-radius: 999px;
  letter-spacing: .05em
}

.risk-badge.high {
  background: rgba(239, 68, 68, .15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, .3)
}

.risk-badge.low {
  background: rgba(16, 185, 129, .15);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, .3)
}

.literacy-label {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .6rem
}

.literacy-selector {
  display: flex;
  gap: .6rem;
  justify-content: center
}

.lit-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .45rem 1.1rem;
  border-radius: 999px;
  font-size: .82rem;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: .4rem
}

.lit-dot {
  font-size: .55rem !important
}

.lit-dot.green {
  color: var(--green)
}

.lit-dot.amber {
  color: var(--yellow)
}

.lit-dot.red {
  color: var(--red)
}

.lit-btn.active {
  background: rgba(59, 130, 246, .15);
  border-color: var(--accent);
  color: var(--accent)
}

/* ===== TXN SCREEN ===== */
#screen-txn {
  flex-direction: column
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border)
}

.back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .4rem .9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .82rem;
  transition: all .2s
}

.back-btn:hover {
  border-color: var(--accent);
  color: var(--accent)
}

.header-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 600
}

.mode-pill {
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .65rem;
  border-radius: 999px;
  letter-spacing: .06em
}

.mode-pill.secure {
  background: rgba(16, 185, 129, .15);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, .3)
}

.mode-pill.insecure {
  background: rgba(239, 68, 68, .15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, .3)
}

.header-score {
  font-size: .85rem;
  color: var(--muted)
}

.header-score span {
  color: var(--accent);
  font-weight: 600
}

.txn-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  padding: 2rem;
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%
}

/* ===== PHONE ===== */
.phone-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 1rem
}

.phone {
  width: 300px;
  background: #0d1117;
  border-radius: 40px;
  border: 2px solid #222;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(255, 255, 255, .05);
  overflow: hidden;
  flex-shrink: 0
}

.phone-notch {
  height: 28px;
  background: #0d1117;
  display: flex;
  align-items: center;
  justify-content: center
}

.phone-notch::after {
  content: '';
  width: 70px;
  height: 14px;
  background: #000;
  border-radius: 999px
}

.phone-screen {
  min-height: 540px;
  background: var(--surface);
  position: relative;
  overflow: hidden
}

.phone-home-bar {
  height: 28px;
  background: #0d1117;
  display: flex;
  align-items: center;
  justify-content: center
}

.phone-home-bar::after {
  content: '';
  width: 80px;
  height: 4px;
  background: #333;
  border-radius: 999px
}

.phone-step {
  display: none;
  flex-direction: column;
  height: 100%;
  animation: slideIn .3s ease
}

.phone-step.active {
  display: flex
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px)
  }

  to {
    opacity: 1;
    transform: translateX(0)
  }
}

.phone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .7rem 1rem;
  background: rgba(59, 130, 246, .08);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  font-size: .75rem;
  color: var(--muted)
}

.phone-header .signal {
  display: flex;
  gap: .4rem;
  align-items: center;
  font-size: .9rem
}

.phone-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .8rem
}

.phone-body.centered {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem
}

h4.step-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text)
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem
}

.form-group label {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center
}

.input-icon {
  position: absolute;
  left: .75rem;
  color: var(--muted);
  font-size: .8rem;
  pointer-events: none;
  z-index: 1
}

.form-group .input-icon-wrap input {
  padding: .55rem .8rem .55rem 2.5rem;
  width: 100%
}

.form-group input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: .55rem .8rem;
  color: var(--text);
  font-size: .85rem;
  outline: none;
  transition: border-color .2s;
  width: 100%
}

.form-group input:focus {
  border-color: var(--accent)
}

.phone-btn {
  border: none;
  border-radius: 10px;
  padding: .65rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  width: 100%
}

.phone-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff
}

.phone-btn.primary:hover {
  opacity: .9;
  transform: translateY(-1px)
}

.phone-btn.danger {
  background: rgba(239, 68, 68, .15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, .3)
}

.phone-btn.danger:hover {
  background: rgba(239, 68, 68, .25)
}

.phone-btn.biometric {
  background: rgba(16, 185, 129, .1);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, .2);
  margin-top: .3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem
}

.phone-btn.biometric .bi {
  font-size: 1.1rem
}

.phone-btn.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem
}

.phone-btn.danger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem
}

/* PIN PAD */
.pin-display {
  display: flex;
  gap: .8rem;
  justify-content: center;
  margin: .5rem 0
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: background .15s
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent)
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem
}

.pin-key {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: .7rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: 'JetBrains Mono', monospace
}

.pin-key:hover {
  background: var(--surface2);
  border-color: var(--accent)
}

.pin-key:active {
  transform: scale(.95)
}

.pin-key.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted)
}

.biometric-section {
  display: flex;
  flex-direction: column;
  align-items: center
}

.divider {
  color: var(--muted);
  font-size: .75rem;
  margin: .3rem 0
}

/* SPINNER */
.spinner-ring {
  width: 56px;
  height: 56px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* AGENT CARD */
.agent-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .8rem;
  display: flex;
  align-items: center;
  gap: .8rem
}

.agent-avatar {
  font-size: 2.4rem;
  color: var(--muted);
  line-height: 1
}

.agent-info {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  font-size: .8rem
}

.agent-info strong {
  color: var(--text);
  font-size: .85rem
}

.agent-info span {
  color: var(--muted)
}

.badge-verified {
  color: var(--green) !important;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .3rem
}

.badge-unverified {
  color: var(--red) !important;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .3rem
}

.badge-unverified {
  color: var(--red) !important;
  font-weight: 600
}

.agent-checks {
  display: flex;
  flex-direction: column;
  gap: .4rem
}

.agent-check-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  color: var(--muted);
  padding: .3rem .4rem;
  border-radius: 6px;
  background: var(--bg)
}

.agent-check-row .bi {
  font-size: .85rem
}

.agent-check-row.ok {
  color: var(--green)
}

.agent-check-row.fail {
  color: var(--red)
}

.agent-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-top: .3rem
}

/* RECEIPT */
.receipt {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .9rem;
  width: 100%;
  text-align: left;
  font-size: .78rem;
  font-family: 'JetBrains Mono', monospace
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  padding: .2rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .04)
}

.receipt-row:last-child {
  border: none;
  color: var(--green);
  font-weight: 600
}

.result-icon {
  font-size: 3rem;
  animation: pop .4s ease;
  line-height: 1
}

.result-icon .bi {
  font-size: 3rem
}

@keyframes pop {
  0% {
    transform: scale(.5)
  }

  80% {
    transform: scale(1.2)
  }

  100% {
    transform: scale(1)
  }
}

/* LITERACY TIP */
.literacy-tip {
  font-size: .75rem;
  color: var(--yellow);
  background: rgba(245, 158, 11, .07);
  border: 1px solid rgba(245, 158, 11, .15);
  border-radius: 8px;
  padding: .5rem .7rem;
  line-height: 1.5;
  display: none
}

.literacy-tip.visible {
  display: block
}

/* ===== SECURITY PANEL ===== */
.security-panel {
  display: flex;
  flex-direction: column;
  gap: 1.2rem
}

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem
}

.panel-title .bi {
  color: var(--accent)
}

/* RING */
.score-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto
}

.score-ring {
  transform: rotate(-90deg)
}

.ring-bg {
  fill: none;
  stroke: var(--surface2);
  stroke-width: 8
}

.ring-fill {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset .8s ease
}

.score-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center
}

.score-num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text)
}

.score-label {
  font-size: .7rem;
  color: var(--muted)
}

.layers-title {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted)
}

.layer-list {
  display: flex;
  flex-direction: column;
  gap: .5rem
}

.layer-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .8rem;
  transition: all .3s
}

.layer-item.pass {
  border-color: rgba(16, 185, 129, .3);
  background: rgba(16, 185, 129, .05)
}

.layer-item.fail {
  border-color: rgba(239, 68, 68, .3);
  background: rgba(239, 68, 68, .05)
}

.layer-item.skipped {
  border-color: rgba(245, 158, 11, .2);
  background: rgba(245, 158, 11, .04)
}

.layer-icon {
  font-size: 1.1rem;
  width: 1.4rem;
  text-align: center;
  color: var(--muted)
}

.layer-item.pass .layer-icon {
  color: var(--green)
}

.layer-item.fail .layer-icon {
  color: var(--red)
}

.layer-item.skipped .layer-icon {
  color: var(--yellow)
}

.layer-info {
  flex: 1;
  display: flex;
  flex-direction: column
}

.layer-name {
  font-size: .82rem;
  font-weight: 500
}

.layer-desc {
  font-size: .7rem;
  color: var(--muted)
}

.layer-status {
  font-size: .72rem;
  font-weight: 600;
  min-width: 50px;
  text-align: right
}

.layer-status.pending {
  color: var(--muted)
}

.layer-status.pass {
  color: var(--green)
}

.layer-status.fail {
  color: var(--red)
}

.layer-status.skip {
  color: var(--yellow)
}

/* LOG */
.log-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  max-height: 180px
}

.log-title {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  padding: .5rem .8rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .4rem
}

.log-entries {
  overflow-y: auto;
  max-height: 145px;
  padding: .5rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .3rem
}

.log-entry {
  font-size: .73rem;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  gap: .5rem
}

.log-entry .ts {
  color: var(--muted)
}

.log-entry.ok .msg {
  color: var(--green)
}

.log-entry.err .msg {
  color: var(--red)
}

.log-entry.warn .msg {
  color: var(--yellow)
}

.log-entry.info .msg {
  color: #60a5fa
}

.research-ref {
  font-size: .7rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--border);
  padding-top: .8rem
}

.muted {
  color: var(--muted);
  font-size: .82rem
}

/* GRADIENT DEF */
svg defs {
  display: none
}