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

:root {
  --bg: #040704;
  --panel: rgba(0, 255, 102, .04);
  --green: #00ff66;
  --green-dim: rgba(0, 255, 102, .35);
  --green-faint: rgba(0, 255, 102, .12);
  --text: #cfe8d4;
  --muted: #7fa88a;
  --danger: #ff5470;
  --mono: 'Roboto Mono', ui-monospace, Menlo, Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--mono);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

::selection { background: rgba(0, 255, 102, .25); }

a { color: var(--green); text-decoration: none; }
button { font-family: var(--mono); }

/* ---------- background layers ---------- */
#rain { position: fixed; inset: 0; z-index: 0; opacity: .55; }

.crt {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.13) 0 1px, transparent 1px 3px);
}

.vignette {
  position: fixed; inset: 0; z-index: 41; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
}

/* ---------- boot overlay ---------- */
#boot {
  position: fixed; inset: 0; z-index: 100;
  background: #020402;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; transition: opacity .5s ease; cursor: pointer;
}
#boot.done { opacity: 0; pointer-events: none; }
.boot-inner { width: min(480px, 100%); }
#boot-log { font-size: 13px; color: var(--green); min-height: 150px; white-space: pre-wrap; word-break: break-word; }
#boot-log .ok { color: var(--green); }
#boot-log .dim { color: var(--muted); }
.boot-track { height: 6px; background: rgba(0,255,102,.12); border-radius: 3px; margin-top: 14px; overflow: hidden; }
.boot-fill { height: 100%; width: 0; background: var(--green); box-shadow: 0 0 12px var(--green); transition: width .3s ease; }
.boot-skip {
  margin-top: 18px; background: none; border: 1px solid var(--green-dim);
  color: var(--muted); font-size: 12px; padding: 8px 18px; border-radius: 6px; cursor: pointer;
}
.boot-skip:hover { color: var(--green); border-color: var(--green); }

/* ---------- status bar ---------- */
.statusbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: 46px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; font-size: 12px; letter-spacing: .04em;
  background: rgba(3, 6, 3, .85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--green-faint);
}
.sb-left { color: var(--green); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.sb-left em { font-style: normal; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 50% { opacity: .35; } }
.sb-right { color: var(--muted); display: flex; gap: 12px; align-items: center; white-space: nowrap; }
#clock { color: var(--text); font-variant-numeric: tabular-nums; }
.enc { color: var(--green); }

/* ---------- layout ---------- */
.container {
  position: relative; z-index: 10;
  max-width: 660px; margin: 0 auto;
  padding: 72px 20px 40px;
  transition: opacity .9s ease, transform .9s ease;
}
.container.locked { opacity: 0; transform: translateY(16px); }

/* ---------- hero ---------- */
.hero { margin: 24px 0 8px; }
.kicker { color: var(--muted); font-size: 12px; letter-spacing: .08em; margin-bottom: 10px; }
.kicker::before { content: '\25B8  '; color: var(--green); }

h1#title {
  font-size: clamp(2.4rem, 11vw, 4.2rem);
  font-weight: 700; color: var(--green);
  letter-spacing: -.02em; line-height: 1.05;
  text-shadow: 0 0 24px rgba(0, 255, 102, .35);
  margin-bottom: 12px; word-break: break-all;
}

