@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
  --bg-ink: #07090c;
  --stone: rgba(14, 18, 24, 0.78);
  --stone-2: rgba(10, 12, 16, 0.60);
  --parchment: rgba(24, 20, 16, 0.65);
  --text: #efe7d2;
  --muted: rgba(231, 219, 191, 0.70);
  --gold: #c89b3c;
  --gold-2: #f3d27a;
  --border: rgba(200, 155, 60, 0.35);
  --shadow: rgba(0, 0, 0, 0.55);

  --pixel: "Press Start 2P", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --pixel-body: "VT323", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --chat-paper-1: rgba(244, 233, 201, 0.96);
  --chat-paper-2: rgba(214, 194, 150, 0.94);
  --chat-ink: rgba(33, 25, 16, 0.95);
  --chat-border: rgba(54, 42, 28, 0.92);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--pixel-body);
  font-size: 20px;
  letter-spacing: 0.2px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(7, 9, 12, 0.82), rgba(7, 9, 12, 0.88)),
    url('/static/background.JPG') center / cover no-repeat fixed;
}

/* Animated background canvas */
#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0.28;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.app-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

@media (max-width: 980px) {
  .container { max-width: 980px; }
  .app-layout { grid-template-columns: 1fr; }
}

.sidebar {
  background:
    radial-gradient(900px 420px at 20% 0%, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, rgba(14, 18, 24, 0.78), rgba(10, 12, 16, 0.60));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 18px 40px var(--shadow);
  color: var(--text);
  backdrop-filter: blur(10px);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(243, 210, 122, 0.22);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.sidebar-title {
  font-family: var(--pixel);
  font-size: 12px;
  color: var(--gold-2);
}

.sidebar-btn {
  padding: 10px 12px;
}

.sidebar-note {
  font-size: 14px;
  line-height: 1.25;
  color: rgba(231, 219, 191, 0.82);
  margin-bottom: 10px;
}

.history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 720px;
  overflow: auto;
  padding-right: 4px;
}

.history-item {
  cursor: pointer;
  border: 1px solid rgba(200, 155, 60, 0.25);
  border-radius: 10px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(34, 28, 20, 0.58), rgba(16, 14, 12, 0.55));
}

.history-item:hover { filter: brightness(1.04); }

.history-meta {
  font-size: 12px;
  color: rgba(231, 219, 191, 0.70);
  margin-bottom: 6px;
}

.history-q {
  font-size: 14px;
  color: rgba(243, 210, 122, 0.95);
  line-height: 1.2;
}

.public-notice {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid rgba(54, 42, 28, 0.70);
  background: rgba(255, 255, 255, 0.18);
  color: rgba(33, 25, 16, 0.92);
}

.view-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid rgba(54, 42, 28, 0.70);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(33, 25, 16, 0.92);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

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

.gold-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(243, 210, 122, 0.35);
  background: rgba(12, 10, 8, 0.55);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  color: var(--gold-2);
  font-size: 13px;
  white-space: nowrap;
}

.gold-coin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 45%),
    linear-gradient(180deg, rgba(243, 210, 122, 0.95), rgba(200, 155, 60, 0.92));
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.35);
}

.header h1 {
  margin: 0;
  font-family: var(--pixel);
  font-size: 18px;
  letter-spacing: 0.4px;
  color: var(--gold-2);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}

.header a {
  color: var(--gold-2);
  text-decoration: none;
  border-bottom: 1px dotted rgba(243, 210, 122, 0.5);
}

.chat {
  /* OSRS-style parchment chat panel */
  background:
    radial-gradient(1200px 520px at 30% 0%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, var(--chat-paper-1), var(--chat-paper-2));
  border: 2px solid var(--chat-border);
  border-radius: 8px;
  padding: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 0 0 1px rgba(0, 0, 0, 0.22),
    0 18px 40px var(--shadow);
  color: var(--chat-ink);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 520px;
  padding: 8px;

  /* Make it feel like an OSRS chat scroll area */
  max-height: 700px;
  overflow-y: auto;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.02),
      rgba(0, 0, 0, 0.02) 1px,
      rgba(255, 255, 255, 0) 1px,
      rgba(255, 255, 255, 0) 4px
    );
}

/* Scrollbar styling (best-effort) */
.messages {
  scrollbar-color: rgba(30, 24, 16, 0.7) rgba(0, 0, 0, 0.18);
  scrollbar-width: thin;
}

.messages::-webkit-scrollbar { width: 14px; }
.messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.18);
  border-left: 1px solid rgba(0, 0, 0, 0.25);
}
.messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(90, 70, 45, 0.85), rgba(40, 30, 20, 0.85));
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 10px;
}
.messages::-webkit-scrollbar-thumb:hover { filter: brightness(1.08); }

.msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.msg-row.me {
  flex-direction: row-reverse;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 2px solid rgba(54, 42, 28, 0.75);
  background: rgba(255, 255, 255, 0.20);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  flex: 0 0 42px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.msg {
  border: 1px solid rgba(54, 42, 28, 0.35);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  flex: 1;
}

.msg.me {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06));
  border-color: rgba(54, 42, 28, 0.45);
}

.msg .role {
  font-family: var(--pixel);
  font-size: 11px;
  color: rgba(40, 30, 20, 0.70);
  margin-bottom: 8px;
}

.msg .text {
  white-space: pre-wrap;
  line-height: 1.35;
  color: var(--chat-ink);
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.orb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 45%),
    radial-gradient(circle at 50% 50%, rgba(120, 210, 255, 0.28), rgba(20, 120, 200, 0.10), rgba(0, 0, 0, 0) 70%),
    linear-gradient(180deg, rgba(243, 210, 122, 0.95), rgba(200, 155, 60, 0.92));
  box-shadow: 0 0 18px rgba(120, 210, 255, 0.25), 0 0 26px rgba(243, 210, 122, 0.18);
  animation: orbPulse 1.2s ease-in-out infinite;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.08); filter: brightness(1.08); }
}

.dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(243, 210, 122, 0.9);
  animation: dotBounce 1s infinite;
}

.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.composer {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.composer input {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid rgba(54, 42, 28, 0.70);
  background: rgba(255, 255, 255, 0.22);
  color: var(--chat-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.composer input::placeholder {
  color: rgba(33, 25, 16, 0.55);
}

button {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(243, 210, 122, 0.55);
  background: linear-gradient(180deg, rgba(243, 210, 122, 0.95), rgba(200, 155, 60, 0.92));
  color: rgba(10, 8, 6, 0.95);
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
}

button:hover {
  filter: brightness(1.04);
}

button:active {
  transform: translateY(1px);
}

.card {
  background: linear-gradient(180deg, var(--parchment), rgba(12, 10, 8, 0.55));
  border: 1px solid rgba(243, 210, 122, 0.30);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px var(--shadow);
}

.donate-form {
  display: grid;
  gap: 12px;
  max-width: 420px;
}

.quick-gold {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-gold button {
  padding: 10px 12px;
}

.donate-form input {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(243, 210, 122, 0.30);
  background: rgba(12, 10, 8, 0.60);
  color: var(--text);
}

.hint {
  margin-top: 10px;
  color: rgba(40, 30, 20, 0.70);
  font-size: 14px;
}
