* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #667eea;
  --primary-dark: #5a6fd6;
  --secondary: #764ba2;
  --accent: #ffd43b;
  --success: #51cf66;
  --warning: #ff922b;
  --danger: #ff6b6b;
  --info: #74c0fc;
  --bg: #f8f9ff;
  --card: #ffffff;
  --text: #2d3436;
  --text-light: #636e72;
  --text-muted: #b2bec3;
  --border: #e8ecf4;
  --shadow: 0 4px 20px rgba(102, 126, 234, 0.1);
  --shadow-lg: 0 20px 60px rgba(102, 126, 234, 0.15);
  --radius: 16px;
  --radius-lg: 24px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

.app-container {
  max-width: 800px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

@media (min-width: 900px) {
  .app-container {
    max-width: 1200px;
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "header header"
      "sidebar main";
    gap: 0;
  }
}

.app-header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  padding: 20px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  grid-area: header;
}

@media (min-width: 900px) {
  .app-header {
    padding: 24px 40px;
  }
}

.app-header .logo {
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header .logo span {
  font-size: 1.6rem;
}

.app-header .header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.points-badge {
  background: rgba(255,255,255,0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.points-badge span:first-child {
  font-size: 1rem;
}

.mobile-menu-btn {
  display: none;
}

@media (max-width: 899px) {
  .mobile-menu-btn {
    display: block;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    color: #fff;
    font-size: 1.2rem;
  }
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: #fff;
  padding: 80px 20px 20px;
  box-shadow: 4px 0 20px rgba(0,0,0,0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 100;
}

.sidebar.open {
  transform: translateX(0);
}

@media (min-width: 900px) {
  .sidebar {
    position: sticky;
    top: 0;
    transform: none;
    grid-area: sidebar;
    box-shadow: 2px 0 20px rgba(0,0,0,0.05);
    height: calc(100vh - 72px);
    padding: 30px 20px;
  }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
}

.sidebar-nav a:hover {
  background: var(--bg);
  color: var(--primary);
}

.sidebar-nav a.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
}

.sidebar-nav a .nav-icon {
  font-size: 1.3rem;
}

.main-content {
  grid-area: main;
  padding: 20px;
  padding-bottom: 100px;
}

@media (min-width: 900px) {
  .main-content {
    padding: 30px 40px;
    padding-bottom: 40px;
  }
}

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title .emoji {
  font-size: 1.3rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

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

.btn-secondary {
  background: var(--bg);
  color: var(--primary);
}

.btn-secondary:hover {
  background: #eef0ff;
}

.btn-success {
  background: linear-gradient(135deg, #51cf66, #37b24d);
  color: #fff;
}

.btn-warning {
  background: linear-gradient(135deg, #ffd43b, #ff922b);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
  color: #fff;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.05rem;
  border-radius: 16px;
}

.btn-block {
  width: 100%;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 10px;
  transition: width 0.5s ease;
}

.progress-fill.success {
  background: linear-gradient(90deg, #51cf66, #69db7c);
}

.progress-fill.warning {
  background: linear-gradient(90deg, #ffd43b, #ff922b);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-primary {
  background: #eef0ff;
  color: var(--primary);
}

.badge-success {
  background: #d3f9d8;
  color: #2f9e44;
}

.badge-warning {
  background: #fff3bf;
  color: #e67700;
}

.badge-danger {
  background: #ffe3e3;
  color: #c92a2a;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 400px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.85rem; }
.text-lg { font-size: 1.15rem; }
.text-xl { font-size: 1.4rem; }
.text-muted { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 0.9rem;
  z-index: 1000;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: linear-gradient(135deg, #51cf66, #37b24d);
}

.toast.error {
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: #fff;
  border-radius: 20px;
  padding: 30px;
  max-width: 400px;
  width: 100%;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal h3 {
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.modal p {
  color: var(--text-light);
  margin-bottom: 20px;
}

.input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  font-family: inherit;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
}

.floating-anim {
  animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.pulse-anim {
  animation: pulse 2s ease-in-out infinite;
}

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

.shake-anim {
  animation: shake 0.5s;
}

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

.celebrate-anim {
  animation: celebrate 0.6s ease-out;
}

@keyframes celebrate {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.reveal-anim {
  animation: reveal 0.5s ease-out;
}

@keyframes reveal {
  from { transform: rotateY(180deg); opacity: 0; }
  to { transform: rotateY(0); opacity: 1; }
}

@media print {
  .app-header, .sidebar, .mobile-menu-btn { display: none; }
  .app-container { max-width: 100%; display: block; }
  .main-content { padding: 0; }
}
