/* ════════════════════════════════════════════════
   jcimlas — styles
   ════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg:        #000000;
  --bg2:       #0a0a0a;
  --surface:   #111111;
  --surface2:  #1a1a1a;
  --border:    rgba(255,255,255,0.08);
  --border2:   rgba(255,255,255,0.15);
  --text:      #ffffff;
  --text2:     #888888;
  --muted:     #444444;
  --accent:    #ffffff;
  --accent2:   rgba(255,255,255,0.1);
  --green:     #ffffff;
  --yellow:    #cccccc;
  --red:       #aaaaaa;
  --spotify:   #ffffff;
  --sidebar-w: 230px;
  --ff:        'Inter', system-ui, sans-serif;
  --ffm:       'JetBrains Mono', monospace;
  --r:         6px;
  --ease:      cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--ff);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: #fff; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--ff); cursor: pointer; border: none; background: none; color: inherit; }
textarea, input { font-family: var(--ff); }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 2px; }

/* ── GRAIN ── */
.grain {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: .4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  animation: grainShift 8s steps(10) infinite;
}

@keyframes grainShift {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -10%); }
  20% { transform: translate(-15%, 5%); }
  30% { transform: translate(7%, -25%); }
  40% { transform: translate(-5%, 25%); }
  50% { transform: translate(-15%, 10%); }
  60% { transform: translate(15%, 0%); }
  70% { transform: translate(0%, 15%); }
  80% { transform: translate(3%, 35%); }
  90% { transform: translate(-10%, 10%); }
}

/* ── BG ORBS ── */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(100px); }
.orb-1 { 
  width: 600px; height: 600px; top: -250px; left: -150px; 
  background: radial-gradient(circle, rgba(255,255,255,0.04), transparent 70%); 
  animation: orbf 20s ease-in-out infinite, orbPulse 8s ease-in-out infinite;
}
.orb-2 { 
  width: 500px; height: 500px; bottom: -150px; right: -150px; 
  background: radial-gradient(circle, rgba(255,255,255,0.03), transparent 70%); 
  animation: orbf 28s ease-in-out infinite reverse, orbPulse 12s ease-in-out infinite 2s;
}
@keyframes orbf { 
  0%,100%{transform:translate(0, 0) rotate(0deg)} 
  33%{transform:translate(-30px, -50px) rotate(120deg)} 
  66%{transform:translate(40px, 30px) rotate(240deg)} 
}
@keyframes orbPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════ */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  padding: 0 0 20px;
}

.sidebar-top {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 20px 24px;
  border-bottom: 1px solid var(--border);
}

/* Avatar */
.avatar-wrap { position: relative; margin-bottom: 14px; }

.avatar-ring {
  position: relative;
  width: 72px; height: 72px;
}
.avatar-ring::before {
  content: '';
  position: absolute; inset: -2px; border-radius: 50%;
  background: conic-gradient(#fff 0deg, #666 90deg, #fff 180deg, #666 270deg, #fff 360deg);
  animation: ringr 4s linear infinite;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), white calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), white calc(100% - 2px));
  filter: blur(1px);
}
@keyframes ringr { to { transform: rotate(360deg); } }

