:root {
  --navy: #0A1628;
  --navy2: #0F1E38;
  --navy3: #162540;
  --cyan: #00D4FF;
  --cyan2: #00B8E0;
  --cyan-glow: rgba(0, 212, 255, 0.15);
  --coral: #FF6B6B;
  --coral2: #E55555;
  --teal: #00E5C3;
  --teal2: #00C4A7;
  --blue: #1A6FD4;
  --blue2: #1558A8;
  --card: #0D1E35;
  --card2: #112236;
  --card3: #142840;
  --text: #E8F4FD;
  --text2: #A8C8E8;
  --text3: #6B9AB8;
  --border: rgba(0, 212, 255, 0.15);
  --border2: rgba(0, 212, 255, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Nunito', sans-serif; background: var(--navy); color: var(--text); min-height: 100vh; overflow-x: hidden; }

nav { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: rgba(10, 22, 40, 0.95); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; backdrop-filter: blur(10px); }
.nav-logo { font-family: 'Fredoka One', cursive; font-size: 22px; color: var(--cyan); display: flex; align-items: center; gap: 8px; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.notif-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--card2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; font-size: 16px; transition: background 0.2s; }
.notif-btn:hover { background: var(--card3); }
.notif-badge { position: absolute; top: -2px; right: -2px; width: 16px; height: 16px; background: var(--coral); border-radius: 50%; font-size: 9px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid var(--navy); color: white; }
.user-chip { display: flex; align-items: center; gap: 8px; background: var(--card2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px 4px 4px; cursor: pointer; transition: background 0.2s; }
.user-chip:hover { background: var(--card3); }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.user-chip-name { font-size: 13px; font-weight: 700; }

.app { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 62px); gap: 0; }
.left-panel { padding: 32px 28px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 24px; }
.hero-title { font-family: 'Fredoka One', cursive; font-size: 42px; line-height: 1.1; background: linear-gradient(135deg, var(--text) 40%, var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-cyan { -webkit-text-fill-color: var(--cyan); color: var(--cyan); }
.hero-sub { font-size: 15px; color: var(--text2); line-height: 1.6; margin-top: 8px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-primary { background: linear-gradient(135deg, var(--cyan), var(--blue)); color: var(--navy); font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 14px; padding: 12px 24px; border: none; border-radius: 12px; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(0, 212, 255, 0.45); }
.btn-secondary { background: transparent; color: var(--coral); font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 14px; padding: 12px 24px; border: 2px solid var(--coral); border-radius: 12px; cursor: pointer; transition: all 0.15s; }
.btn-secondary:hover { background: rgba(255, 107, 107, 0.1); transform: translateY(-2px); }

.stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card { background: var(--card2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; text-align: center; transition: border-color 0.2s; }
.stat-card:hover { border-color: var(--border2); }
.stat-num { font-family: 'Fredoka One', cursive; font-size: 28px; color: var(--cyan); }
.stat-label { font-size: 11px; color: var(--text3); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.next-up { background: var(--card2); border: 1px solid var(--border2); border-radius: 16px; padding: 18px; position: relative; overflow: hidden; }
.next-up::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--cyan), var(--teal)); }
.next-up-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--cyan); margin-bottom: 10px; }
.next-up-game { font-family: 'Fredoka One', cursive; font-size: 20px; color: var(--text); }
.next-up-meta { display: flex; align-items: center; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.meta-item { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text2); }
.rsvp-faces { display: flex; margin-top: 10px; }
.rsvp-face { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--teal), var(--blue2)); border: 2px solid var(--navy2); margin-left: -6px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; color: var(--navy); }
.rsvp-face:first-child { margin-left: 0; }
.rsvp-count { width: 26px; height: 26px; border-radius: 50%; background: var(--card3); border: 2px solid var(--border); margin-left: -6px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; color: var(--text2); }
.no-next-up { text-align: center; padding: 20px; color: var(--text3); font-size: 14px; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text3); }
.add-btn { background: var(--card2); border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700; color: var(--cyan); cursor: pointer; transition: background 0.2s; }
.add-btn:hover { background: var(--card3); }
.game-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.game-chip { background: var(--card3); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--text2); cursor: default; }
.empty-chip-text { color: var(--text3); font-size: 13px; }

