/* TheUntold.Fun — Design System */
:root {
  --obsidian: #171717;
  --obsidian-soft: #1f1f1f;
  --obsidian-lift: #2a2a2a;
  --ivory: #F4F0E8;
  --ivory-dim: #e8e2d6;
  --stone: #A6A29A;
  --stone-dark: #6e6a63;
  --lime: #C7F36B;
  --lime-deep: #a8d44a;
  --danger: #e85d4c;
  --danger-soft: rgba(232, 93, 76, 0.12);
  --success: #6bcf8e;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(199, 243, 107, 0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(244, 240, 232, 0.05), transparent 50%),
    var(--obsidian);
  color: var(--ivory);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--lime);
  color: var(--obsidian);
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(23, 23, 23, 0.82);
  border-bottom: 1px solid rgba(244, 240, 232, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(199, 243, 107, 0.15);
  animation: pulse-dot 2.8s var(--ease) infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.85); opacity: 0.7; }
}

.brand-text { font-size: 1.05rem; }
.brand-dot { color: var(--lime); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-link {
  color: var(--stone);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.4rem 0.55rem;
  transition: color 0.2s var(--ease);
}
.nav-link:hover { color: var(--ivory); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
  border: 1px solid transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-sm { padding: 0.55rem 0.95rem; font-size: 0.85rem; }
.btn-accent {
  background: var(--lime);
  color: var(--obsidian);
  box-shadow: 0 8px 24px rgba(199, 243, 107, 0.18);
}
.btn-accent:hover { background: var(--lime-deep); }
.btn-ghost {
  background: transparent;
  border-color: rgba(244, 240, 232, 0.16);
  color: var(--ivory);
}
.btn-ghost:hover { background: rgba(244, 240, 232, 0.05); }
.btn-danger {
  background: var(--danger-soft);
  color: #ff8f82;
  border-color: rgba(232, 93, 76, 0.25);
}
.btn-block { width: 100%; }

/* Typography */
.display {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0;
}

.eyebrow {
  display: inline-block;
  color: var(--lime);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.lede {
  color: var(--stone);
  font-size: 1.08rem;
  max-width: 36ch;
  margin: 0.9rem 0 0;
}

/* Hero */
.hero {
  padding: clamp(3.5rem, 10vw, 6.5rem) 0 clamp(3rem, 8vw, 5rem);
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: end;
}

.hero-brand {
  font-family: var(--display);
  font-size: clamp(2.8rem, 8vw, 5.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0 0 1.2rem;
}

.hero h1.display {
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  max-width: 16ch;
  color: var(--ivory);
}

.claim-panel {
  background: linear-gradient(160deg, rgba(244, 240, 232, 0.07), rgba(244, 240, 232, 0.03));
  border: 1px solid rgba(244, 240, 232, 0.1);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  animation: rise-in 0.7s var(--ease) both;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.claim-label {
  font-size: 0.85rem;
  color: var(--stone);
  margin-bottom: 0.65rem;
  display: block;
}

.claim-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.input-prefix {
  display: flex;
  align-items: center;
  background: var(--obsidian-soft);
  border: 1px solid rgba(244, 240, 232, 0.12);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.input-prefix:focus-within {
  border-color: rgba(199, 243, 107, 0.55);
  box-shadow: 0 0 0 3px rgba(199, 243, 107, 0.12);
}

.input-prefix span {
  padding: 0 0 0 1rem;
  color: var(--stone);
  font-size: 0.9rem;
  white-space: nowrap;
}

.input-prefix input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0.95rem 1rem;
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.field label {
  font-size: 0.88rem;
  color: var(--stone);
  font-weight: 500;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--obsidian-soft);
  border: 1px solid rgba(244, 240, 232, 0.12);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  resize: vertical;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(199, 243, 107, 0.55);
  box-shadow: 0 0 0 3px rgba(199, 243, 107, 0.12);
}

.hint { font-size: 0.82rem; color: var(--stone); }
.status-msg {
  margin-top: 0.85rem;
  font-size: 0.9rem;
  min-height: 1.3em;
}
.status-msg.is-error { color: #ff8f82; }
.status-msg.is-ok { color: var(--lime); }

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}
.chip {
  background: var(--obsidian-lift);
  border: 1px solid rgba(244, 240, 232, 0.1);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  color: var(--ivory);
  transition: background 0.2s var(--ease);
}
.chip:hover { background: rgba(199, 243, 107, 0.15); color: var(--lime); }

/* Sections */
.section {
  padding: clamp(3rem, 7vw, 5rem) 0;
}
.section-light {
  background: var(--ivory);
  color: var(--obsidian);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.section-light .lede,
.section-light .hint { color: var(--stone-dark); }
.section-light .eyebrow { color: #5a7a1a; }

.section-title {
  font-family: var(--display);
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}

.steps {
  display: grid;
  gap: 1.2rem;
  margin-top: 2rem;
}
.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  padding: 1.1rem 0;
  border-top: 1px solid rgba(23, 23, 23, 0.08);
}
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--obsidian);
  color: var(--lime);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
}
.step h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}
.step p {
  margin: 0;
  color: var(--stone-dark);
  font-size: 0.95rem;
}

.features {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}
.feature {
  padding: 1.25rem 0;
  border-bottom: 1px solid rgba(244, 240, 232, 0.08);
}
.feature h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.feature p {
  margin: 0;
  color: var(--stone);
  font-size: 0.95rem;
}

.closing {
  text-align: center;
  padding: clamp(4rem, 10vw, 6rem) 0;
}
.closing .display {
  font-size: clamp(1.8rem, 5vw, 3rem);
  max-width: 18ch;
  margin: 0 auto 1rem;
}

/* Auth / forms */
.auth-shell {
  width: min(100% - 2rem, 440px);
  margin: clamp(2rem, 6vw, 4rem) auto;
  animation: rise-in 0.55s var(--ease) both;
}
.auth-card {
  background: linear-gradient(160deg, rgba(244, 240, 232, 0.07), rgba(244, 240, 232, 0.025));
  border: 1px solid rgba(244, 240, 232, 0.1);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.auth-card h1 {
  font-family: var(--display);
  font-size: 1.7rem;
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
}
.pin-inputs {
  display: flex;
  gap: 0.55rem;
  justify-content: center;
  margin: 1.2rem 0;
}
.pin-inputs input {
  width: 58px;
  height: 64px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--obsidian-soft);
  border: 1px solid rgba(244, 240, 232, 0.14);
  border-radius: var(--radius);
  outline: none;
}
.pin-inputs input:focus {
  border-color: rgba(199, 243, 107, 0.6);
  box-shadow: 0 0 0 3px rgba(199, 243, 107, 0.12);
}
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: var(--danger-soft);
  color: #ff8f82;
  border: 1px solid rgba(232, 93, 76, 0.25);
}
.alert-ok {
  background: rgba(107, 207, 142, 0.12);
  color: var(--success);
  border: 1px solid rgba(107, 207, 142, 0.25);
}
.alert-warn {
  background: rgba(199, 243, 107, 0.08);
  color: var(--lime);
  border: 1px solid rgba(199, 243, 107, 0.2);
}
.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  color: var(--stone);
  margin: 0.8rem 0 1.2rem;
}
.check-row input { width: 16px; height: 16px; accent-color: var(--lime); }

/* Public profile */
.profile-page {
  width: min(100% - 2rem, 520px);
  margin: clamp(1.5rem, 5vw, 3rem) auto 3rem;
  animation: rise-in 0.55s var(--ease) both;
}
.profile-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}
.profile-hero .username {
  font-family: var(--display);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  margin: 0.3rem 0;
  letter-spacing: -0.03em;
}
.profile-hero .prompt {
  color: var(--stone);
  font-size: 1.05rem;
  margin: 0.6rem auto 0;
  max-width: 32ch;
}
.type-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
  scrollbar-width: none;
}
.type-tabs::-webkit-scrollbar { display: none; }
.type-tab {
  flex: 0 0 auto;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  background: var(--obsidian-lift);
  color: var(--stone);
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.2s var(--ease);
}
.type-tab.is-active {
  background: rgba(199, 243, 107, 0.12);
  color: var(--lime);
  border-color: rgba(199, 243, 107, 0.3);
}
.message-box {
  background: linear-gradient(160deg, rgba(244, 240, 232, 0.07), rgba(244, 240, 232, 0.025));
  border: 1px solid rgba(244, 240, 232, 0.1);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.char-count {
  text-align: right;
  font-size: 0.78rem;
  color: var(--stone);
  margin-top: 0.35rem;
}
.sent-success {
  text-align: center;
  padding: 2rem 1rem;
}
.sent-success h2 {
  font-family: var(--display);
  margin: 0 0 0.5rem;
}

/* Inbox */
.inbox-layout {
  width: min(100% - 2rem, 900px);
  margin: 1.5rem auto 3rem;
}
.inbox-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.stat {
  background: rgba(244, 240, 232, 0.05);
  border: 1px solid rgba(244, 240, 232, 0.08);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  min-width: 110px;
}
.stat strong {
  display: block;
  font-size: 1.4rem;
  font-family: var(--display);
  letter-spacing: -0.02em;
}
.stat span {
  font-size: 0.8rem;
  color: var(--stone);
}
.inbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}
.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--obsidian-soft);
  border: 1px solid rgba(244, 240, 232, 0.1);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
  color: var(--stone);
  max-width: 100%;
}
.link-pill code {
  color: var(--lime);
  font-family: var(--font);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.filter-btn.is-active {
  background: rgba(199, 243, 107, 0.12);
  color: var(--lime);
  border-color: rgba(199, 243, 107, 0.3);
}
.message-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.message-item {
  background: rgba(244, 240, 232, 0.04);
  border: 1px solid rgba(244, 240, 232, 0.08);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
  animation: rise-in 0.4s var(--ease) both;
}
.message-item.is-unread {
  border-color: rgba(199, 243, 107, 0.28);
  background: rgba(199, 243, 107, 0.04);
}
.message-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  font-size: 0.8rem;
  color: var(--stone);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--obsidian-lift);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--lime);
}
.message-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 1.02rem;
  margin: 0 0 0.85rem;
}
.message-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--stone);
}
.empty-state h2 {
  font-family: var(--display);
  color: var(--ivory);
  margin: 0 0 0.5rem;
}