.avatar-img {
  width: 72px; height: 72px; border-radius: 50%;
  background: #000;
  border: 2px solid var(--border2);
  position: relative; z-index: 1;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.avatar-black {
  width: 100%; height: 100%; border-radius: 50%;
  background: #000;
}

.status-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 16px; height: 16px; border-radius: 50%;
  border: 3px solid var(--bg2);
  background: var(--muted);
  z-index: 2; transition: background .3s;
}
.status-dot[data-status="online"]  { background: #fff; box-shadow: 0 0 8px rgba(255,255,255,.5); }
.status-dot[data-status="idle"]    { background: #ccc; }
.status-dot[data-status="dnd"]     { background: #aaa; }
.status-dot[data-status="offline"] { background: var(--muted); }

/* Glitch effect for title */
.sidebar-name {
  font-size: 16px; font-weight: 700; letter-spacing: -.3px;
  margin-bottom: 3px;
  position: relative;
  animation: glitchText 8s infinite;
}

@keyframes glitchText {
  0%, 90%, 100% { transform: translate(0); }
  91% { transform: translate(-2px, 1px); }
  92% { transform: translate(2px, -1px); }
  93% { transform: translate(-1px, 2px); }
  94% { transform: translate(1px, -2px); }
  95% { transform: translate(0); }
}

.sidebar-handle {
  font-family: var(--ffm); font-size: 11px; color: var(--text2);
  text-align: center; min-height: 16px;
}

/* Nav */
.sidebar-nav {
  flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 3px;
  overflow-y: auto;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 500; color: var(--text2);
  transition: all .18s var(--ease);
  text-align: left; width: 100%;
  position: relative;
  overflow: hidden;
}

.nav-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 0;
  background: #fff;
  transition: height .3s var(--ease);
  transform: translateY(-50%);
}

.nav-btn:hover::before,
.nav-btn.active::before {
  height: 60%;
}

.nav-btn svg { flex-shrink: 0; transition: all .18s; }
.nav-btn:hover { 
  background: rgba(255,255,255,.08);
  color: #fff;
  padding-left: 18px;
}
.nav-btn:hover svg {
  transform: translateX(3px);
}
.nav-btn.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 600;
  padding-left: 18px;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 500; color: var(--text2);
  transition: all .18s var(--ease);
  text-align: left; width: 100%;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 0;
  background: #fff;
  transition: height .3s var(--ease);
  transform: translateY(-50%);
}

.nav-link:hover::before {
  height: 60%;
}

.nav-link svg { flex-shrink: 0; transition: all .18s; }
.nav-link:hover { 
  background: rgba(255,255,255,.08);
  color: var(--accent);
  text-decoration: none;
  padding-left: 18px;
}
.nav-link:hover svg {
  transform: translateX(3px);
}

.sidebar-footer {
  padding: 0 20px;
  font-family: var(--ffm); font-size: 10px; color: var(--muted);
  animation: fadeIn 2s ease-out 1s both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}



/* ════════════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════════════ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100dvh;
  padding: 48px 52px;
  position: relative; z-index: 1;
  max-width: 1400px;
}

/* Scanline effect */
.scanline {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(255, 255, 255, 0.02) 51%
  );
  background-size: 100% 4px;
  animation: scanlineMove 8s linear infinite;
}

@keyframes scanlineMove {
  0% { background-position: 0 0; }
  100% { background-position: 0 100%; }
}

/* Matrix rain effect */
.matrix-rain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.matrix-column {
  position: absolute;
  top: -100%;
  font-family: var(--ffm);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.15);
  white-space: pre;
  animation: matrixFall linear infinite;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

@keyframes matrixFall {
  to { transform: translateY(100vh); }
}

/* Terminal Header */
.terminal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 32px;
  font-family: var(--ffm);
  font-size: 13px;
  color: var(--text2);
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
  animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-title {
  flex: 1;
  color: #fff;
}

.cursor-blink {
  animation: blink 1.2s infinite;
  color: #fff;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.status-section, .chat-section {
  animation: fadeInScale .8s var(--ease);
}

@keyframes fadeInScale { 
  from { 
    opacity: 0; 
    transform: scale(0.95) translateY(20px); 
  } 
  to { 
    opacity: 1; 
    transform: scale(1) translateY(0); 
  } 
}

.chat-section {
  animation-delay: 0.2s;
  opacity: 0;
  animation-fill-mode: forwards;
}

.page-header { margin-bottom: 32px; }
.page-title {
  font-size: 30px; font-weight: 700; letter-spacing: -.6px;
  margin-bottom: 6px; line-height: 1.1;
  position: relative;
  display: inline-block;
}

.page-title::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: #fff;
  animation: underlineGrow 1.5s ease-out forwards;
}

@keyframes underlineGrow {
  to { width: 100%; }
}

