/* Family OKR — Glassmorphism Neon Dark Theme */
:root {
  --bg-deep: #060a14;
  --bg-surface: #0a0f1e;
  --bg-elevated: #0f1525;

  --neon-cyan: #00f0ff;
  --neon-magenta: #ff00aa;
  --neon-violet: #8b5cf6;
  --neon-emerald: #00e676;
  --neon-rose: #ff1744;
  --neon-amber: #ffaa00;

  --glass-bg: rgba(15, 21, 40, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(0, 240, 255, 0.25);

  --text-primary: #e8ecf1;
  --text-secondary: #8b95a8;
  --text-muted: #5a6275;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
  --shadow: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-neon-cyan: 0 0 20px rgba(0, 240, 255, 0.15);
  --shadow-neon-magenta: 0 0 20px rgba(255, 0, 170, 0.15);

  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  background: var(--bg-deep);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Aurora background layer */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(139,92,246,0.18) 0%, transparent 60%),
    radial-gradient(800px 400px at 85% 20%, rgba(0,240,255,0.12) 0%, transparent 55%),
    radial-gradient(700px 600px at 50% 90%, rgba(255,0,170,0.10) 0%, transparent 50%);
  animation: aurora-drift 20s ease-in-out infinite alternate;
}

/* Starfield layer */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, rgba(255,255,255,0.25), transparent),
    radial-gradient(1px 1px at 50px 100px, rgba(255,255,255,0.15), transparent),
    radial-gradient(1.5px 1.5px at 130px 80px, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 200px 40px, rgba(255,255,255,0.18), transparent),
    radial-gradient(1.5px 1.5px at 300px 150px, rgba(255,255,255,0.12), transparent),
    radial-gradient(1px 1px at 80px 200px, rgba(255,255,255,0.22), transparent),
    radial-gradient(1.5px 1.5px at 250px 220px, rgba(255,255,255,0.15), transparent);
  background-size: 350px 280px;
  opacity: 0.6;
}

@keyframes aurora-drift {
  0% { transform: translate(0,0) scale(1); }
  100% { transform: translate(40px,-20px) scale(1.05); }
}

/* Header */
.app-header {
  text-align: center;
  padding: 32px 16px 12px;
  position: relative;
}
.app-header.with-user { padding-top: 32px; }

.logo {
  font-family: inherit;
  font-size: 22px;
  margin: 4px 0 0;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 0 20px rgba(0,240,255,0.35), 0 0 40px rgba(139,92,246,0.2);
  white-space: nowrap;
  position: relative;
  z-index: 2;
}

.subtitle {
  margin: 6px 0 18px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
}

/* User chip & score chip */
.user-chip {
  position: absolute; top: 20px; left: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  height: 36px; font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.user-chip:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow-neon-cyan);
}
.user-chip .avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; font-size: 20px; line-height: 1;
}
.user-chip strong { line-height: 1; color: var(--text-primary); }

.corner-chip {
  position: absolute; top: 20px; right: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  height: 36px; font-size: 13px;
}
.corner-chip .label { color: var(--text-secondary); font-size: inherit; font-weight: 700; line-height: 1; }
.corner-chip .value { color: var(--neon-cyan); font-size: inherit; font-weight: 900; line-height: 1; text-shadow: 0 0 8px rgba(0,240,255,0.4); }

.user-chip, .corner-chip { min-height: 32px; }

/* Container */
.container { padding: 0 16px 100px; max-width: 900px; margin: 0 auto; }

/* Glass Card */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin: 14px 0;
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow), var(--shadow-neon-cyan);
}

.soft-info .soft-list { margin: 0; padding-left: 18px; }
.soft-list li { line-height: 1.8; color: var(--text-secondary); }
.muted { color: var(--text-muted); }

