:root {
  --bg: #14110c;
  --bg-panel: #1d1811;
  --bg-panel-2: #241d14;
  --border: #3a301f;
  --accent: #e3a13a;
  --accent-dim: #b9822c;
  --accent-soft: rgba(227, 161, 58, 0.14);
  --moss: #5c8a52;
  --text: #eee3cf;
  --text-dim: #a89a80;
  --online: #6fae5a;
  --offline: #b5453f;
  --answered: #4a8fc2;
  --radius: 2px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(227,161,58,0.06), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(92,138,82,0.05), transparent 40%);
  color: var(--text);
  font-family: 'Vazirmatn', system-ui, sans-serif;
  line-height: 1.7;
}

.pixel-heading, .pixel-heading-sm {
  font-family: 'Silkscreen', 'Vazirmatn', sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
  line-height: 1.5;
}
.pixel-heading { font-size: clamp(1.8rem, 4vw, 2.7rem); margin: 0 0 1rem; }
.pixel-heading-sm { font-size: clamp(1.3rem, 3vw, 1.8rem); margin: 0 0 0.5rem; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.wrap-narrow { max-width: 640px; }

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

/* ---------- Topbar ---------- */
.topbar {
  border-bottom: 2px solid var(--border);
  background: rgba(20, 17, 12, 0.9);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  gap: 1.5rem;
}
.brand {
  font-family: 'Silkscreen', sans-serif;
  font-size: 1.1rem;
  color: var(--accent);
}
.nav { display: flex; gap: 1.5rem; flex: 1; justify-content: center; }
.nav-link { color: var(--text-dim); font-size: 0.95rem; transition: color 0.15s; }
.nav-link:hover { color: var(--text); }
.nav-auth { display: flex; align-items: center; gap: 0.75rem; }
.who { color: var(--text-dim); font-size: 0.85rem; }
.inline-form { display: inline; }

/* ---------- Buttons (beveled, not soft-rounded) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.3rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-accent {
  background: var(--accent);
  color: #241a08;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.28), inset 0 2px 0 rgba(255,255,255,0.25);
}
.btn-accent:hover { filter: brightness(1.06); }
.btn-ghost {
  background: var(--bg-panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent-dim); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero { padding: 4rem 0 3rem; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3rem;
  align-items: center;
}
.hero-text { color: var(--text-dim); max-width: 46ch; }
.hero-text.small { font-size: 0.92rem; }
.hero-actions { display: flex; gap: 0.8rem; margin-top: 1.6rem; flex-wrap: wrap; }

.ip-sign {
  margin-top: 1.8rem;
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--bg-panel-2);
  border: 2px solid var(--border);
  padding: 0.9rem 1.4rem;
  cursor: pointer;
  position: relative;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  transition: border-color 0.15s;
}
.ip-sign:hover { border-color: var(--accent); }
.ip-label { font-size: 0.75rem; color: var(--text-dim); }
.ip-value { font-family: 'Silkscreen', monospace; font-size: 1.15rem; color: var(--accent); }
.ip-copy-hint { font-size: 0.7rem; color: var(--text-dim); opacity: 0.7; }

/* ---------- Status HUD ---------- */
.hero-panel {
  background: var(--bg-panel);
  border: 2px solid var(--border);
  padding: 1.5rem;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.status-hud-full { max-width: 700px; }
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.hud-players { color: var(--text-dim); font-size: 0.9rem; }
.hud-motd { color: var(--text-dim); margin: 0.4rem 0; font-size: 0.92rem; }
.hud-meta { color: var(--text-dim); font-size: 0.85rem; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
}
.status-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-pill.online { background: rgba(111,174,90,0.15); color: var(--online); }
.status-pill.online::before { background: var(--online); }
.status-pill.offline { background: rgba(181,69,63,0.15); color: var(--offline); }
.status-pill.offline::before { background: var(--offline); }
.status-open { background: rgba(227,161,58,0.15); color: var(--accent); }
.status-open::before { background: var(--accent); }
.status-answered { background: rgba(74,143,194,0.15); color: var(--answered); }
.status-answered::before { background: var(--answered); }
.status-closed { background: rgba(168,154,128,0.15); color: var(--text-dim); }
.status-closed::before { background: var(--text-dim); }

.player-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.player-chip { display: flex; align-items: center; gap: 0.4rem; background: var(--bg-panel-2); padding: 0.3rem 0.6rem; font-size: 0.82rem; border: 1px solid var(--border); }
.player-chip img { width: 20px; height: 20px; image-rendering: pixelated; }
.player-grid { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.6rem; }
.player-chip-lg { padding: 0.5rem 0.9rem; font-size: 0.9rem; }
.player-chip-lg img { width: 32px; height: 32px; }
.players-title { margin: 1.2rem 0 0.3rem; font-size: 1rem; }

/* ---------- Sections ---------- */
.section { padding: 3rem 0; }
.page-head { padding-bottom: 1rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.3rem; }
.link-more { color: var(--accent); font-size: 0.9rem; }

.gm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.gm-grid-full { grid-template-columns: repeat(2, 1fr); }
.gm-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-right: 3px solid var(--accent-dim);
  padding: 1.3rem;
}
.gm-card h3 { margin: 0 0 0.2rem; font-size: 1.1rem; }
.gm-tagline { color: var(--accent); font-size: 0.85rem; margin: 0 0 0.6rem; }
.gm-desc { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 0.9rem; }
.gm-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag { background: var(--accent-soft); color: var(--accent); font-size: 0.75rem; padding: 0.2rem 0.55rem; }

/* ---------- Forms ---------- */
.auth-section { padding-top: 2rem; }
.panel { background: var(--bg-panel); border: 1px solid var(--border); padding: 1.8rem; }
.form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.2rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.9rem; color: var(--text-dim); }
.field input, .field select, .field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.65rem 0.8rem;
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: var(--radius);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.alert { padding: 0.7rem 1rem; margin-bottom: 1rem; font-size: 0.88rem; }
.alert-error { background: rgba(181,69,63,0.12); color: #e0857f; border: 1px solid rgba(181,69,63,0.4); }

/* ---------- Tickets ---------- */
.ticket-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ticket-list { display: flex; flex-direction: column; gap: 0.6rem; }
.ticket-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--bg-panel); border: 1px solid var(--border);
  padding: 0.9rem 1.1rem; transition: border-color 0.15s;
}
.ticket-row:hover { border-color: var(--accent-dim); }
.ticket-row-main { display: flex; flex-direction: column; gap: 0.2rem; }
.ticket-subject { font-weight: 600; }
.ticket-meta { font-size: 0.8rem; color: var(--text-dim); }
.empty-state { color: var(--text-dim); text-align: center; padding: 3rem 0; }

.thread { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1.5rem; }
.msg { padding: 0.9rem 1.1rem; border: 1px solid var(--border); background: var(--bg-panel); max-width: 85%; }
.msg-admin { border-color: rgba(74,143,194,0.4); background: rgba(74,143,194,0.06); align-self: flex-start; }
.msg-user { align-self: flex-end; }
.msg-head { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.78rem; color: var(--text-dim); margin-bottom: 0.4rem; }
.msg-body { margin: 0; white-space: pre-wrap; font-size: 0.94rem; }
.reply-form { margin-top: 0.5rem; }
.reply-actions { display: flex; gap: 0.7rem; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 1.5rem 0; margin-top: 3rem; }
.footer-inner { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--text-dim); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .gm-grid, .gm-grid-full { grid-template-columns: 1fr; }
  .nav { display: none; }
  .topbar-inner { justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
