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

:root {
  --bg:        #0d1117;
  --bg2:       #161b22;
  --bg3:       #1c2330;
  --border:    #30363d;
  --green:     #39d353;
  --cyan:      #58a6ff;
  --purple:    #bc8cff;
  --orange:    #ffa657;
  --red:       #f85149;
  --yellow:    #e3b341;
  --text:      #c9d1d9;
  --muted:     #8b949e;
  --font-mono: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  --font-sans: 'Segoe UI', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre { font-family: var(--font-mono); }

nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--green);
  font-weight: 700;
  letter-spacing: -0.5px;
  text-decoration: none;
}
.nav-logo span { color: var(--muted); }

.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color .15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }

.hero {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 5rem 2rem;
  text-align: center;
}

.hero-tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--green);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: #e6edf3;
  margin-bottom: 1.2rem;
  line-height: 1.2;
}

.hero h1 .accent { color: var(--green); }

.hero p {
  max-width: 620px;
  margin: 0 auto 2rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity .15s, background .15s;
  text-decoration: none;
}
.btn:hover { opacity: .85; text-decoration: none; }
.btn-green  { background: var(--green);  color: #0d1117; border-color: var(--green); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--cyan); color: var(--cyan); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 2rem; }

section { padding: 4rem 0; }

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #e6edf3;
  margin-bottom: 0.4rem;
}
.section-sub { color: var(--muted); margin-bottom: 2.5rem; font-size: .95rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem;
  transition: border-color .2s, transform .2s;
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.card:hover { border-color: var(--cyan); transform: translateY(-2px); }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.card-title { font-weight: 700; color: #e6edf3; font-size: 1.05rem; }
.card-meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .1rem; }
.card-desc { color: var(--muted); font-size: .9rem; line-height: 1.5; flex: 1; }
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--border); }