.page-title .accent { color: #fff; }
.wave { display: inline-block; animation: wave 2.5s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes wave { 0%,100%{transform:rotate(0)} 15%{transform:rotate(14deg)} 30%{transform:rotate(-8deg)} 45%{transform:rotate(14deg)} 60%{transform:rotate(-4deg)} 75%{transform:rotate(10deg)} }
.page-sub { font-size: 14px; color: var(--text2); line-height: 1.6; }

/* ── CODE CARD ── */
.code-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}
.code-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.code-dots { display: flex; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-red    { background: #fff; }
.dot-yellow { background: #ccc; }
.dot-green  { background: #888; }
.code-filename { font-family: var(--ffm); font-size: 12px; color: var(--text2); margin-left: 6px; }
.code-body { padding: 20px 24px; overflow-x: auto; }
code { font-family: var(--ffm); font-size: 13.5px; line-height: 1.9; display: block; }

/* Syntax colors */
.kw  { color: #fff; }
.var { color: #ccc; }
.key { color: #ddd; }
.str { color: #aaa; }
.fn  { color: #ccc; }
.cmt { color: var(--muted); font-style: italic; }

/* ── HOME LINKS ── */
.home-links { display: flex; flex-direction: column; gap: 10px; }
.home-link-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border);
  text-align: left; transition: all .2s var(--ease);
  position: relative; overflow: hidden;
}
.home-link-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.03) 50%, transparent 70%);
  transform: translateX(-100%); transition: transform .5s;
}
.home-link-btn:hover::before { transform: translateX(100%); }
.home-link-btn:hover { background: var(--surface2); border-color: var(--border2); transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0,0,0,.2); }

.hlb-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hlb-status { background: rgba(114,137,218,.15); color: var(--accent); }
.hlb-chat   { background: rgba(59,165,92,.12); color: var(--green); }
.hlb-text { flex: 1; }
.hlb-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.hlb-sub   { font-size: 12px; color: var(--text2); }
.hlb-arrow { color: var(--text2); font-size: 16px; transition: transform .2s; }
.home-link-btn:hover .hlb-arrow { transform: translateX(3px); }

/* ════════════════════════════════════════════════
   DISCORD / STATUS CARD
   ════════════════════════════════════════════════ */
.discord-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
  margin-bottom: 16px; max-width: 560px;
  transition: all .3s var(--ease);
  position: relative;
}

.discord-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  transition: left 0.5s;
}

.discord-card:hover::before {
  left: 100%;
}

.discord-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255,255,255,.15);
  border-color: var(--border2);
}