.right-panel { padding: 24px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
.calendar-card { background: var(--card2); border: 1px solid var(--border); border-radius: 18px; padding: 18px; }
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-month { font-family: 'Fredoka One', cursive; font-size: 18px; color: var(--text); }
.cal-nav { display: flex; gap: 6px; }
.cal-nav-btn { width: 28px; height: 28px; border-radius: 8px; background: var(--card3); border: 1px solid var(--border); color: var(--text2); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.cal-nav-btn:hover { background: var(--navy3); color: var(--cyan); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 10px; font-weight: 800; color: var(--text3); padding: 4px 0; text-transform: uppercase; letter-spacing: 0.5px; }
.cal-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; position: relative; transition: all 0.15s; color: var(--text2); }
.cal-day:hover:not(.empty) { background: var(--card3); }
.cal-day.today { background: rgba(0, 212, 255, 0.12); color: var(--cyan); font-weight: 800; }
.cal-day.has-event::after { content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--coral); }
.cal-day.has-event { color: var(--text); }
.cal-day.empty { cursor: default; }
.cal-day.selected { background: var(--cyan); color: var(--navy); font-weight: 800; }

.invites-card, .food-card, .leaderboard { background: var(--card2); border: 1px solid var(--border); border-radius: 18px; padding: 18px; }
.invite-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.invite-item:last-child { border-bottom: none; }
.invite-info { flex: 1; min-width: 0; }
.invite-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invite-game { font-size: 12px; color: var(--text3); }
.status-pill { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 800; white-space: nowrap; cursor: pointer; }
.status-accepted { background: rgba(0, 229, 195, 0.15); color: var(--teal); border: 1px solid rgba(0, 229, 195, 0.3); }
.status-pending { background: rgba(255, 200, 0, 0.12); color: #FFD700; border: 1px solid rgba(255, 200, 0, 0.25); }
.status-declined { background: rgba(255, 107, 107, 0.12); color: var(--coral); border: 1px solid rgba(255, 107, 107, 0.25); }

.food-list { display: flex; flex-direction: column; gap: 8px; }
.food-item { display: flex; align-items: center; gap: 10px; background: var(--card3); border-radius: 10px; padding: 10px 12px; }
.food-item-dashed { border: 1px dashed var(--border2); }
.food-cat { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text3); width: 64px; flex-shrink: 0; }
.food-item-name { font-size: 13px; font-weight: 600; flex: 1; }
.food-available { color: var(--text3); font-style: italic; }
.food-person { font-size: 12px; color: var(--cyan); font-weight: 700; }
.food-claim-btn { font-size: 12px; color: var(--teal); font-weight: 700; cursor: pointer; background: rgba(0, 229, 195, 0.1); border: 1px solid rgba(0, 229, 195, 0.25); border-radius: 8px; padding: 3px 8px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); z-index: 200; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal { background: var(--card); border: 1px solid var(--border2); border-radius: 22px; padding: 28px; width: 520px; max-width: 95vw; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-title { font-family: 'Fredoka One', cursive; font-size: 22px; color: var(--cyan); margin-bottom: 20px; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; background: var(--card2); border: 1px solid var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; color: var(--text2); }
.modal-close:hover { background: var(--card3); }

.avatar-preview-large { width: 100px; height: 100px; border-radius: 50%; margin: 0 auto 20px; position: relative; display: flex; align-items: center; justify-content: center; border: 3px solid var(--cyan); box-shadow: 0 0 24px rgba(0, 212, 255, 0.3); overflow: hidden; }
.avatar-modal-email { text-align: center; margin-bottom: 12px; font-size: 13px; color: var(--text3); }
.avatar-email-highlight { color: var(--cyan); }
.avatar-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.avatar-option { background: var(--card2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.av-opt-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text3); margin-bottom: 8px; }
.av-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.av-choice { padding: 5px 10px; border-radius: 8px; background: var(--card3); border: 1px solid var(--border); font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s; color: var(--text2); }
.av-choice:hover { border-color: var(--cyan); color: var(--cyan); }
.av-choice.sel { background: rgba(0, 212, 255, 0.12); border-color: var(--cyan); color: var(--cyan); }
.color-swatch { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: border-color 0.15s; }
.color-swatch.sel { border-color: var(--cyan); }
.avatar-modal-actions { margin-top: 16px; }

.form-group { margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text3); margin-bottom: 6px; display: block; }
.form-input { width: 100%; background: var(--card2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; color: var(--text); font-family: 'Nunito', sans-serif; font-size: 14px; font-weight: 600; outline: none; transition: border-color 0.2s; }
.form-input:focus { border-color: var(--cyan); }
.form-input::placeholder { color: var(--text3); }
select.form-input { cursor: pointer; }
select.form-input option { background: var(--card); }

.game-select-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; max-height: 140px; overflow-y: auto; margin-top: 6px; }
.game-sel-item { background: var(--card2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; color: var(--text2); }
.game-sel-item:hover { border-color: var(--border2); }
.game-sel-item.active { background: rgba(0, 212, 255, 0.1); border-color: var(--cyan); color: var(--cyan); }

.host-new-game-row { margin-top: 8px; display: flex; gap: 8px; }
.host-new-game-row .form-input { flex: 1; }
.host-add-btn { flex: 0; white-space: nowrap; padding: 8px 14px; }
.host-date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.notes-area { width: 100%; background: var(--card2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; color: var(--text); font-family: 'Nunito', sans-serif; font-size: 14px; font-weight: 600; outline: none; resize: vertical; min-height: 70px; }
.notes-area:focus { border-color: var(--cyan); }
.notes-area::placeholder { color: var(--text3); }

.food-toggle-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.toggle { position: relative; width: 42px; height: 22px; cursor: pointer; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track { position: absolute; inset: 0; background: var(--card3); border-radius: 11px; border: 1px solid var(--border); transition: background 0.2s; }
.toggle input:checked + .toggle-track { background: var(--teal); }
.toggle-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: white; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.toggle input:checked ~ .toggle-thumb { transform: translateX(20px); }
.food-label { font-size: 14px; font-weight: 700; color: var(--text2); }
.food-categories-setup { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.food-cat-input { display: flex; align-items: center; gap: 8px; }
.food-cat-label-input { flex: 1; background: var(--card2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; color: var(--text); font-size: 13px; font-weight: 600; outline: none; font-family: 'Nunito', sans-serif; }
.food-cat-label-input:focus { border-color: var(--cyan); }
.food-cat-check { font-size: 14px; color: var(--teal); width: 16px; text-align: center; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn-cancel { flex: 1; background: transparent; border: 1px solid var(--border); border-radius: 10px; padding: 11px; font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 14px; color: var(--text2); cursor: pointer; }
.btn-confirm { flex: 2; background: linear-gradient(135deg, var(--cyan), var(--blue)); border: none; border-radius: 10px; padding: 11px; font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 14px; color: var(--navy); cursor: pointer; }
.btn-confirm:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { flex: 1; background: transparent; border: 1px solid var(--coral); border-radius: 10px; padding: 11px; font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 14px; color: var(--coral); cursor: pointer; }

.player-chip-sel { display: flex; align-items: center; gap: 6px; background: var(--card2); border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: default; color: var(--text2); }
.player-chip-sel.selected { background: rgba(0, 212, 255, 0.1); border-color: var(--cyan); color: var(--cyan); }
.player-chip-declined { color: var(--coral); border-color: var(--coral); }

.lb-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.lb-row:last-child { border-bottom: none; }
.lb-rank { font-family: 'Fredoka One', cursive; font-size: 16px; width: 22px; text-align: center; }
.lb-rank.gold { color: #FFD700; }
.lb-rank.silver { color: #B0C4DE; }
.lb-rank.bronze { color: #CD7F32; }
.lb-name { flex: 1; font-size: 13px; font-weight: 700; }
.lb-stat { font-size: 12px; color: var(--text3); }
.lb-bar { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--cyan), var(--teal)); margin-top: 3px; }

.rsvp-event { background: var(--card3); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.rsvp-event-game { font-family: 'Fredoka One', cursive; font-size: 18px; margin-bottom: 4px; }
.rsvp-event-meta { font-size: 13px; color: var(--text2); }
.rsvp-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.rsvp-btn-accept { background: linear-gradient(135deg, var(--teal), #00A88A); color: var(--navy); border: none; border-radius: 10px; padding: 12px; font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 14px; cursor: pointer; }
.rsvp-btn-decline { background: transparent; color: var(--coral); border: 2px solid var(--coral); border-radius: 10px; padding: 12px; font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 14px; cursor: pointer; }

.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-item { display: flex; gap: 12px; align-items: flex-start; background: var(--card3); border-radius: 10px; padding: 12px; cursor: pointer; transition: background 0.2s; }
.notif-item:hover { background: var(--navy3); }
.notif-item.unread { border-left: 3px solid var(--cyan); }
.notif-icon-large { font-size: 22px; }
.notif-text { font-size: 14px; font-weight: 700; }
.notif-time { font-size: 12px; color: var(--text3); margin-top: 3px; }

.share-description { font-size: 14px; color: var(--text2); margin-bottom: 16px; line-height: 1.6; }
.share-box { background: var(--card3); border: 1px solid var(--border2); border-radius: 12px; padding: 14px; margin-top: 8px; }
.share-url { font-size: 12px; color: var(--cyan); word-break: break-all; font-weight: 600; margin-bottom: 8px; }
.share-copy-btn { background: rgba(0, 212, 255, 0.1); border: 1px solid var(--border2); border-radius: 8px; padding: 6px 14px; font-size: 12px; font-weight: 700; color: var(--cyan); cursor: pointer; }
.share-note { font-size: 12px; color: var(--text3); margin-top: 12px; line-height: 1.5; }

.event-detail { background: var(--card3); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.event-detail-title { font-family: 'Fredoka One', cursive; font-size: 20px; margin-bottom: 6px; }
.event-host-text { font-size: 13px; color: var(--text3); margin-top: 4px; }
.event-deadline { font-size: 12px; color: var(--coral); margin-top: 4px; }
.event-notes { font-size: 13px; color: var(--text2); line-height: 1.6; margin-top: 8px; padding: 10px; background: var(--card2); border-radius: 8px; border-left: 3px solid var(--cyan); }
.event-attendees-section { margin: 12px 0; }
.event-attendees-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.event-food-section { margin-top: 12px; }
.event-food-section .section-title { margin-bottom: 8px; }
.event-post-section { margin-top: 14px; }
.event-post-section .section-title { margin-bottom: 8px; }
.event-save-note-btn { margin-top: 8px; width: 100%; padding: 10px; }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--card2); border: 1px solid var(--cyan); border-radius: 12px; padding: 12px 18px; font-size: 14px; font-weight: 700; color: var(--cyan); z-index: 999; transform: translateY(80px); opacity: 0; transition: all 0.3s; max-width: 300px; }
.toast.show { transform: translateY(0); opacity: 1; }

.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--text3); font-size: 14px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--cyan); border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease forwards; }
.empty-state { text-align: center; padding: 24px; color: var(--text3); font-size: 14px; line-height: 1.6; }
.empty-icon { font-size: 32px; margin-bottom: 8px; }

input[type=date], input[type=time] { color-scheme: dark; }

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .right-panel { border-top: 1px solid var(--border); }
  .hero-title { font-size: 30px; }
  .left-panel { border-right: none; }
}