.cursor { display: inline-block; font-weight: 700; color: var(--green); animation: blink 1.05s step-end infinite; }
.cursor.small { font-size: .8em; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.subtitle { color: var(--muted); font-size: 14px; }
.sep { color: var(--green-dim); margin: 0 6px; }

/* ---------- command buttons ---------- */
.commands { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 26px 0; }
.cmd {
  font-size: 15px; font-weight: 500; color: var(--green);
  background: var(--panel); border: 1px solid var(--green-dim); border-radius: 10px;
  min-height: 56px; cursor: pointer; touch-action: manipulation;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.cmd .cmd-slash { color: var(--muted); margin-right: 2px; }
.cmd:hover { background: rgba(0, 255, 102, .1); box-shadow: 0 0 18px rgba(0, 255, 102, .18); }
.cmd:active { transform: scale(.96); }

/* ---------- sections ---------- */
.skills, .terminal { margin-top: 34px; }
.sec-title {
  font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.sec-title .prompt { color: var(--green); }
.sec-title .tag {
  margin-left: auto; font-size: 11px; text-transform: none; letter-spacing: .02em;
  color: var(--green); border: 1px solid var(--green-dim); padding: 3px 10px; border-radius: 20px;
  white-space: nowrap;
}

/* ---------- skill bars ---------- */
.skill { display: grid; grid-template-columns: 110px 1fr 52px; gap: 12px; align-items: center; margin-bottom: 14px; font-size: 13px; }
.s-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-track { height: 10px; background: rgba(255,255,255,.05); border: 1px solid rgba(0,255,102,.15); border-radius: 6px; overflow: hidden; }
.s-fill {
  position: relative; height: 100%; width: 0;
  background: var(--c); border-radius: 6px; box-shadow: 0 0 14px var(--c);
  transition: width 1.4s cubic-bezier(.22, 1, .36, 1);
}
.s-fill::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(-55deg, rgba(0,0,0,.28) 0 6px, transparent 6px 12px);
}
.s-pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 420px) {
  .skill { grid-template-columns: 96px 1fr 46px; font-size: 12px; gap: 8px; }
}

/* ---------- terminal ---------- */
.term-window {
  border: 1px solid var(--green-dim); border-radius: 12px;
  background: rgba(2, 5, 2, .92); overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 255, 102, .07);
}
.term-head {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 14px; background: rgba(0, 255, 102, .05);
  border-bottom: 1px solid var(--green-faint);
}
.t-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.t-dot.r { background: #ff5f57; } .t-dot.y { background: #febc2e; } .t-dot.g { background: #28c840; }
.term-title { margin-left: 8px; font-size: 12px; color: var(--muted); }
.term-log { height: 230px; overflow-y: auto; padding: 14px; font-size: 13px; line-height: 1.7; -webkit-overflow-scrolling: touch; }
.term-log .line { word-break: break-word; }
.term-log .p { color: var(--green); }
.term-log .sys { color: var(--muted); }
.term-log .ok { color: var(--green); }
.term-log .err { color: var(--danger); }
.term-log .hl { color: var(--green); font-weight: 700; }
.term-log .dim { color: var(--muted); }
.term-log pre.ascii { font-size: 8px; line-height: 1.3; color: var(--green); overflow-x: auto; margin: 8px 0; text-shadow: 0 0 12px rgba(0,255,102,.4); }
@media (min-width: 640px) { .term-log pre.ascii { font-size: 11px; } }
.term-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-top: 1px solid var(--green-faint);
  background: rgba(0, 255, 102, .03);
}
.term-prompt { color: var(--green); font-size: 13px; white-space: nowrap; flex: none; }
#term-input {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--mono); font-size: 16px; caret-color: var(--green);
}
#term-input::placeholder { color: rgba(127, 168, 138, .5); }