.dc-banner {
  height: 80px;
  background: linear-gradient(135deg, #0a0a0a 0%, #000 50%, #0a0a0a 100%);
}

.dc-body {
  padding: 0 20px 16px;
  display: flex; align-items: flex-end; gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.dc-avatar-wrap { position: relative; margin-top: -36px; }
.dc-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: #000;
  border: 5px solid var(--surface);
  overflow: hidden; flex-shrink: 0;
}
.dc-avatar img { width: 100%; height: 100%; object-fit: cover; }

.dc-status-dot {
  position: absolute; bottom: 4px; right: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 4px solid var(--surface);
  background: var(--muted);
  transition: background .3s;
}
.dc-status-dot[data-status="online"]  { background: #fff; }
.dc-status-dot[data-status="idle"]    { background: #ccc; }
.dc-status-dot[data-status="dnd"]     { background: #aaa; }
.dc-status-dot[data-status="offline"] { background: var(--muted); }

.dc-info { flex: 1; padding-bottom: 4px; min-width: 0; }
.dc-name { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.dc-tag  { font-size: 12px; color: var(--text2); font-family: var(--ffm); margin-top: 1px; }

.dc-status-badge {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 20px;
  background: var(--surface2); border: 1px solid var(--border2);
  font-size: 12px; font-weight: 600;
  font-family: var(--ffm);
  margin-bottom: 4px;
}
.dc-status-indicator {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); flex-shrink: 0;
}
.dc-status-indicator[data-status="online"]  { background: #fff; box-shadow: 0 0 6px rgba(255,255,255,.6); }
.dc-status-indicator[data-status="idle"]    { background: #ccc; }
.dc-status-indicator[data-status="dnd"]     { background: #aaa; }
.dc-status-indicator[data-status="offline"] { background: var(--muted); }

.dc-section-title {
  font-family: var(--ffm); font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; color: var(--text2);
  padding: 12px 20px 8px;
  display: flex; align-items: center; gap: 6px;
}

.dc-activities { border-top: 1px solid var(--border); }
.dc-activity-list { padding: 0 20px 16px; display: flex; flex-direction: column; gap: 12px; }

.dc-activity {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--r);
  background: var(--surface2); border: 1px solid var(--border);
}
.dc-activity-icon {
  width: 52px; height: 52px; border-radius: 8px;
  background: var(--bg); object-fit: cover; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  border: 1px solid var(--border);
}
.dc-activity-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.dc-activity-name   { font-size: 13.5px; font-weight: 700; }
.dc-activity-detail { font-size: 12px; color: var(--text2); margin-top: 2px; }
.dc-activity-state  { font-size: 12px; color: var(--text2); margin-top: 1px; }

/* Spotify */
.dc-spotify { border-top: 1px solid var(--border); }
.spotify-card {
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px 16px;
}
.spotify-art {
  width: 56px; height: 56px; border-radius: 6px;
  object-fit: cover; flex-shrink: 0;
  background: var(--surface2);
}
.spotify-info { flex: 1; min-width: 0; }
.spotify-song   { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spotify-artist { font-size: 12px; color: var(--text2); margin: 2px 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spotify-bar-wrap { height: 3px; background: var(--border2); border-radius: 2px; overflow: hidden; }
.spotify-bar {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  transition: width 1s linear;
}

/* Loading */
.dc-loading {
  display: flex; align-items: center; gap: 12px;
  padding: 20px; color: var(--text2); font-size: 13px;
}
.loading-spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border2);
  border-top-color: #fff;
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-note {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--muted);
  font-family: var(--ffm);
  animation: fadeInUp 1s ease-out 0.5s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ════════════════════════════════════════════════
   CHAT
   ════════════════════════════════════════════════ */
.chat-wrap {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
  max-width: 640px;
  transition: all .3s var(--ease);
  position: relative;
}

.chat-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  transition: left 0.5s;
}

.chat-wrap:hover::before {
  left: 100%;
}

.chat-wrap:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255,255,255,.12);
  border-color: var(--border2);
}

.chat-messages {
  flex: 1; padding: 20px;
  display: flex; flex-direction: column; gap: 2px;
  min-height: 320px; max-height: 460px;
  overflow-y: auto; scrollbar-width: thin;
  scrollbar-color: var(--surface2) transparent;
}

/* Typing indicator */
.typing-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  color: var(--text2);
  font-size: 12px;
  font-family: var(--ffm);
}

.typing-indicator.active {
  display: flex;
}

.typing-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Message bubbles */
.msg {
  display: flex; gap: 10px; padding: 6px 8px;
  border-radius: 8px; transition: all .15s;
  animation: msgIn .25s var(--ease);
  position: relative;
}
.msg:hover { 
  background: rgba(255,255,255,.02); 
  transform: translateX(2px);
}
.msg::before {
  content: '>';
  position: absolute;
  left: -8px;
  color: #fff;
  opacity: 0;
  transition: opacity .2s;
  font-family: var(--ffm);
  font-size: 12px;
}
.msg:hover::before {
  opacity: 1;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.msg-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0; color: #fff;
  text-transform: uppercase;
  margin-top: 1px;
}
.msg-body { flex: 1; min-width: 0; }
.msg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.msg-name { font-size: 13.5px; font-weight: 700; color: #fff; }
.msg-time { font-size: 10.5px; color: var(--muted); font-family: var(--ffm); }
.msg-text { font-size: 13.5px; color: var(--text); line-height: 1.55; word-break: break-word; }

/* Empty state */
.chat-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; color: var(--muted);
  padding: 40px; text-align: center;
}
.chat-empty-icon { font-size: 36px; }
.chat-empty-text { font-size: 13px; }

/* Divider for date groups */
.msg-date-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0; color: var(--muted);
  font-size: 10.5px; font-family: var(--ffm);
}
.msg-date-divider::before, .msg-date-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Input */
.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  background: var(--bg2);
}
.chat-name-row { margin-bottom: 8px; }
.chat-msg-row { display: flex; gap: 8px; align-items: flex-end; }

.chat-input {
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--text); border-radius: var(--r);
  font-size: 13.5px; outline: none;
  transition: border-color .2s;
  width: 100%; resize: none;
}
.chat-input::placeholder { color: var(--muted); }
.chat-input:focus { border-color: rgba(114,137,218,.4); }

