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

:root {
  --bg: #080a0f;
  --surface: rgba(255, 255, 255, 0.03);
  --surface2: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e5e7eb;
  --text-muted: #6b7280;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --danger: #ef4444;
  --radius: 12px;
}

body {
  background: var(--bg);
  background-image:
    linear-gradient(rgba(245, 158, 11, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 158, 11, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Index page ── */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 520px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo h1 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.logo-accent { color: var(--accent); }

.subtitle {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 14px;
}

/* Honeypot — invisible to humans, bots fill it */
.hp-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

input, textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  padding: 10px 14px;
  transition: border-color 0.15s, background 0.15s;
  resize: vertical;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.04);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

button[type="submit"], .btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #080a0f;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  padding: 12px;
  cursor: pointer;
  margin-top: 8px;
  letter-spacing: 0.03em;
  transition: opacity 0.15s, transform 0.1s;
}

button[type="submit"]:hover:not(:disabled), .btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}
button:disabled { opacity: 0.45; cursor: not-allowed; }

.notice {
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 20px;
  font-size: 14px;
  line-height: 1.5;
}
.notice p { margin-top: 4px; }

.notice-success {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.notice-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.notice-info {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}
.notice-info a { color: var(--accent); text-decoration: underline; }

/* ── Ticket page ── */
.ticket-body { height: 100vh; overflow: hidden; }

.ticket-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}

.ticket-header-left { display: flex; flex-direction: column; gap: 2px; }
.ticket-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.back-link {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }

.ticket-header h1 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.ticket-ign { color: var(--accent); }

.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.badge-open {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.2);
}
.badge-closed {
  background: rgba(107, 114, 128, 0.1);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.btn-danger {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.12); border-color: var(--danger); }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }

.ticket-reason {
  padding: 8px 24px;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.messages::-webkit-scrollbar { width: 5px; }
.messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
}

.msg-web {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #080a0f;
}

.msg-discord {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.msg-author { font-weight: 700; font-size: 12px; letter-spacing: 0.02em; }
.msg-web .msg-author { color: rgba(0, 0, 0, 0.65); }
.msg-discord .msg-author { color: var(--accent); }

.msg-source-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.msg-time {
  font-size: 11px;
  margin-left: auto;
}
.msg-web .msg-time { color: rgba(0, 0, 0, 0.4); }
.msg-discord .msg-time { color: var(--text-muted); }

.msg-content { line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

.message-form {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  align-items: flex-end;
}

.message-form textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 14px;
  line-height: 1.4;
}

#send-btn { width: auto; margin: 0; padding: 10px 22px; flex-shrink: 0; }

@media (max-width: 600px) {
  .card { padding: 24px 20px; }
  .ticket-header { flex-direction: column; align-items: flex-start; }
  .ticket-header-right { width: 100%; }
  .msg { max-width: 90%; }
}
