:root {
  --bg: #0f1419;
  --panel: #1a212b;
  --border: #2a3340;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --accent: #4f8cff;
  --accent-hover: #3a78f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: #0008;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar .user { color: var(--muted); }
.inline { display: inline; margin: 0; }

/* Language switcher */
.lang-switch { display: inline-flex; gap: 0.4rem; font-size: 0.85rem; }
.lang-switch a { color: var(--muted); }
.lang-current { color: var(--text); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn-lg { padding: 0.7rem 1.4rem; font-size: 1.05rem; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--border); }

/* Layout */
main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem; }
.hero { text-align: center; padding: 3rem 1rem; }
.hero h1 { font-size: 2rem; margin-bottom: 0.75rem; }
.hero p { color: var(--muted); max-width: 540px; margin: 0 auto 1.5rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
}

/* Helpers */
.muted { color: var(--muted); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.hint { color: var(--muted); font-size: 0.85rem; }
.alert {
  background: #3a1d1d;
  border: 1px solid #7a2d2d;
  color: #ffb4b4;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* Forms */
.form-panel { max-width: 640px; margin: 0 auto; }
.form { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field > span { font-weight: 600; font-size: 0.95rem; }
.field em { color: var(--muted); font-style: normal; font-weight: 400; }
.field input[type=text],
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 0.95rem;
}
.field input[type=file] { color: var(--muted); }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-pending  { background: #3a341a; color: #f2d479; }
.badge-approved { background: #1d3a25; color: #7ce0a0; }
.badge-rejected { background: #3a1d1d; color: #ffb4b4; }
.badge-neutral  { background: #2a3340; color: #b9c4d0; }

/* World list */
.world-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.world-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.row-tags { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.world-title { font-weight: 600; flex: 1; }

/* List thumbnails */
.thumb {
  flex: 0 0 auto;
  width: 72px;
  height: 54px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-empty { color: var(--muted); font-size: 0.7rem; text-align: center; }

/* Tabs */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
}
.tab:hover { background: var(--border); text-decoration: none; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab .count { opacity: 0.8; font-size: 0.85em; }

/* World detail */
.world-detail .desc { white-space: pre-wrap; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.gallery img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

/* Moderation panel */
.mod-panel, .history { margin-top: 1.5rem; }
.mod-panel h2, .history h2 { font-size: 1.1rem; margin-bottom: 0.6rem; }
.mod-form textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 0.95rem;
}
.mod-actions { display: flex; gap: 0.6rem; margin-top: 0.6rem; }
.btn-danger { background: #b23b3b; }
.btn-danger:hover { background: #9c3030; }

/* Event history */
.event-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.event-list li {
  padding: 0.6rem 0.8rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.event-comment { margin-top: 0.4rem; white-space: pre-wrap; }

/* Audit / users tables */
.audit { width: 100%; border-collapse: collapse; }
.audit th, .audit td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.audit th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.role-form { display: flex; gap: 0.5rem; align-items: center; }
.role-form select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font-family: inherit;
}

/* Role badges */
.role-user      { background: #2a3340; color: var(--muted); }
.role-moderator { background: #1d2f3a; color: #7cc4e0; }
.role-admin     { background: #3a2f1d; color: #e0c07c; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0; }
.tag {
  display: inline-block;
  background: #24303a;
  color: #b9d4e6;
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
}
.tag-sm { font-size: 0.75rem; padding: 0.1rem 0.5rem; }

.tag-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.5rem; }
.tag-chip {
  background: transparent;
  color: var(--accent);
  border: 1px dashed var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}
.tag-chip:hover { background: var(--border); color: var(--text); }

.tag-edit { margin: 0.5rem 0 1rem; }
.tag-edit summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.tag-edit-form { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.tag-edit-form input[type=text] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.5rem 0.7rem;
  font-family: inherit;
}