/* Settings panel */
.settings-panel {
  background: rgba(244, 240, 232, 0.04);
  border: 1px solid rgba(244, 240, 232, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.settings-panel h2 {
  font-family: var(--display);
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
}

/* Share page */
.share-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.share-card-preview {
  aspect-ratio: 9 / 16;
  max-height: 420px;
  margin: 0 auto;
  width: min(100%, 240px);
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 20%, rgba(199, 243, 107, 0.25), transparent 40%),
    linear-gradient(165deg, #1f1f1f, #121212);
  border: 1px solid rgba(244, 240, 232, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.4rem;
  text-align: left;
}
.share-card-preview .sc-brand {
  font-weight: 700;
  font-size: 0.85rem;
}
.share-card-preview .sc-q {
  font-family: var(--display);
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.share-card-preview .sc-user {
  color: var(--lime);
  font-weight: 600;
}

/* Admin */
.admin-body { background: #111; }
.admin-wrap {
  width: min(100% - 2rem, 1100px);
  margin: 1.5rem auto 3rem;
}
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(244, 240, 232, 0.08);
  border-radius: var(--radius);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th,
table.data td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid rgba(244, 240, 232, 0.06);
}
table.data th {
  color: var(--stone);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(244, 240, 232, 0.03);
}
.status-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-active { background: rgba(107, 207, 142, 0.15); color: var(--success); }
.status-locked { background: var(--danger-soft); color: #ff8f82; }
.status-disabled { background: rgba(166, 162, 154, 0.15); color: var(--stone); }

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid rgba(244, 240, 232, 0.06);
  padding: 2rem 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.footer-tag, .footer-note {
  margin: 0.35rem 0 0;
  color: var(--stone);
  font-size: 0.88rem;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(120%);
  background: var(--ivory);
  color: var(--obsidian);
  padding: 0.75rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  z-index: 200;
  transition: transform 0.35s var(--ease);
  pointer-events: none;
}
.toast.is-show { transform: translateX(-50%) translateY(0); }

/* Responsive */
@media (min-width: 768px) {
  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 3rem;
  }
  .claim-row {
    flex-direction: row;
    align-items: stretch;
  }
  .claim-row .btn { white-space: nowrap; }
  .steps {
    grid-template-columns: repeat(2, 1fr);
  }
  .features {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  .feature {
    border-bottom: none;
    padding: 1.25rem;
    background: rgba(244, 240, 232, 0.03);
    border-radius: var(--radius);
    border: 1px solid rgba(244, 240, 232, 0.06);
  }
}

@media (max-width: 640px) {
  .header-nav .nav-link:not(.btn) { display: none; }
  .pin-inputs input {
    width: 52px;
    height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