/* Navigation grid cards */
.nav-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.nav-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 18px 12px;
  text-decoration: none;
  color: var(--text-primary);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
}
.nav-card:hover, .nav-card:active {
  transform: translateY(-4px);
  border-color: var(--neon-cyan);
  box-shadow: var(--shadow), 0 0 24px rgba(0,240,255,0.2);
}
.nav-emoji { font-size: 32px; filter: drop-shadow(0 0 6px rgba(255,255,255,0.2)); }
.nav-title { font-weight: 900; margin-top: 8px; font-size: 15px; }
.nav-tip { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.admin-only { display: none; }

/* Score bar HUD */
.score-bar { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 14px 0; }
.score-block {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; min-height: 80px;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.score-block:hover {
  border-color: rgba(0,240,255,0.2);
}
.score-block .label { color: var(--text-secondary); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.score-block .value { font-weight: 900; font-size: 28px; line-height: 1; color: #fff; text-shadow: 0 0 12px rgba(0,240,255,0.35); }
.score-block.alt .value { text-shadow: 0 0 12px rgba(0,230,118,0.35); color: var(--neon-emerald); }

/* Avatar grid (login picker) */
.avatar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.avatar-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.avatar-btn:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--neon-magenta);
  box-shadow: var(--shadow), 0 0 20px rgba(255,0,170,0.2);
}
.avatar-btn:active { transform: scale(0.97); }
.avatar-circle { font-size: 38px; filter: drop-shadow(0 0 6px rgba(255,255,255,0.25)); }
.avatar-name { font-weight: 800; font-size: 14px; color: var(--text-primary); }

/* Lists */
.list { display: grid; gap: 12px; }
.list.grid { grid-template-columns: repeat(2, 1fr); }
.item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  position: relative;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.item:hover {
  border-color: rgba(0,240,255,0.15);
  box-shadow: var(--shadow), 0 0 16px rgba(0,240,255,0.08);
}
.item .title { font-weight: 900; color: #fff; }
.item .desc { color: var(--text-secondary); font-size: 13px; }

/* Badges */
.badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 11px;
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  background: rgba(0,240,255,0.08);
  letter-spacing: 0.3px;
}
.badge.time { border-color: var(--neon-amber); color: var(--neon-amber); background: rgba(255,170,0,0.08); }

.countdown { font-size: 13px; font-weight: 900; color: var(--neon-rose); text-shadow: 0 0 8px rgba(255,23,68,0.35); }
.item.has-countdown { padding-bottom: 48px; }
.item .countdown { position: absolute; bottom: 12px; right: 14px; }
.countdown-inline { font-size: 13px; font-weight: 900; color: var(--neon-rose); text-shadow: 0 0 8px rgba(255,23,68,0.35); }
.item .actions .countdown-inline { margin-left: auto; }
.item.has-corner-btn { padding-bottom: 48px; }
.item .corner-btn { position: absolute; bottom: 10px; right: 12px; }

/* Actions row */
.actions { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.actions .btn:first-of-type { margin-left: auto; }

#member-list .actions { justify-content: flex-end; }
#member-list .actions .btn { margin-left: 0; }
#member-list .btn.small { padding: 6px 10px; font-size: 13px; min-height: 40px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  padding: 0 4px;
  position: relative;
}
.tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-weight: 900;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.tab:hover { color: var(--text-primary); border-color: rgba(0,240,255,0.2); }
.tab.active {
  background: linear-gradient(135deg, rgba(0,240,255,0.15), rgba(139,92,246,0.15));
  border-color: var(--neon-cyan);
  color: #fff;
  box-shadow: 0 0 16px rgba(0,240,255,0.15);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 900;
  font-size: 14px;
  min-height: 44px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.btn:active { transform: scale(0.96); }

.btn.primary {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-violet));
  color: #060a14;
  box-shadow: 0 0 16px rgba(0,240,255,0.25);
}
.btn.primary:hover {
  box-shadow: 0 0 24px rgba(0,240,255,0.4);
}
.btn.outline {
  background: transparent;
  border: 1.5px solid var(--neon-magenta);
  color: var(--neon-magenta);
  box-shadow: inset 0 0 10px rgba(255,0,170,0.08);
}
.btn.outline:hover {
  background: rgba(255,0,170,0.08);
  box-shadow: inset 0 0 14px rgba(255,0,170,0.15), 0 0 12px rgba(255,0,170,0.15);
}
.btn.small { padding: 6px 12px; font-size: 13px; min-height: 40px; }
.btn.disabled, .btn:disabled {
  background: #1a2030 !important;
  color: #4a5060 !important;
  border-color: #2a3040 !important;
  box-shadow: none !important;
  cursor: not-allowed;
}

/* Ripple container */
.btn, .nav-card, .avatar-btn, .icon-btn {
  position: relative;
  overflow: hidden;
}
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transform: scale(0);
  animation: ripple-effect 0.6s linear;
  pointer-events: none;
}
@keyframes ripple-effect {
  to { transform: scale(4); opacity: 0; }
}