.chat-name-input { padding: 8px 12px; }
.chat-msg-input  { padding: 10px 12px; flex: 1; }

.chat-send-btn {
  width: 42px; height: 42px; border-radius: var(--r);
  background: #fff; color: #000;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(255,255,255,.25);
  position: relative;
  overflow: hidden;
}
.chat-send-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(0,0,0,.1) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform .5s;
}
.chat-send-btn:hover::before {
  transform: translateX(100%);
}
.chat-send-btn:hover { 
  background: #e0e0e0; 
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 4px 20px rgba(255,255,255,.4);
}
.chat-send-btn:active { transform: translateY(0) scale(0.98); }
.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  pointer-events: none;
}

.chat-char-count {
  font-family: var(--ffm); font-size: 10.5px; color: var(--muted);
  text-align: right; margin-top: 6px;
}
.chat-char-count.warn { color: var(--yellow); }
.chat-char-count.over { color: var(--red); }

/* ════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .content-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

@media (max-width: 800px) {
  .sidebar { display: none; }
  .main {
    margin-left: 0;
    padding: 28px 20px 40px;
    max-width: 100%;
  }
  .page-title { font-size: 24px; }
  .content-grid {
    gap: 32px;
  }
  .terminal-header {
    font-size: 11px;
    padding: 10px 14px;
  }
}

@media (max-width: 480px) {
  .main { padding: 20px 14px 40px; }
  .dc-name { font-size: 17px; }
  .terminal-title {
    font-size: 10px;
  }
}


/* ════════════════════════════════════════════════
   GAMES & TABS
   ════════════════════════════════════════════════ */
.tab-content {
  display: none;
  animation: fadeInScale .8s var(--ease);
}

.tab-content.active {
  display: block;
}

/* Game Container */
.game-container {
  max-width: 800px;
  margin: 0 auto;
}

.game-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}

.game-status {
  font-family: var(--ffm);
  font-size: 14px;
  color: #fff;
  text-align: center;
  margin-bottom: 16px;
  padding: 8px;
  background: rgba(255,255,255,.05);
  border-radius: var(--r);
}

.game-players {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.player-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text2);
}

.player-symbol {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  font-family: var(--ffm);
  font-weight: 700;
  color: #fff;
}

/* Tic-Tac-Toe */
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 24px 0;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.ttt-cell {
  aspect-ratio: 1;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ffm);
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all .2s var(--ease);
  position: relative;
  overflow: hidden;
}

.ttt-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.05);
  opacity: 0;
  transition: opacity .2s;
}

.ttt-cell:hover::before {
  opacity: 1;
}

.ttt-cell:hover {
  border-color: var(--border2);
  transform: scale(1.05);
}

.ttt-cell.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ttt-cell.winner {
  background: rgba(255,255,255,.1);
  border-color: #fff;
  animation: winPulse 0.5s ease-in-out;
}

@keyframes winPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Draw Canvas */
.draw-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 16px;
}

.draw-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.draw-tool-btn {
  width: 40px;
  height: 40px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  transition: all .2s;
}

.draw-tool-btn:hover,
.draw-tool-btn.active {
  background: rgba(255,255,255,.1);
  border-color: #fff;
  color: #fff;
}

.draw-slider {
  width: 100px;
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
}

.draw-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
}

.draw-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.draw-clear-btn {
  padding: 8px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text2);
  font-size: 13px;
  font-family: var(--ffm);
  transition: all .2s;
}

.draw-clear-btn:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-color: #fff;
}

.draw-online {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ffm);
  font-size: 12px;
  color: var(--text2);
}

.online-dot {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

#draw-canvas {
  width: 100%;
  max-width: 800px;
  height: 600px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: crosshair;
  display: block;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}

/* Snake Game */
.snake-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-label {
  font-size: 11px;
  color: var(--text2);
  font-family: var(--ffm);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  font-family: var(--ffm);
}

#snake-canvas {
  width: 100%;
  max-width: 600px;
  height: 600px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  display: block;
  margin: 24px auto;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}

