:root {
  --bg: #0a0f0d;
  --bg-card: #121a16;
  --bg-elevated: #1a2620;
  --border: rgba(74, 222, 128, 0.15);
  --green: #4ade80;
  --green-dark: #22c55e;
  --green-glow: rgba(74, 222, 128, 0.35);
  --text: #ecfdf5;
  --text-muted: #94a3b8;
  --gold: #fbbf24;
  --blue: #60a5fa;
  --pink: #f472b6;
  --purple: #c084fc;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(74, 222, 128, 0.12), transparent 35%),
    radial-gradient(circle at 80% 20%, rgba(96, 165, 250, 0.08), transparent 30%),
    radial-gradient(circle at 50% 80%, rgba(251, 191, 36, 0.06), transparent 40%);
  pointer-events: none;
  z-index: -1;
}

img {
  max-width: 100%;
  display: block;
}

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

.container {
  width: min(1180px, 92%);
  margin: 0 auto;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  background: rgba(10, 15, 13, 0.82);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.15rem;
}

.brand img {
  width: 42px;
  height: 42px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 600;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--green);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #052e16;
  box-shadow: 0 8px 24px var(--green-glow);
}

.btn-primary:hover {
  box-shadow: 0 12px 32px var(--green-glow);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--green);
  color: var(--green);
}