/* Forms */
.form-grid { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 700; color: var(--text-secondary); font-size: 13px; }
input[type="text"], input[type="number"], input[type="month"], input[type="password"], input[type="email"] {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(6,10,20,0.6);
  color: var(--text-primary);
  min-height: 44px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus { border-color: var(--neon-cyan); box-shadow: 0 0 0 3px rgba(0,240,255,0.1); }
input::placeholder { color: var(--text-muted); }

input[type="checkbox"], input[type="radio"] {
  accent-color: var(--neon-cyan);
  width: 18px; height: 18px;
}

select {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(6,10,20,0.6);
  color: var(--text-primary);
  min-height: 44px;
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16' fill='none' stroke='%238b95a8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
select:focus { border-color: var(--neon-cyan); box-shadow: 0 0 0 3px rgba(0,240,255,0.1); }
option { background: var(--bg-surface); color: var(--text-primary); }

label.checkbox { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text-primary); }

/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(10,15,30,0.75);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(160%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  padding: 8px 0 16px;
  z-index: 10;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
}
.bottom-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 900;
  font-size: 13px;
  padding: 10px 0;
  border-radius: 14px;
  margin: 0 8px;
  transition: all 0.2s ease;
  position: relative;
}
.bottom-nav a.active {
  color: var(--neon-cyan);
  background: rgba(0,240,255,0.08);
}
.bottom-nav a.active::before {
  content: "";
  position: absolute;
  top: -8px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px;
  border-radius: 2px;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
}

.footer-note { text-align: center; color: var(--text-muted); padding: 20px 0 100px; font-size: 12px; }

/* Card title row & icon buttons */
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title-row .title-actions { display: inline-flex; align-items: center; gap: 8px; }
.icon-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  min-height: 40px;
}
.icon-btn:hover {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0,240,255,0.15);
}
.icon-btn:active { transform: scale(0.95); }

/* Ribbons */
.ribbon {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 11px;
  color: #060a14;
  box-shadow: var(--shadow-sm);
  letter-spacing: 0.3px;
}
.ribbon.daily { background: var(--neon-magenta); box-shadow: 0 0 10px rgba(255,0,170,0.3); }
.ribbon.scheduled { background: var(--neon-amber); box-shadow: 0 0 10px rgba(255,170,0,0.3); }
.ribbon.normal { background: var(--neon-cyan); box-shadow: 0 0 10px rgba(0,240,255,0.3); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(6,10,20,0.7);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  opacity: 0;
  animation: modal-fade-in 0.25s ease forwards;
}
@keyframes modal-fade-in { to { opacity: 1; } }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow), 0 0 40px rgba(0,240,255,0.08);
  width: min(440px, 92%);
  max-height: 78vh;
  overflow: auto;
  transform: translateY(20px) scale(0.96);
  animation: modal-slide-up 0.3s ease forwards;
}
@keyframes modal-slide-up {
  to { transform: translateY(0) scale(1); }
}