.snake-controls {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.game-btn,
.game-reset-btn {
  padding: 12px 32px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: var(--r);
  font-family: var(--ffm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 2px 12px rgba(255,255,255,.2);
  display: block;
  margin: 0 auto;
}

.game-btn:hover,
.game-reset-btn:hover {
  background: #e0e0e0;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(255,255,255,.3);
}

.game-btn:active,
.game-reset-btn:active {
  transform: translateY(0);
}

.snake-leaderboard {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
}

.leaderboard-title {
  font-family: var(--ffm);
  font-size: 11px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: var(--surface2);
  border-radius: var(--r);
  font-family: var(--ffm);
  font-size: 13px;
}

.leaderboard-item .rank {
  color: var(--text2);
  min-width: 30px;
}

.leaderboard-item .name {
  flex: 1;
  color: #fff;
}

.leaderboard-item .score {
  color: #fff;
  font-weight: 700;
}

@media (max-width: 800px) {
  .snake-controls {
    flex-direction: column;
  }
  
  .game-container {
    padding: 0 16px;
  }
  
  #draw-canvas,
  #snake-canvas {
    height: 400px;
  }
  
  .ttt-board {
    max-width: 300px;
  }
  
  .ttt-cell {
    font-size: 36px;
  }
}


/* Username Prompt */
.username-prompt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 48px;
  text-align: center;
  max-width: 400px;
  margin: 48px auto;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}

.username-prompt-content h3 {
  font-size: 20px;
  margin-bottom: 20px;
  color: #fff;
}

.username-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: #fff;
  font-family: var(--ffm);
  font-size: 14px;
  margin-bottom: 20px;
  outline: none;
  transition: border-color .2s;
}

.username-input:focus {
  border-color: #fff;
}

.username-input::placeholder {
  color: var(--text2);
}

/* Reaction Time Game */
.reaction-box {
  width: 100%;
  max-width: 600px;
  height: 400px;
  margin: 24px auto;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}

.reaction-box.waiting {
  background: #ff0000;
  border-color: #ff0000;
}

.reaction-box.ready {
  background: #ffffff;
  border-color: #ffffff;
}

.reaction-box.too-soon {
  background: #ff0000;
  border-color: #ff0000;
}

#reaction-text {
  font-family: var(--ffm);
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  z-index: 1;
}

.reaction-box.ready #reaction-text {
  color: #000;
}

/* Typing Test */
.typing-text-display {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  margin: 24px 0;
  font-family: var(--ffm);
  font-size: 18px;
  line-height: 1.8;
  color: var(--text2);
  min-height: 150px;
}

.typing-text-display .char {
  position: relative;
}

.typing-text-display .char.correct {
  color: #fff;
}

.typing-text-display .char.incorrect {
  color: #ff0000;
  background: rgba(255, 0, 0, 0.2);
}

.typing-text-display .char.current {
  background: rgba(255, 255, 255, 0.2);
  animation: blink 1s infinite;
}

.typing-input {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: #fff;
  font-family: var(--ffm);
  font-size: 16px;
  resize: vertical;
  margin-bottom: 16px;
  outline: none;
  transition: border-color .2s;
}

.typing-input:focus {
  border-color: #fff;
}

.typing-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Memory Game */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 400px;
  margin: 32px auto;
}

.memory-cell {
  aspect-ratio: 1;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: all .2s;
  position: relative;
}

.memory-cell:hover {
  border-color: var(--border2);
  transform: scale(1.05);
}