/* ---------- footer ---------- */
.foot { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--green-faint); font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- winbox theming ---------- */
.fsociety-win {
  border: 1px solid var(--green-dim); border-radius: 10px; overflow: hidden;
  box-shadow: 0 0 44px rgba(0, 255, 102, .14), 0 24px 70px rgba(0, 0, 0, .65) !important;
}
.fsociety-win .wb-header { background: #0a140a; }
.fsociety-win .wb-title {
  color: var(--green) !important; font-family: var(--mono);
  font-size: 13px; letter-spacing: .06em; text-shadow: 0 0 10px rgba(0, 255, 102, .5);
}
.fsociety-win .wb-body { background: #050805; color: var(--text); padding: 22px; font-family: var(--mono); }
.fsociety-win .wb-body h2 { color: var(--green); font-size: 19px; margin-bottom: 14px; }
.fsociety-win .wb-body p { margin: 12px 0; font-size: 14px; }
.fsociety-win .wb-body .dim { color: var(--muted); font-size: 13px; }
.fsociety-win .wb-body .label {
  display: inline-block; min-width: 76px; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-right: 8px;
}
.fsociety-win .wb-body .note { font-size: 12px; color: var(--muted); margin-top: 16px; }
.fsociety-win .wb-body b { color: #fff; }

.proj {
  border: 1px solid var(--green-faint); border-radius: 8px;
  padding: 12px 14px; margin: 10px 0; display: block;
  transition: border-color .2s, background .2s;
}
.proj:hover { border-color: var(--green-dim); background: rgba(0, 255, 102, .05); }
.proj b { display: block; font-size: 14px; }
.proj span { font-size: 12px; color: var(--muted); }
.proj .go { float: right; color: var(--green); }

.links-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.icon-link {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--green-dim); border-radius: 8px;
  padding: 10px 14px; font-size: 13px; color: var(--green); background: var(--panel);
  transition: background .2s, box-shadow .2s;
}
.icon-link svg { width: 18px; height: 18px; flex: none; }
.icon-link:hover { background: rgba(0, 255, 102, .12); box-shadow: 0 0 14px rgba(0, 255, 102, .15); }

.hidden { display: none; }

/* ---------- cipher gate ---------- */
#gate {
  position: fixed; inset: 0; z-index: 110;
  background: #020402;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; transition: opacity .5s ease;
}
#gate.done { opacity: 0; pointer-events: none; }
.gate-inner { width: min(560px, 100%); text-align: center; }
.gate-kicker { color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 12px; }
.gate-title {
  color: var(--green); font-size: clamp(1.8rem, 8vw, 2.6rem); letter-spacing: .06em;
  text-shadow: 0 0 22px rgba(0, 255, 102, .4); margin-bottom: 10px;
}
.gate-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; line-height: 1.7; }
.gate-transmission { color: var(--green); font-size: 12px; letter-spacing: .12em; margin-bottom: 12px; }
.gate-hintbtn { background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; margin-bottom: 8px; }
.gate-hintbtn:hover { color: var(--green); }
.gate-btnrow { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.gate-btnrow .gate-hintbtn { margin-bottom: 8px; }
.gate-btnrow .gate-hintbtn:disabled { opacity: .35; cursor: default; text-decoration: none; }
.snd-btn { background: transparent; border: 1px solid var(--green-dim); color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; padding: 2px 10px; border-radius: 3px; cursor: pointer; }
.snd-btn:hover { color: var(--green); border-color: var(--green); }
.snd-btn.on { color: #04140a; background: var(--green); border-color: var(--green); box-shadow: 0 0 10px var(--green-dim); font-weight: 700; }
.gate-hint { display: none; color: var(--muted); font-size: 12px; line-height: 1.7; margin-bottom: 10px; }
.gate-hint.show { display: block; }
.gate-hint b { color: var(--green); }
.binary { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 16px; margin: 0 auto 18px; max-width: 520px; user-select: text; -webkit-user-select: text; cursor: text; }
.bin-group { font-size: 16px; letter-spacing: .18em; color: var(--green); text-shadow: 0 0 10px rgba(0, 255, 102, .35); white-space: nowrap; }
.bit { opacity: .55; transition: opacity .2s; }
.bit.set { opacity: 1; }
.bin-letter { display: inline-block; font-size: 26px; font-weight: 700; color: #fff; text-shadow: 0 0 16px var(--green); animation: pop .3s ease; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.gate-msg { min-height: 24px; font-size: 13px; margin-bottom: 12px; }
.gate-msg .ok { color: var(--green); }
.gate-msg .err { color: var(--danger); }
#gate-form { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
.gate-prompt { color: var(--green); }
#gate-input {
  width: min(220px, 60vw); background: rgba(0, 255, 102, .05);
  border: 1px solid var(--green-dim); border-radius: 8px;
  color: var(--text); font-family: var(--mono); font-size: 16px;
  padding: 12px 14px; outline: none; caret-color: var(--green);
}
#gate-input:focus { border-color: var(--green); box-shadow: 0 0 14px rgba(0, 255, 102, .2); }
#gate-form button {
  background: var(--green); border: none; color: #021202;
  font-family: var(--mono); font-weight: 700; font-size: 14px;
  padding: 12px 22px; border-radius: 8px; cursor: pointer; letter-spacing: .05em;
}
#gate-form button:active { transform: scale(.96); }
.gate-session { margin-top: 18px; font-size: 11px; color: rgba(127, 168, 138, .6); letter-spacing: .08em; }
.gate-trace { font-size: 11px; color: var(--muted); letter-spacing: .06em; margin: 0 0 6px; min-height: 15px; }
.gate-trace .hl { color: var(--green); }
.gate-attempts { font-size: 11px; letter-spacing: .22em; color: var(--muted); margin: 0 0 10px; min-height: 15px; }
.gate-attempts .n { color: var(--danger); font-weight: bold; }
#gate.shake { animation: shake .4s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-5px); } }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .cursor, .dot { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