.badge {
  font-family: var(--font-mono);
  font-size: .72rem;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-web     { background: #0e3a58; color: var(--cyan);   border-color: #1a5a8a; }
.badge-pwn     { background: #2d1b00; color: var(--orange); border-color: #5a3a00; }
.badge-crypto  { background: #1a0e3a; color: var(--purple); border-color: #3a1e7a; }
.badge-rev     { background: #0e2a1a; color: var(--green);  border-color: #1a5a2a; }
.badge-mobile  { background: #2a1a00; color: var(--yellow); border-color: #5a3a00; }
.badge-misc    { background: #1a1a1a; color: var(--muted);  border-color: #333; }

.diff-veryeasy { color: #33cc99; font-size: .8rem; font-weight: 600; }
.diff-easy     { color: var(--green);  font-size: .8rem; font-weight: 600; }
.diff-medium   { color: var(--yellow); font-size: .8rem; font-weight: 600; }
.diff-hard     { color: var(--red);    font-size: .8rem; font-weight: 600; }
.diff-insane   { color: var(--purple); font-size: .8rem; font-weight: 600; }

.badge-active  { background: #2d0e0e; color: var(--red);   border-color: #5a1a1a; }
.badge-retired { background: #1a1a1a; color: var(--muted); border-color: #333; }
.badge-lock    { font-size: .75rem; }

.stats-bar {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}
.stat {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .9rem 1.5rem;
  text-align: center;
  min-width: 110px;
}
.stat-num  { font-size: 1.8rem; font-weight: 700; color: var(--green); font-family: var(--font-mono); }
.stat-label { font-size: .8rem; color: var(--muted); }

.search-wrap {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 240px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .9rem;
  padding: .6rem 1rem;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--cyan); }
.search-input::placeholder { color: var(--muted); }

.filter-select {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  padding: .6rem 1rem;
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--cyan); }
.filter-select option { background: var(--bg2); }

.writeup-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5rem;
  align-items: start;
  padding: 3rem 0;
}

.toc {
  position: sticky;
  top: 80px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
}
.toc h3 { font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 1rem; }
.toc ul { list-style: none; }
.toc ul li { margin-bottom: .4rem; }
.toc ul li a { color: var(--muted); font-size: .88rem; transition: color .15s; }
.toc ul li a:hover { color: var(--cyan); text-decoration: none; }
.toc ul li a.active { color: var(--cyan); }
.toc ul li.sub a { padding-left: 1rem; font-size: .83rem; }

.writeup-content { min-width: 0; }

.writeup-header { margin-bottom: 2.5rem; }
.writeup-header h1 { font-size: 2rem; color: #e6edf3; margin-bottom: .8rem; }
.writeup-header .meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.writeup-header .date { color: var(--muted); font-size: .85rem; }
.writeup-header .summary-box {
  background: var(--bg3);
  border-left: 3px solid var(--cyan);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.2rem;
  color: var(--muted);
  font-size: .95rem;
}

.writeup-content h2 {
  font-size: 1.35rem;
  color: #e6edf3;
  margin: 2.5rem 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.writeup-content h3 {
  font-size: 1.1rem;
  color: var(--cyan);
  margin: 1.8rem 0 .8rem;
  scroll-margin-top: 80px;
}
.writeup-content h4 {
  font-size: .95rem;
  color: var(--orange);
  margin: 1.2rem 0 .5rem;
  font-family: var(--font-mono);
}
.writeup-content p { margin-bottom: 1rem; }
.writeup-content ul, .writeup-content ol { margin: .5rem 0 1rem 1.5rem; }
.writeup-content li { margin-bottom: .3rem; }
.writeup-content strong { color: #e6edf3; }

.code-block {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 1.2rem 0;
  overflow: hidden;
}
.code-header {
  background: #1c2330;
  padding: .5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.code-lang { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }
.copy-btn {
  font-size: .75rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .2rem .5rem;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.code-block pre {
  padding: 1.1rem;
  overflow-x: auto;
  margin: 0;
  font-size: .85rem;
  line-height: 1.6;
}
.code-block pre code { color: var(--text); }

.inline-code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .4em;
  color: var(--orange);
}

.step {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}
.step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  color: #0d1117;
  font-weight: 700;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .1rem;
}
.step-body { flex: 1; }
.step-body h3 { margin-top: 0; }

.alert {
  border-radius: 8px;
  padding: .9rem 1.2rem;
  margin: 1.2rem 0;
  font-size: .92rem;
  border-left: 3px solid;
}
.alert-info  { background: #0e2040; border-color: var(--cyan);   color: #a0c8f8; }
.alert-warn  { background: #2d1f00; border-color: var(--yellow); color: #e3b341; }
.alert-green { background: #0e2a1a; border-color: var(--green);  color: #7ee89a; }
.alert-red   { background: #2d0e0e; border-color: var(--red);    color: #f5a0a0; }

#lock-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lock-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.lock-icon { font-size: 3rem; margin-bottom: 1rem; }
.lock-card h2 { color: #e6edf3; margin-bottom: .5rem; }
.lock-card p  { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.lock-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .9rem;
  padding: .7rem 1rem;
  margin-bottom: 1rem;
  outline: none;
  text-align: center;
  letter-spacing: 1px;
}
.lock-input:focus { border-color: var(--cyan); }
.lock-error { color: var(--red); font-size: .85rem; margin-top: .5rem; display: none; }

.about-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 3rem;
  padding: 3rem 0;
  align-items: start;
}
.about-sidebar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.8rem;
  text-align: center;
  position: sticky;
  top: 80px;
}
.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: #0d1117;
  margin: 0 auto 1.2rem;
}
.about-name { font-size: 1.2rem; font-weight: 700; color: #e6edf3; margin-bottom: .3rem; }
.about-title { color: var(--green); font-size: .9rem; font-family: var(--font-mono); margin-bottom: 1rem; }
.about-links { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.2rem; }
.about-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
  font-size: .88rem;
  padding: .5rem .8rem;
  border-radius: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  transition: border-color .15s, color .15s;
  justify-content: center;
}
.about-link:hover { border-color: var(--cyan); color: var(--cyan); text-decoration: none; }

.skills-grid { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.skill-tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .25rem .7rem;
  font-size: .82rem;
  color: var(--text);
  font-family: var(--font-mono);
}

.exp-item { margin-bottom: 1.8rem; padding-bottom: 1.8rem; border-bottom: 1px solid var(--border); }
.exp-item:last-child { border-bottom: none; margin-bottom: 0; }
.exp-title { font-weight: 700; color: #e6edf3; }
.exp-company { color: var(--cyan); font-size: .9rem; }
.exp-date { color: var(--muted); font-size: .82rem; font-family: var(--font-mono); }
.exp-desc { color: var(--muted); font-size: .92rem; margin-top: .5rem; }

footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 2.5rem 2rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.footer-brand { font-family: var(--font-mono); color: var(--green); font-weight: 700; }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-size: .88rem; display: flex; align-items: center; gap: .35rem; }
.footer-links a:hover { color: var(--cyan); text-decoration: none; }
.footer-copy { color: var(--muted); font-size: .82rem; width: 100%; text-align: center; padding-top: 1.5rem; border-top: 1px solid var(--border); margin-top: .5rem; }

@media (max-width: 768px) {
  .writeup-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .about-sidebar { position: static; }
  nav { padding: 0 1rem; }
  .nav-links { gap: 1rem; }
  .hero { padding: 3rem 1rem; }
}