.memory-cell.active {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.memory-cell.correct {
  background: rgba(255, 255, 255, 0.2);
  animation: correctPulse 0.3s;
}

.memory-cell.wrong {
  background: rgba(255, 0, 0, 0.3);
  animation: shake 0.3s;
}

@keyframes correctPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* Leaderboard improvements */
.leaderboard-empty {
  text-align: center;
  padding: 24px;
  color: var(--text2);
  font-family: var(--ffm);
  font-size: 13px;
}

.leaderboard-item.highlight {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

@media (max-width: 800px) {
  .username-prompt {
    padding: 32px 24px;
    margin: 24px 16px;
  }
  
  .reaction-box {
    height: 300px;
  }
  
  .memory-grid {
    max-width: 300px;
    gap: 8px;
  }
}


/* Draw Color Picker */
.draw-color-picker {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface2);
  cursor: pointer;
  padding: 2px;
}

.draw-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.draw-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

/* Gallery */
.draw-gallery {
  margin-top: 48px;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.gallery-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.gallery-count {
  font-family: var(--ffm);
  font-size: 12px;
  color: var(--text2);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: var(--text2);
  font-family: var(--ffm);
  font-size: 13px;
}

.gallery-item {
  aspect-ratio: 4/3;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: all .2s var(--ease);
  position: relative;
}

.gallery-item:hover {
  transform: translateY(-4px);
  border-color: var(--border2);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  padding: 12px 8px 8px;
  opacity: 0;
  transition: opacity .2s;
}

.gallery-item:hover .gallery-item-info {
  opacity: 1;
}

.gallery-item-author {
  font-size: 11px;
  color: #fff;
  font-weight: 600;
  display: block;
}

.gallery-item-date {
  font-size: 10px;
  color: var(--text2);
  font-family: var(--ffm);
}

/* Gallery Modal */
.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gallery-modal.active {
  display: flex;
}

.gallery-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.gallery-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 20px;
  animation: modalZoom 0.3s var(--ease);
}

@keyframes modalZoom {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.gallery-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: all .2s;
  z-index: 1;
}

.gallery-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

.gallery-modal-content img {
  max-width: 100%;
  max-height: calc(90vh - 100px);
  display: block;
  border-radius: var(--r);
}

.gallery-modal-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.gallery-modal-info span {
  font-family: var(--ffm);
  font-size: 12px;
  color: var(--text2);
}

#gallery-modal-author {
  color: #fff;
  font-weight: 600;
}

@media (max-width: 800px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  
  .draw-controls {
    flex-direction: column;
    gap: 12px;
  }
  
  .draw-tools {
    flex-wrap: wrap;
  }
}


/* ════════════════════════════════════════════════
   CUSTOM MODALS (replaces alert/prompt)
   ════════════════════════════════════════════════ */

.custom-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.custom-modal.active {
  display: flex;
}

.custom-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.custom-modal-content {
  position: relative;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 12px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
  animation: slideUp 0.3s ease;
  overflow: hidden;
}

.custom-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #222;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #111 0%, #0a0a0a 100%);
}

.custom-modal-icon {
  font-size: 24px;
  line-height: 1;
}

.custom-modal-title {
  font-family: var(--ffm);
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.02em;
}

.custom-modal-body {
  padding: 24px;
  color: #ccc;
  font-family: var(--ff);
  font-size: 14px;
  line-height: 1.6;
}

.custom-modal-input {
  width: 100%;
  padding: 12px 14px;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-family: var(--ffm);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.custom-modal-input:focus {
  border-color: #666;
  background: #151515;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.custom-modal-input::placeholder {
  color: #555;
}

.custom-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #222;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: #0a0a0a;
}

