/* 口袋小精灵 Web - 全局样式（绿色主题） */
:root {
  --bg-primary: #0a1a0f;
  --bg-secondary: #0f2818;
  --bg-card: #132e1a;
  --bg-card-hover: #1a3d22;
  --accent: #51cf66;
  --accent-light: #8ce99a;
  --accent-dark: #40c057;
  --green: #51cf66;
  --blue: #38d9a9;
  --purple: #69db7c;
  --yellow: #fcc419;
  --orange: #ff922b;
  --text: #e8f5e9;
  --text-dim: #7ca683;
  --border: #1e4d2b;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(81,207,102,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(56,217,169,0.05) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(105,219,124,0.04) 0%, transparent 50%);
  animation: bgFloat 20s ease-in-out infinite;
  z-index: -1;
}
@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(-2%, 1%); }
  66% { transform: translate(1%, -2%); }
}

.topbar {
  background: rgba(10,26,15,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.topbar .logo {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff, #a5d6a7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10,26,15,0.85);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.3);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 10px;
  gap: 2px;
  transition: color 0.2s;
  padding: 4px 12px;
}
.tabbar a .icon { font-size: 20px; }
.tabbar a.active { color: var(--accent); }

.page {
  padding: 16px;
  padding-bottom: 80px;
  max-width: 480px;
  margin: 0 auto;
}

.card {
  background: rgba(19,46,26,0.7);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:active { transform: scale(0.98); }
.card h3 {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.ball-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.ball-item {
  text-align: center;
  padding: 16px 8px;
  background: rgba(15,40,24,0.6);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.ball-item .ball-icon { font-size: 36px; margin-bottom: 8px; }
.ball-item .ball-name { font-size: 12px; color: var(--text-dim); }
.ball-item .ball-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.pokemon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.pokemon-card {
  background: rgba(15,40,24,0.6);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.pokemon-card:active { transform: scale(0.95); }
.pokemon-card.shiny::after {
  content: '\2728';
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 14px;
}
.pokemon-card .pokemon-sprite {
  width: 64px;
  height: 64px;
  margin: 0 auto 8px;
  image-rendering: pixelated;
}
.pokemon-card .pokemon-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}
.pokemon-card .pokemon-level {
  font-size: 11px;
  color: var(--text-dim);
}
.pokemon-card .pokemon-type {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

.type-fire { background: #fd7d24; color: #fff; }
.type-water { background: #4592c4; color: #fff; }
.type-grass { background: #9bcc50; color: #1a1a1a; }
.type-electric { background: #eed535; color: #1a1a1a; }
.type-psychic { background: #f366b9; color: #fff; }
.type-dragon { background: #7038f8; color: #fff; }
.type-ice { background: #51c4e7; color: #1a1a1a; }
.type-poison { background: #b763cf; color: #fff; }
.type-ground { background: #d2b074; color: #1a1a1a; }
.type-flying { background: #a890f0; color: #fff; }
.type-fighting { background: #d56723; color: #fff; }
.type-rock { background: #a38c21; color: #fff; }
.type-bug { background: #729f3f; color: #fff; }
.type-ghost { background: #7b62a3; color: #fff; }
.type-steel { background: #60a1b8; color: #fff; }
.type-normal { background: #a8a878; color: #fff; }
.type-fairy { background: #fdb9e9; color: #1a1a1a; }
.type-dark { background: #705848; color: #fff; }

.rarity-legendary { border-color: var(--yellow); box-shadow: 0 0 12px rgba(252,196,25,0.3); }
.rarity-rare { border-color: var(--blue); box-shadow: 0 0 8px rgba(56,217,169,0.2); }
.rarity-uncommon { border-color: var(--green); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.stat-card {
  background: rgba(19,46,26,0.6);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
}
.btn-primary:active { transform: scale(0.95); }
.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: #e03131; color: #fff; }
.btn-warning { background: var(--orange); color: #fff; }

input, select, textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}
label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
  display: block;
}
.form-group { margin-bottom: 12px; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-secondary);
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
tr:hover td { background: rgba(81,207,102,0.03); }

.progress {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.checkin-card {
  background: linear-gradient(135deg, rgba(19,46,26,0.8), rgba(15,40,24,0.8));
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.checkin-card .streak {
  font-size: 48px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.checkin-card .streak-label {
  font-size: 13px;
  color: var(--text-dim);
}

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }
.task-info { flex: 1; }
.task-name { font-size: 14px; font-weight: 600; }
.task-desc { font-size: 12px; color: var(--text-dim); }
.task-reward { font-size: 12px; color: var(--yellow); }
.task-done { opacity: 0.5; }
.task-done .task-name { text-decoration: line-through; }

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  z-index: 999;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.2s forwards;
  pointer-events: none;
}
.toast-success { background: var(--green); color: #fff; }
.toast-error { background: #e03131; color: #fff; }
.toast-info { background: var(--blue); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(20px); } }

.loading {
  display: flex;
  justify-content: center;
  padding: 40px;
}
.loading::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.empty .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty .empty-text { font-size: 14px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalUp 0.3s ease;
}
@keyframes modalUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.admin-layout {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: 200px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  position: fixed;
  top: 0;
  bottom: 0;
  overflow-y: auto;
}
.admin-sidebar .sidebar-title {
  padding: 0 16px 16px;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.admin-sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}
.admin-sidebar a:hover { background: rgba(81,207,102,0.1); color: var(--text); }
.admin-sidebar a.active { color: var(--accent); background: rgba(81,207,102,0.1); border-right: 2px solid var(--accent); }
.admin-main {
  flex: 1;
  margin-left: 200px;
  padding: 24px;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.admin-header h1 { font-size: 22px; }

@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: auto;
    display: flex;
    overflow-x: auto;
    padding: 0;
    z-index: 100;
  }
  .admin-sidebar .sidebar-title { display: none; }
  .admin-sidebar a {
    flex-direction: column;
    font-size: 10px;
    padding: 8px 12px;
    min-width: 60px;
    text-align: center;
    border-top: 1px solid var(--border);
  }
  .admin-sidebar a.active { border-right: none; border-top-color: var(--accent); }
  .admin-main {
    margin-left: 0;
    padding-bottom: 80px;
  }
}