.modal header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--glass-border);
}
.modal header h3 { margin: 0; font-size: 18px; color: #fff; }
.modal .content { padding: 16px 18px; }
.modal .close {
  background: transparent; border: none;
  font-size: 20px; cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s;
}
.modal .close:hover { color: var(--neon-rose); }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; padding: 0 18px 16px; }
.modal .actions .btn { margin-left: 0; }

/* Button stack */
.btn-stack { display: flex; flex-direction: column; gap: 10px; }

/* Toast */
.toast {
  position: fixed; top: 24px; left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: linear-gradient(135deg, rgba(0,240,255,0.15), rgba(139,92,246,0.15));
  border: 1px solid var(--glass-border-hover);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow), 0 0 20px rgba(0,240,255,0.15);
  z-index: 1000;
  font-weight: 900;
  font-size: 14px;
  backdrop-filter: blur(12px);
  opacity: 0;
  animation: toast-slide-in 0.3s ease forwards, toast-fade-out 0.4s ease 2.1s forwards;
}
@keyframes toast-slide-in { to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toast-fade-out { to { opacity: 0; transform: translateX(-50%) translateY(-10px); } }

/* Utility */
.hidden { display: none !important; }

/* Stagger entrance for lists */
.stagger-in .item {
  opacity: 0;
  transform: translateY(12px);
  animation: stagger-pop 0.4s ease forwards;
}
.stagger-in .item:nth-child(1) { animation-delay: 0.00s; }
.stagger-in .item:nth-child(2) { animation-delay: 0.05s; }
.stagger-in .item:nth-child(3) { animation-delay: 0.10s; }
.stagger-in .item:nth-child(4) { animation-delay: 0.15s; }
.stagger-in .item:nth-child(5) { animation-delay: 0.20s; }
.stagger-in .item:nth-child(6) { animation-delay: 0.25s; }
.stagger-in .item:nth-child(7) { animation-delay: 0.30s; }
.stagger-in .item:nth-child(8) { animation-delay: 0.35s; }
@keyframes stagger-pop {
  to { opacity: 1; transform: translateY(0); }
}

/* Floating score */
.floating-score {
  position: fixed;
  z-index: 9999;
  font-weight: 900;
  font-size: 20px;
  color: var(--neon-emerald);
  text-shadow: 0 0 12px rgba(0,230,118,0.5);
  pointer-events: none;
  animation: float-up 1s ease forwards;
}
@keyframes float-up {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(1.3); }
}

/* Confetti */
.confetti-piece {
  position: fixed;
  z-index: 9998;
  width: 8px; height: 8px;
  pointer-events: none;
  animation: confetti-fall 1.2s ease-out forwards;
}
@keyframes confetti-fall {
  0% { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(120px) rotate(720deg); }
}

/* Glow pulse for urgent countdowns */
.glow-pulse {
  animation: glow-pulse-anim 1.2s ease-in-out infinite;
}
@keyframes glow-pulse-anim {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,23,68,0); border-color: var(--glass-border); }
  50% { box-shadow: 0 0 16px 2px rgba(255,23,68,0.15); border-color: rgba(255,23,68,0.4); }
}

/* Responsive */
@media (min-width: 700px) {
  .nav-grid { grid-template-columns: repeat(3, 1fr); }
  .avatar-grid { grid-template-columns: repeat(5, 1fr); }
  .list.grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

.cards-grid { grid-template-columns: 1fr; }
@media (min-width: 480px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 700px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .cards-grid { grid-template-columns: repeat(4, 1fr); } }

#my-todos.list.grid { grid-template-columns: repeat(2, 1fr); }
#my-task-list.list.grid { grid-template-columns: repeat(2, 1fr); }
#member-list.list.grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) {
  #member-list.list.grid { grid-template-columns: repeat(3, 1fr); }
}
#reward-list.list.grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) {
  #reward-list.list.grid { grid-template-columns: repeat(3, 1fr); }
}

/* Touch target sizes */
.nav-card, .tab, .bottom-nav a { min-height: 44px; }
