:root {
    --bg: #0d1117;
    --fg: #c9d1d9;
    --accent: #58a6ff;
    --green: #3fb950;
    --blue: #58a6ff;
    --purple: #bc8cff;
    --cyan: #39c5cf;
    --yellow: #d29922;
    --red: #f85149;
    --dim: #8b949e;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; }
  body {
    background: var(--bg);
    color: var(--fg);
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
    font-size: 15px;
    line-height: 1.5;
  }
  #terminal {
    height: 100vh;
    overflow-y: auto;
    padding: 16px 20px;
    scrollbar-width: thin;
    scrollbar-color: #30363d transparent;
  }
  #terminal::-webkit-scrollbar { width: 10px; }
  #terminal::-webkit-scrollbar-thumb { background: #30363d; border-radius: 5px; }
  .line { white-space: pre-wrap; word-break: break-word; }
  .prompt { color: var(--green); }
  .prompt .path { color: var(--accent); }
  .prompt .sym { color: var(--dim); }
  .input-line { display: flex; }
  .input-line span.prompt { flex-shrink: 0; white-space: pre; }
  #input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg);
    font: inherit;
    caret-color: var(--accent);
  }
  .c-fg      { color: var(--fg); }
  .c-green   { color: var(--green); }
  .c-blue    { color: var(--blue); }
  .c-purple  { color: var(--purple); }
  .c-cyan    { color: var(--cyan); }
  .c-yellow  { color: var(--yellow); }
  .c-red     { color: var(--red); }
  .c-dim     { color: var(--dim); }
  .c-bold    { font-weight: 700; }
  .c-dim2    { opacity: .6; }
  .art { color: var(--blue); white-space: pre; }
  .logo-art { color: #66BB6A; white-space: pre; font-weight: 700; text-shadow: 0 0 12px rgba(102, 187, 106, .45); }
  .logo-tag { white-space: pre; font-weight: 700; color: #A5D6A7; }
  .logo-pixel { white-space: pre; }
  a { cursor: pointer; text-decoration: underline; }
  #matrix {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: none;
    background: var(--bg);
  }
  #game-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(3, 8, 5, 0.82);
    backdrop-filter: blur(2px);
  }
  .game-panel {
    display: flex;
    flex-direction: column;
    border: 1px solid #2E7D32;
    box-shadow: 0 0 24px rgba(102, 187, 106, .25);
    background: #060b07;
    padding: 12px 14px;
    position: relative;
  }
  .game-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 24px;
    margin-bottom: 8px;
    font-size: 13px;
  }
  .game-title {
    color: #94ffbe;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(102, 187, 106, .5);
  }
  .game-controls { color: var(--dim); }
  .game-canvas { display: block; border: 1px solid #1b3a20; background: #060b07; }
  .game-hud {
    color: #A5D6A7;
    font-size: 13px;
    padding: 8px 2px 2px;
  }
  .game-hud b { color: #eafff0; }
  .game-menu {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(4, 10, 6, 0.9);
  }
  .game-menu-title {
    color: #eafff0;
    font-weight: 700;
    font-size: 28px;
    letter-spacing: 4px;
    text-shadow: 0 0 14px rgba(102, 187, 106, .6);
  }
  .game-menu-score { color: #A5D6A7; font-size: 15px; }
  .game-btn {
    font: inherit;
    font-size: 14px;
    padding: 8px 22px;
    cursor: pointer;
    background: #0d1a10;
    color: #94ffbe;
    border: 1px solid #2E7D32;
    border-radius: 3px;
    min-width: 160px;
  }
  .game-btn:hover { background: #16351d; color: #eafff0; }
  #nano-modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(3, 8, 5, 0.85);
  }
  .nano-panel {
    display: flex;
    flex-direction: column;
    width: min(860px, 94vw);
    height: min(620px, 88vh);
    border: 1px solid #2E7D32;
    background: #0a120c;
    box-shadow: 0 0 24px rgba(102, 187, 106, .25);
  }
  .nano-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    background: #2E7D32;
    color: #eafff0;
    font-weight: 700;
    padding: 3px 10px;
    font-size: 14px;
  }
  .nano-mod { font-weight: 400; color: #eafff0; opacity: .9; }
  .nano-body {
    flex: 1;
    background: #060b07;
    color: #c9e8cf;
    font: 14px/1.5 "Fira Code", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
    border: none;
    outline: none;
    resize: none;
    padding: 8px 12px;
    white-space: pre;
    overflow: auto;
    caret-color: #94ffbe;
  }
  .nano-status {
    min-height: 1.5em;
    color: #A5D6A7;
    font-size: 13px;
    padding: 2px 10px;
    white-space: pre-wrap;
  }
  .nano-bar {
    display: flex;
    gap: 22px;
    background: #2E7D32;
    color: #eafff0;
    font-size: 13px;
    padding: 3px 10px;
  }
  .nano-bar b {
    background: rgba(255, 255, 255, .2);
    padding: 0 4px;
    border-radius: 2px;
    margin-right: 3px;
  }
  #glitch-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(4, 9, 6, .78);
    pointer-events: none;
    text-align: center;
    font-size: 17px;
    overflow: hidden;
  }
  #glitch-overlay.on { display: flex; animation: glitch-flicker .09s steps(2) infinite; }
  #glitch-overlay::before,
  #glitch-overlay::after {
    content: "";
    position: absolute;
    left: -5%;
    right: -5%;
    top: 0;
    bottom: 0;
    background: repeating-linear-gradient(0deg,
      rgba(102, 187, 106, .08) 0 2px,
      transparent 2px 6px,
      rgba(148, 255, 190, .05) 6px 9px,
      transparent 9px 22px);
    mix-blend-mode: screen;
  }
  #glitch-overlay::before { animation: tear-a .11s infinite linear alternate; }
  #glitch-overlay::after  { animation: tear-b .13s infinite linear alternate; }
  .glitch-msg {
    position: relative;
    color: #eafff0;
    letter-spacing: 1px;
    text-shadow: 2px 0 #f85149, -2px 0 #58a6ff, 0 0 14px rgba(102, 187, 106, .6);
    animation: glitch-jitter .12s infinite;
  }
  .glitch-sub {
    position: relative;
    color: #A5D6A7;
    animation: glitch-jitter .17s infinite;
  }
  .glitch-sub b { color: #94ffbe; }
  @keyframes glitch-flicker { 0% { opacity: .92; } 50% { opacity: .72; } 100% { opacity: 1; } }
  @keyframes tear-a { from { transform: translateY(-6px) scaleX(1); } to { transform: translateY(7px) scaleX(1.03); } }
  @keyframes tear-b { from { transform: translateY(9px) translateX(-10px); } to { transform: translateY(-8px) translateX(12px); } }
  @keyframes glitch-jitter {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-2px, 1px); }
    50%  { transform: translate(2px, -1px) skewX(3deg); }
    75%  { transform: translate(-1px, 2px); }
    100% { transform: translate(1px, -2px); }
  }
  body.glitch-shake { animation: body-shake .35s; }
  @keyframes body-shake {
    0%, 100% { transform: translate(0, 0); }
    15% { transform: translate(-6px, 2px); }
    30% { transform: translate(5px, -3px); }
    45% { transform: translate(-4px, -2px); }
    60% { transform: translate(4px, 3px); }
    80% { transform: translate(-2px, 1px); }
  }
