:root {
  --bg: #14150f;
  --bg-alt: #1b1c15;
  --panel: #20211a;
  --panel-border: #33352a;
  --olive: #6b7a3f;
  --olive-bright: #9db24f;
  --rust: #b3552f;
  --text: #e8e6d8;
  --text-dim: #a3a291;
  --amber: #d9a039;
  --blue: #4f8fb2;
  --red: #c24b4b;
  --green: #5fa35a;
  /* Discord's own blurple. A brand colour, not a palette choice — it marks the
     things that are Discord's (the link panel, booster-only timeline marks). */
  --discord: #5865f2;
  --radius: 10px;
  --font: 'Prompt', 'Segoe UI', Tahoma, 'Noto Sans Thai', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(circle at top, var(--bg-alt), var(--bg) 70%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Form controls don't inherit the body's font-family by default (browser UA
   stylesheets give them their own) — without this, any input/button/select/
   textarea added on any page silently falls back to the system font. */
input, button, select, textarea {
  font-family: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(20, 21, 15, 0.9);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--text);
}
.brand span { color: var(--olive-bright); }

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-tab {
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.nav-tab:hover { color: var(--text); background: var(--panel); }
.nav-tab.active { color: var(--olive-bright); background: var(--panel); }

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

.balance-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 600;
  font-size: 14px;
  /* It doubles as a link to /donate — reset anchor defaults so it still
     reads as the same pill, not a blue underlined link. */
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s;
}
.balance-pill:hover { border-color: var(--olive-bright); }
.balance-icon { width: 18px; height: 18px; object-fit: contain; }

/* Inline points-currency icon — sized relative to whatever text it sits next
   to (buttons, summary lines, badges) instead of a fixed pixel size. */
.point-icon {
  height: 1em;
  width: auto;
  vertical-align: -0.15em;
  display: inline-block;
}
#balance-value { color: var(--amber); }

.btn {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  /* Half the buttons on this site are <a> elements, which the browser
     underlines by default — so this belongs here rather than being remembered
     per page. It was not, and an underline turned up under one of them.
     Deliberately the only thing added here: alignment differs between <a> and
     <button>, but fixing that globally changes the layout of every button on
     every page, which is not a change to make blind. */
  text-decoration: none;
}
.btn:hover { border-color: var(--olive-bright); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost { background: transparent; }

.btn-primary {
  background: var(--olive);
  border-color: var(--olive);
  color: #101208;
}
.btn-primary:hover { background: var(--olive-bright); border-color: var(--olive-bright); }

.btn-danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}
.btn-danger:hover { background: var(--red); color: var(--text); }

.logout-form { display: inline; }

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 0px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.panel-head { margin-bottom: 16px; }
.panel-head h2 {
  margin: 0 0 4px;
  font-size: 32px;
  letter-spacing: 0.3px;
}
.panel-sub {
  margin: 0;
  color: var(--text-dim);
  font-size: 16px;
}

.panel-head-with-image {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--panel-border);
}
.panel-head-mascot {
  flex-shrink: 0;
  height: 110px;
  width: auto;
}
.panel-head-text {
  flex: 1;
  min-width: 0;
}

@media (max-width: 520px) {
  .panel-head-with-image { flex-direction: column; align-items: flex-start; gap: 12px; }
  .panel-head-mascot { height: 80px; }
}

@media (max-width: 520px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .topbar-left { flex-wrap: wrap; gap: 10px; }
  .nav-tabs { overflow-x: auto; }
  .page { padding: 20px 14px 40px; }
}

.donation-goal {
  width: 100vw;
  position: relative;
  left: 50%;
  margin-left: -50vw;
  margin-top: 8px;
  margin-bottom: -20px;
  padding: 48px 24px 56px;
  background: var(--panel);
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: center;
  color: inherit;
  text-decoration: none;
}
a.donation-goal {
  cursor: pointer;
  transition: background 0.15s;
}
a.donation-goal:hover {
  background: var(--bg-alt);
}

.donation-goal-inner {
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.donation-goal-mascot {
  flex-shrink: 0;
  height: 220px;
  width: auto;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.35));
}

.donation-goal-content {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.donation-goal-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.donation-goal-detail {
  margin: 0 auto 20px;
  max-width: 460px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.donation-goal-percent {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  color: var(--olive-bright);
  margin-bottom: 10px;
}

.donation-goal-bar {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.donation-goal-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--olive-bright), var(--amber));
  transition: width 0.4s ease;
}

.donation-goal-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.donation-goal-current {
  color: var(--amber);
  font-weight: 700;
}

@media (max-width: 640px) {
  .donation-goal { padding: 32px 16px 40px; }
  .donation-goal-inner { flex-direction: column; gap: 16px; }
  .donation-goal-mascot { height: 110px; }
}

/* Shared by item-shop/rewards/inventory item-list detail lines — truncate to
   one line with an ellipsis; the untruncated text is in the element's own
   `title` attribute (see ui.js's buildItemListDetail). */
.item-list-detail {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
}

.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 1002;
}

.toast {
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  animation: toast-in 0.2s ease-out;
}
.toast-success { border-color: var(--green); color: var(--green); }
.toast-error { border-color: var(--red); color: var(--red); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 7, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  padding: 20px;
}

.modal-dialog {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 24px;
  /* Wider than it was. These dialogs now explain a consequence rather than ask
     a one-line question, and 380px wrapped that explanation into a column. */
  max-width: 460px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modal-in 0.14s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .modal-dialog { animation: none; }
}

.modal-title {
  margin: 0 0 12px;
  font-size: 16px;
}

.modal-message {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
}

/* The consequence, not the question. Quieter than the message and boxed off, so
   it reads as "and here is what that means" rather than as more of the same
   sentence. */
.modal-note {
  margin: 14px 0 0;
  padding: 11px 13px;
  border-radius: 9px;
  background: var(--bg-alt);
  border-left: 2px solid var(--olive);
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: -1px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.site-footer {
  margin-top: 20px;
  padding: 20px 28px 28px;
  text-align: center;
  border-top: 1px solid var(--panel-border);
}
.site-footer p {
  margin: 4px 0;
  font-size: 12px;
  color: var(--text-dim);
}
.site-footer-credit span {
  color: var(--amber);
  font-weight: 600;
}
