@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&display=swap');

:root {
  --bg: #050505;
  --panel: rgba(0, 10, 0, .94);
  --green: #00ff41;
  --green-soft: #7dff9d;
  --green-dim: #075f24;
  --green-deep: #002b10;
  --muted: #4d8b5c;
  --red: #ff3b3b;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(0, 70, 20, .14), transparent 45%),
    var(--bg);
  color: var(--green);
  font-family: 'Courier Prime', 'Courier New', monospace;
  min-height: 100vh;
}

button { font: inherit; }

.crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background:
    linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,.26) 50%),
    linear-gradient(90deg, rgba(255,0,0,.045), rgba(0,255,0,.018), rgba(0,0,255,.045));
  background-size: 100% 2px, 3px 100%;
}

.scanline {
  position: fixed;
  z-index: 19;
  top: -120px;
  left: 0;
  width: 100%;
  height: 120px;
  pointer-events: none;
  opacity: .11;
  background: linear-gradient(0deg, transparent, rgba(0,255,65,.55), transparent);
  animation: scan 8s linear infinite;
}

@keyframes scan { to { top: 100%; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }
@keyframes flash { 50% { color: #fff; text-shadow: 0 0 14px #fff; } }

.main-wrapper {
  width: 100%;
  min-height: 100vh;
  padding: 28px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  position: relative;
  z-index: 5;
  width: min(1080px, 100%);
  padding: 22px;
  border: 1px solid #053f18;
  background: var(--panel);
  box-shadow: 0 0 70px #000, inset 0 0 40px rgba(0, 45, 14, .16);
}

header {
  padding: 2px 0 14px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--green-dim);
  text-align: center;
}

.brand-line { display: flex; align-items: center; justify-content: center; gap: 14px; }

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.15rem);
  letter-spacing: .03em;
  text-shadow: 0 0 11px var(--green);
}

.wing { color: var(--green-dim); font-size: 1.7rem; }
.status-bar { margin-top: 7px; color: var(--green-soft); font-size: .84rem; }
.blink { animation: blink 1s steps(1) infinite; }

.protocol {
  border: 1px dashed var(--green-dim);
  padding: 14px 16px 12px;
  background: rgba(0, 55, 15, .11);
}

.section-label { margin-bottom: 11px; color: var(--green-soft); font-size: .82rem; }
.protocol-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.protocol-grid div {
  padding: 8px;
  border-left: 2px solid var(--green-dim);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.protocol-grid b { font-size: 1.25rem; text-shadow: 0 0 8px var(--green); }
.protocol-grid span { color: var(--muted); font-size: .7rem; }
.protocol-note { margin: 10px 0 0; color: #74be85; font-size: .78rem; line-height: 1.4; }

.action-row { margin: 16px 0; display: flex; align-items: center; gap: 16px; }

button {
  border: 1px solid var(--green);
  color: var(--green);
  background: #020602;
  padding: 11px 18px;
  cursor: pointer;
  text-shadow: 0 0 3px var(--green);
  transition: background .18s, box-shadow .18s, color .18s;
}

button:hover, button:focus-visible {
  outline: none;
  background: var(--green-deep);
  box-shadow: 0 0 16px rgba(0,255,65,.25), inset 0 0 12px rgba(0,255,65,.08);
}

#generate-btn { min-width: 265px; }
.key-hint { color: var(--muted); font-size: .75rem; }

.results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.password-card {
  min-width: 0;
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  padding: 11px;
  border: 1px solid #064b1d;
  background: #000800;
  animation: reveal .24s ease-out both;
}

.password-card:hover { border-color: #0b8634; box-shadow: inset 0 0 16px rgba(0,65,20,.18); }
.card-index { color: var(--green-dim); font-size: .82rem; padding-top: 2px; }
.card-body { min-width: 0; }
.phrase-line { color: #b0ffc1; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.extract-line { margin: 3px 0; color: var(--green-dim); font-size: .76rem; letter-spacing: .02em; }
.extract-line .picked { color: #45bd64; border-bottom: 1px dotted var(--green-dim); }
.layout-line { color: #4c9c5f; font-size: .78rem; }

.password-line {
  margin-top: 5px;
  padding-top: 6px;
  border-top: 1px solid #053416;
}

.password-line code {
  color: var(--green);
  font-family: inherit;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-shadow: 0 0 7px rgba(0,255,65,.7);
  overflow-wrap: anywhere;
}

.copy-btn { align-self: center; padding: 9px 11px; font-size: .76rem; }
.copy-btn.copied { animation: flash .35s linear; color: #fff; border-color: #fff; }

.footer-console {
  margin-top: 16px;
  padding: 9px 11px;
  border: 1px solid #053916;
  background: #000500;
  color: #57aa6b;
  font-size: .75rem;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.security-mark { color: #2e6b3d; white-space: nowrap; }

@media (max-width: 760px) {
  .main-wrapper { align-items: flex-start; padding: 10px; }
  .container { padding: 14px; }
  .protocol-grid { grid-template-columns: 1fr 1fr; }
  .results { grid-template-columns: 1fr; }
  .action-row { align-items: stretch; flex-direction: column; gap: 7px; }
  #generate-btn { width: 100%; min-width: 0; }
  .key-hint { text-align: center; }
}

@media (max-width: 430px) {
  .password-card { grid-template-columns: 27px minmax(0, 1fr); }
  .copy-btn { grid-column: 2; width: 100%; }
  .security-mark, .wing { display: none; }
  .phrase-line { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
