/* ===== RESET ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, Arial, sans-serif; background: #0f172a; color: #e5e7eb; }
.container { max-width: 900px; margin: 0 auto; padding: 16px; }
.container.small { max-width: 420px; }
.topbar { margin-bottom: 20px; }
.topbar h1 { font-size: 24px; margin-bottom: 10px; }
.top-nav { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.top-nav a, .nav-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; padding: 10px 14px; border-radius: 10px; font-size: 14px; background: #1e293b; color: #fff; transition: 0.2s; }
.top-nav a:hover, .nav-btn:hover { background: #334155; }
.top-nav a.active, .nav-btn.active { background: #2563eb; }
.logout-btn { background: #7f1d1d; }
.logout-btn:hover { background: #991b1b; }
.nav-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #e74c3c; color: #fff; display: flex; align-items: center; justify-content: center; }
.badge, .chat-unread-badge, .unread-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #22c55e; color: #fff; }
.card { background: #1e293b; padding: 16px; border-radius: 16px; margin-bottom: 16px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25); }
.card h2 { margin-bottom: 10px; }
.auth-header { text-align: center; margin-bottom: 24px; }
.logo-wrap { display: inline-block; padding: 16px; border-radius: 20px; background: radial-gradient(circle at top, #1e293b, #0f172a); box-shadow: 0 0 20px rgba(37, 99, 235, 0.4), 0 0 40px rgba(37, 99, 235, 0.2), inset 0 0 10px rgba(255, 255, 255, 0.05); animation: logoGlow 3s infinite alternate; }
.login-logo { width: 110px; height: 110px; object-fit: contain; display: block; }
.app-title { margin-top: 14px; font-size: 22px; font-weight: bold; background: linear-gradient(90deg, #60a5fa, #22c55e); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.app-subtitle, .subtitle { font-size: 14px; color: #94a3b8; margin-top: 4px; }
.profile-header { text-align: center; }
.avatar-block { display: flex; justify-content: center; margin-bottom: 12px; }
.avatar-preview { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(255,255,255,.15); box-shadow: 0 10px 25px rgba(0,0,0,.3); }
.avatar-placeholder { width: 110px; height: 110px; border-radius: 50%; background: #334155; display: flex; align-items: center; justify-content: center; font-size: 40px; }
input, button, textarea { font-size: 16px; border-radius: 10px; border: none; }
input, textarea { width: 100%; padding: 12px; background: #0f172a; color: #fff; border: 1px solid #334155; }
input::placeholder, textarea::placeholder { color: #94a3b8; }
button { padding: 12px; background: #2563eb; color: #fff; cursor: pointer; transition: 0.2s; }
button:hover { background: #1d4ed8; }
button.secondary { background: #475569; }
button.secondary:hover { background: #64748b; }
button:disabled { opacity: .6; cursor: not-allowed; }
.auth-form input { margin-bottom: 10px; }
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat { text-align: center; }
.stat p { font-size: 28px; font-weight: bold; }
.entries { list-style: none; }
.entries li { padding: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.entry-time { font-size: 12px; color: #94a3b8; margin-left: 6px; }
.entry-day-block { margin-bottom: 18px; }
.entry-day-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.08); }
.entry-day-title { font-weight: 700; font-size: 15px; }
.entry-day-total, .friend-total-chip, .chat-open-chip, .profile-link-btn { display: inline-flex; align-items: center; justify-content: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; background: #334155; color: #e2e8f0; text-decoration: none; }
.friends-list { list-style: none; }
.friend-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.friend-item:last-child { border-bottom: none; }
.friend-avatar-wrap, .chat-avatar-wrap { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.friend-avatar, .chat-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: #1f2937; }
.friend-avatar-placeholder, .chat-avatar-placeholder { display: flex; align-items: center; justify-content: center; background: #334155; color: #fff; font-size: 18px; width: 52px; height: 52px; border-radius: 50%; }
.friend-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.friend-meta a, .friend-item a { color: #fff; text-decoration: none; font-weight: 600; }
.friend-meta a:hover, .friend-item a:hover { text-decoration: underline; }
.friend-status-text, .chat-status { font-size: 12px; color: #94a3b8; }
.status-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #1e293b; }
.status-dot.online { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.8); animation: pulse 1.5s infinite; }
.status-dot.offline { background: #64748b; }
.request-row, .friend-row-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.error { color: #f87171; }
.success { color: #4ade80; }
a { color: #60a5fa; }
canvas { width: 100%; }
.progress-bar { width: 100%; height: 14px; background: #334155; border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #60a5fa); border-radius: 999px; transition: width 0.4s ease; }
.progress-text { margin-top: 10px; font-size: 14px; color: #cbd5e1; text-align: right; }
.level-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.streak-highlight { color: #f59e0b; font-weight: 700; }
.achievements-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.achievement-card { border-radius: 14px; padding: 14px; text-align: center; background: #334155; border: 1px solid rgba(255,255,255,.08); }
.achievement-card.unlocked { background: linear-gradient(135deg, #1d4ed8, #22c55e); color: #fff; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.achievement-card.locked { opacity: 0.65; }
.achievement-icon { font-size: 28px; margin-bottom: 8px; }
.achievement-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.achievement-status { font-size: 12px; color: #e2e8f0; }
.chat-list { display: flex; flex-direction: column; gap: 12px; }
.chat-row { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: inherit; padding: 12px; border-radius: 16px; background: #334155; border: 1px solid rgba(255,255,255,.08); }
.chat-row.unread-row { border-color: rgba(37,99,235,.45); box-shadow: 0 0 0 1px rgba(37,99,235,.12); }
.chat-main { flex: 1; min-width: 0; }
.chat-topline, .chat-subline, .chat-userline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-userline { justify-content: flex-start; flex-wrap: wrap; }
.chat-username { font-size: 16px; font-weight: 700; color: #fff; min-width: 0; }
.chat-time { font-size: 12px; color: #94a3b8; white-space: nowrap; }
.chat-preview { font-size: 14px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 100%; color:#cbd5e1; }
.chat-preview.unread { font-weight: 700; color: #fff; opacity: 1; }
.chat-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; min-width: 58px; }
.chat-box { min-height: 340px; max-height: 60vh; overflow-y: auto; scroll-behavior: smooth; }
.chat-empty { color: #94a3b8; text-align: center; padding: 30px 10px; }
.chat-message { display: flex; margin: 8px 0; }
.chat-message.mine { justify-content: flex-end; }
.chat-message.theirs { justify-content: flex-start; }
.chat-bubble-wrap { display: flex; flex-direction: column; max-width: 78%; min-width: 80px; }
.chat-message.mine .chat-bubble-wrap { align-items: flex-end; }
.chat-message.theirs .chat-bubble-wrap { align-items: flex-start; }
.chat-bubble { padding: 10px 12px; border-radius: 14px; line-height: 1.4; word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap; color: #fff; }
.chat-message.mine .chat-bubble { background: #2563eb; border-bottom-right-radius: 6px; }
.chat-message.theirs .chat-bubble { background: rgba(255,255,255,.08); border-bottom-left-radius: 6px; }
.message-time { font-size: 12px; color: #94a3b8; margin-top: 4px; padding: 0 4px; }
.chat-message.mine .message-time { text-align: right; }
.chat-date-separator { display: flex; justify-content: center; margin: 14px 0 10px; }
.chat-date-separator span { display: inline-block; background: #334155; color: #cbd5e1; font-size: 12px; padding: 6px 12px; border-radius: 999px; }
.chat-form { display: flex; gap: 10px; align-items: flex-end; }
.chat-form-input-wrap { flex: 1; min-width: 0; }
.chat-form textarea { width: 100%; min-height: 50px; max-height: 140px; resize: vertical; padding: 12px; border-radius: 10px; border: 1px solid #334155; background: #0f172a; color: #fff; font: inherit; }
.chat-form-meta { margin-top: 6px; display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: #94a3b8; }
.chat-error { color: #f87171; }
.typing-note { font-size: 12px; color: #94a3b8; min-height: 18px; margin-top: 8px; }
.chat-header-card { display: flex; align-items: center; gap: 12px; }
.chat-header-main { flex: 1; min-width: 0; }
.chat-header-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.chat-user-link { color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; }
.chat-user-link:hover { text-decoration: underline; }
.vip-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(90deg, #f59e0b, #eab308); box-shadow: 0 0 12px rgba(245, 158, 11, 0.35); vertical-align: middle; }
.vip-card { border: 1px solid rgba(245, 158, 11, 0.45); box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15), 0 10px 24px rgba(0,0,0,.25); }
@keyframes logoGlow { from { box-shadow: 0 0 15px rgba(37, 99, 235, 0.3), 0 0 30px rgba(37, 99, 235, 0.15); } to { box-shadow: 0 0 30px rgba(37, 99, 235, 0.6), 0 0 60px rgba(37, 99, 235, 0.3); } }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.3); opacity: .6; } 100% { transform: scale(1); opacity: 1; } }
@media (max-width: 640px) { .request-row,.friend-item,.chat-header-card { align-items:flex-start; flex-wrap:wrap; } .request-actions,.friend-row-actions { width:100%; margin-left:54px; } .chat-form, .inline-form { flex-direction: column; align-items: stretch; } .chat-bubble-wrap { max-width: 88%; } }
