:root {
  --bg: #12141c;
  --bg-raised: #191c28;
  --bg-raised-2: #20243380;
  --line: #333750;
  --line-soft: #262a3c;
  --text: #e9e7df;
  --text-muted: #8c90a8;
  --mint: #5eead4;
  --mint-dim: #3a7d72;
  --amber: #f0b429;
  --error: #f28b7d;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-sans: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100%;
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  z-index: 0;
  background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 0);
  background-size: 22px 22px;
}

a { color: var(--mint); }

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

/* ---------- topbar ---------- */

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.brand-mark { color: var(--mint); }

.auth-nav { display: flex; align-items: center; gap: 10px; }

.pill-btn {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pill-btn:hover { border-color: var(--mint); }

.pill-btn.solid {
  background: var(--mint);
  border-color: var(--mint);
  color: #0b1512;
}
.pill-btn.solid:hover { background: #7ff0dc; }

.username-chip {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--amber);
  padding: 6px 12px;
  border: 1px dashed var(--line);
  border-radius: 6px;
}

/* ---------- hero ---------- */

main { position: relative; z-index: 1; flex: 1; }

.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 20px;
  text-align: center;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 14px;
}

.hero h1 {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 36px;
}

/* ---------- dropzone ---------- */

.dropzone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 48px 24px;
  background: var(--bg-raised);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  overflow: hidden;
}

.dropzone:hover { border-color: var(--mint-dim); }

.dropzone.dragover {
  border-color: var(--mint);
  background: #17342f33;
  transform: scale(1.01);
}

.dropzone.uploading { cursor: progress; }

.dz-icon {
  font-size: 30px;
  color: var(--mint);
  margin-bottom: 12px;
}

.dz-main { margin: 0 0 6px; font-size: 16px; }

.dz-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--mint);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dz-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: transparent;
}
.dz-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--mint);
  transition: width 0.15s ease;
}

/* ---------- ticket (signature element) ---------- */

.ticket-area { margin-top: 28px; }

.ticket {
  --stub-w: 92px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr var(--stub-w);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  text-align: left;
  animation: ticket-in 0.35s cubic-bezier(.2,.8,.2,1);
}

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

.ticket-main { padding: 20px 22px; min-width: 0; }

.ticket-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.ticket-name {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.ticket-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.ticket-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ticket-link {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--mint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--mint-dim);
  background: transparent;
  color: var(--mint);
  cursor: pointer;
}
.copy-btn:hover { background: #17342f55; }

.ticket-delete {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
}
.ticket-delete:hover { color: var(--error); }

.ticket-stub {
  position: relative;
  border-left: 2px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #171a26;
}

.ticket-stub::before,
.ticket-stub::after {
  content: '';
  position: absolute;
  left: -8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
}
.ticket-stub::before { top: -8px; }
.ticket-stub::after { bottom: -8px; }

.ticket-stub-mark {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--mint);
  text-transform: uppercase;
}

.ticket.error {
  border-color: var(--error);
}
.ticket.error .ticket-main { padding: 18px 22px; }
.ticket.error .ticket-name { color: var(--error); }

/* ---------- history ---------- */

.history-section {
  max-width: 720px;
  margin: 56px auto 0;
  padding: 0 24px 48px;
}

.history-head { margin-bottom: 16px; }

.history-head h2 {
  font-size: 15px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  margin: 0 0 6px;
  color: var(--text);
}

.history-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--bg-raised);
}

.history-item .h-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item .h-size {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.history-item a.h-open {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mint);
  flex-shrink: 0;
  text-decoration: none;
  border-bottom: 1px dotted var(--mint-dim);
}

.history-item button.h-del {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
}
.history-item button.h-del:hover { color: var(--error); }

.empty-note {
  color: var(--text-muted);
  font-size: 13.5px;
  font-style: italic;
  margin: 0;
}

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: #0a0b10cc;
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px 24px;
}

.modal-close {
  position: absolute;
  top: 10px; right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--mint); border-bottom-color: var(--mint); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form.hidden { display: none; }

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.auth-form input {
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}
.auth-form input:focus { border-color: var(--mint); }

.form-hint { margin: 0; font-size: 11.5px; color: var(--text-muted); }
.form-error { margin: 0; font-size: 12.5px; color: var(--error); min-height: 15px; }

.primary-btn {
  margin-top: 4px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  padding: 11px 0;
  border-radius: 8px;
  border: none;
  background: var(--mint);
  color: #0b1512;
  cursor: pointer;
}
.primary-btn:hover { background: #7ff0dc; }

/* ---------- footer ---------- */

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ---------- responsive ---------- */

@media (max-width: 480px) {
  .topbar { padding: 16px 18px; }
  .ticket { grid-template-columns: 1fr 56px; }
  .ticket-stub-mark { font-size: 9.5px; }
  .dropzone { padding: 36px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ticket, .dropzone { animation: none; transition: none; }
}