.custom-modal-btn {
  padding: 10px 20px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 8px;
  font-family: var(--ffm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: -0.01em;
}

.custom-modal-btn:hover {
  background: #e0e0e0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.custom-modal-btn:active {
  transform: translateY(0);
}

.custom-modal-btn.secondary {
  background: #222;
  color: #aaa;
  border: 1px solid #333;
}

.custom-modal-btn.secondary:hover {
  background: #2a2a2a;
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


/* ════════════════════════════════════════════════
   RESPONSIVE DESIGN - Mobile & Tablet
   ════════════════════════════════════════════════ */

/* Tablet and smaller */
@media (max-width: 1024px) {
  body {
    padding: 10px;
  }
  
  .container {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .sidebar {
    position: relative;
    width: 100%;
    max-width: none;
  }
  
  .main {
    width: 100%;
  }
  
  .matrix-rain {
    display: none; /* Hide matrix rain on mobile for performance */
  }
}

/* Mobile phones */
@media (max-width: 768px) {
  body {
    padding: 5px;
    font-size: 14px;
  }
  
  .container {
    gap: 10px;
  }
  
  /* Sidebar adjustments */
  .profile {
    padding: 20px;
  }
  
  .avatar {
    width: 80px;
    height: 80px;
  }
  
  .handle {
    font-size: 20px;
  }
  
  .nav-btn {
    padding: 10px 14px;
    font-size: 13px;
  }
  
  /* Chat adjustments */
  .chat-box {
    height: 300px;
  }
  
  .chat-input-wrap {
    flex-direction: column;
    gap: 8px;
  }
  
  .chat-name-input {
    width: 100%;
  }
  
  .chat-msg-input {
    width: 100%;
  }
  
  .chat-send-btn {
    width: 100%;
    height: 44px;
  }
  
  /* Discord card adjustments */
  .dc-card {
    padding: 16px;
  }
  
  .dc-avatar {
    width: 60px;
    height: 60px;
  }
  
  .dc-name {
    font-size: 18px;
  }
  
  /* Game adjustments */
  .ttt-grid {
    gap: 8px;
  }
  
  .ttt-cell {
    width: 80px;
    height: 80px;
    font-size: 32px;
  }
  
  #draw-canvas {
    width: 100%;
    height: 300px;
  }
  
  #snake-canvas {
    width: 100%;
    height: 300px;
  }
  
  .draw-tools {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .draw-tool-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  /* Gallery grid */
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }
  
  /* Leaderboard */
  .leaderboard-item {
    padding: 10px;
    font-size: 13px;
  }
  
  /* Memory game grid */
  .memory-grid {
    gap: 8px;
  }
  
  .memory-cell {
    width: 70px;
    height: 70px;
  }
  
  /* Reaction box */
  .reaction-box {
    height: 250px;
  }
  
  /* Typing test */
  .typing-text-display {
    font-size: 16px;
    padding: 15px;
  }
  
  #typing-input {
    font-size: 14px;
    padding: 10px;
  }
  
  /* Modal adjustments */
  .custom-modal-content {
    width: 95%;
    margin: 10px;
  }
  
  .custom-modal-header {
    padding: 16px 20px;
  }
  
  .custom-modal-body {
    padding: 20px;
  }
  
  .custom-modal-footer {
    padding: 12px 20px;
    flex-direction: column;
  }
  
  .custom-modal-btn {
    width: 100%;
  }
  
  /* Gallery modal */
  #gallery-modal-img {
    max-width: 95vw;
    max-height: 70vh;
  }
}

/* Small mobile phones */
@media (max-width: 480px) {
  .handle {
    font-size: 18px;
  }
  
  .nav-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .ttt-cell {
    width: 70px;
    height: 70px;
    font-size: 28px;
  }
  
  .memory-cell {
    width: 60px;
    height: 60px;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  
  .dc-card {
    padding: 12px;
  }
  
  .spotify-art {
    width: 50px;
    height: 50px;
  }
}

/* Landscape mobile */
@media (max-width: 896px) and (orientation: landscape) {
  .chat-box {
    height: 200px;
  }
  
  #draw-canvas,
  #snake-canvas {
    height: 250px;
  }
  
  .reaction-box {
    height: 200px;
  }
}

/* Fix for very small screens */
@media (max-width: 360px) {
  body {
    padding: 3px;
  }
  
  .container {
    gap: 8px;
  }
  
  .profile {
    padding: 15px;
  }
  
  .avatar {
    width: 60px;
    height: 60px;
  }
  
  .ttt-cell {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }
  
  .memory-cell {
    width: 50px;
    height: 50px;
  }
}

/* Ensure touch targets are large enough */
@media (hover: none) and (pointer: coarse) {
  button,
  .nav-btn,
  .ttt-cell,
  .memory-cell,
  .draw-tool-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Print styles */
@media print {
  .grain,
  .scanline,
  .matrix-rain,
  .nav,
  .chat-input-wrap {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
}


/* ════════════════════════════════════════════════
   CANVAS RESPONSIVE FIX
   ════════════════════════════════════════════════ */

canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Ensure images don't overflow */
img {
  max-width: 100%;
  height: auto;
}

/* Prevent horizontal scroll on all elements */
* {
  max-width: 100%;
}

/* Allow specific elements to exceed */
.container,
.main,
.sidebar,
.tab-content {
  max-width: none;
}