.btn-gold {
  background: linear-gradient(135deg, #fde68a, var(--gold));
  color: #451a03;
}

.user-chip {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.user-chip.active {
  display: flex;
}

.user-chip img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

/* Hero */
.hero {
  padding: 48px 0 32px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid var(--border);
  color: var(--green);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--green), #86efac);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-card {
  background: linear-gradient(180deg, rgba(26, 38, 32, 0.95), rgba(18, 26, 22, 0.95));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  max-width: 320px;
  justify-self: end;
}

.hero-card img {
  width: auto;
  max-width: 120px;
  max-height: 120px;
  margin: 0 auto 14px;
  object-fit: contain;
  border-radius: 12px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}

.stat strong {
  display: block;
  font-size: 1.3rem;
  color: var(--green);
}

.stat span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Sections */
section {
  padding: 36px 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.section-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.section-head p {
  color: var(--text-muted);
  max-width: 520px;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(74, 222, 128, 0.35);
}

.feature-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
}

.card h3 {
  margin-bottom: 8px;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* News */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.news-card {
  overflow: hidden;
  padding: 0;
}

.news-thumb {
  height: 160px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}

.news-thumb img {
  width: 72px;
  height: 72px;
}

.news-body {
  padding: 18px;
}

.news-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blue);
  background: rgba(96, 165, 250, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.news-body h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.news-body p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.news-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Daily Reward */
.daily-panel {
  background: linear-gradient(135deg, rgba(26, 38, 32, 0.95), rgba(18, 26, 22, 0.98));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.daily-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.daily-header h2 {
  display: flex;
  align-items: center;
  gap: 12px;
}

.daily-header img {
  width: 40px;
  height: 40px;
  max-width: 40px;
  max-height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.streak-badge {
  background: rgba(251, 191, 36, 0.15);
  color: var(--gold);
  border: 1px solid rgba(251, 191, 36, 0.3);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.reward-day {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  position: relative;
}

.reward-day.claimed {
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(74, 222, 128, 0.08);
}

.reward-day.today {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.reward-day img {
  width: 44px;
  height: 44px;
  max-width: 44px;
  max-height: 44px;
  margin: 0 auto 8px;
  object-fit: contain;
}

.reward-day span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.reward-day strong {
  font-size: 0.85rem;
}

.reward-day .check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  background: var(--green);
  color: #052e16;
  border-radius: 50%;
  font-size: 0.7rem;
  display: none;
  align-items: center;
  justify-content: center;
}

.reward-day.claimed .check {
  display: flex;
}

.daily-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.wallet {
  display: flex;
  gap: 16px;
}

.wallet-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
}

.wallet-item img {
  width: 28px;
  height: 28px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  width: min(440px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal h3 {
  margin-bottom: 6px;
}

.modal > p {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 0.92rem;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 700;
}

.tab.active {
  background: rgba(74, 222, 128, 0.12);
  color: var(--green);
  border-color: rgba(74, 222, 128, 0.35);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.form-group input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}

.form-panel {
  display: none;
}

.form-panel.active {
  display: block;
}

.modal .btn-primary {
  width: 100%;
  margin-top: 8px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 14px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  transform: translateY(120%);
  transition: transform 0.3s;
  z-index: 300;
}

.toast.show {
  transform: translateY(0);
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* Admin */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
}

.sidebar .brand {
  margin-bottom: 28px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-nav button,
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}

.sidebar-nav button img,
.sidebar-nav a img {
  width: 22px;
  height: 22px;
}

.sidebar-nav button.active,
.sidebar-nav button:hover,
.sidebar-nav a.active,
.sidebar-nav a:hover {
  background: rgba(74, 222, 128, 0.1);
  color: var(--green);
}

.admin-main {
  padding: 28px;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.85rem;
}

tr:last-child td {
  border-bottom: none;
}

.admin-form {
  display: grid;
  gap: 14px;
  max-width: 640px;
}

.admin-form textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

.upload-box {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  transition: border-color 0.2s;
}

.upload-box:hover {
  border-color: var(--green);
}

.upload-box img,
.upload-preview {
  width: 80px;
  height: 80px;
  margin: 0 auto 10px;
  object-fit: contain;
  display: block;
}

.upload-preview-lg {
  width: 140px;
  height: 140px;
}

.file-upload-block {
  text-align: center;
}

.file-btn {
  position: relative;
  display: inline-block;
  cursor: pointer;
  margin-top: 8px;
}

.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-chosen {
  display: block;
  margin-top: 10px;
  color: var(--green);
  font-size: 0.85rem;
  word-break: break-all;
}

.file-input-visible {
  display: block;
  margin: 10px auto 0;
  max-width: 280px;
  color: var(--text);
  font-size: 0.85rem;
}

.upload-box p {
  margin-top: 8px;
}

.action-row {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

@media (max-width: 960px) {
  .hero-grid,
  .grid-3,
  .news-grid {
    grid-template-columns: 1fr;
  }

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

  .nav-links {
    display: none;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

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

  .stats-row {
    grid-template-columns: 1fr;
  }
}

/* Wiki seed grid - 4 cot */
#wiki-seeds .wiki-grid,
.wiki-grid {
  display: grid;
  gap: 12px;
  width: 100%;
}

#wiki-seeds .wiki-grid-4,
.wiki-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.wiki-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14px 10px;
  min-width: 0;
  overflow: hidden;
}

.wiki-card:hover {
  transform: translateY(-2px);
  border-color: rgba(74, 222, 128, 0.35);
}

.wiki-thumb {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 8px;
}

#wiki-seeds .wiki-card img,
.wiki-card .wiki-thumb img {
  width: 52px !important;
  height: 52px !important;
  max-width: 52px !important;
  max-height: 52px !important;
  object-fit: contain;
}

.wiki-body {
  width: 100%;
  min-width: 0;
}

.wiki-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-bottom: 6px;
}

.wiki-card h3 {
  font-size: 0.88rem;
  margin-bottom: 4px;
  line-height: 1.25;
  word-break: break-word;
}

.wiki-desc {
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.1em;
}

.wiki-card .btn-sm {
  padding: 4px 10px;
  font-size: 0.72rem;
}

.wiki-type {
  display: inline-block;
  font-size: 0.62rem;
  text-transform: uppercase;
  color: var(--blue);
  background: rgba(96, 165, 250, 0.12);
  padding: 2px 6px;
  border-radius: 999px;
}

.wiki-rarity {
  display: inline-block;
  font-size: 0.62rem;
  color: var(--gold);
  background: rgba(251, 191, 36, 0.12);
  padding: 2px 6px;
  border-radius: 999px;
}

@media (max-width: 1024px) {
  #wiki-seeds .wiki-grid-4,
  .wiki-grid-4 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  #wiki-seeds .wiki-grid-4,
  .wiki-grid-4,
  .wiki-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  #wiki-seeds .wiki-grid-4,
  .wiki-grid-4,
  .wiki-grid-3 {
    grid-template-columns: 1fr;
  }
}
