:root {
  --bg: #08090d;
  --surface: #14161c;
  --surface-soft: #191b22;
  --surface-hover: #1d2028;
  --text: #f4f5f8;
  --muted: #989eac;
  --muted-strong: #bdc1cb;
  --line: #292c35;
  --line-strong: #3a3e49;
  --blue: #4b66d8;
  --blue-hover: #5b77e7;
  --red: #e94b4b;
  --danger: #ef5d62;
  --success: #48ba7f;
  --radius: 12px;
  --content: 1180px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  min-width: 320px;
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea { font: inherit; }

button,
a,
summary { -webkit-tap-highlight-color: transparent; }

a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 7px;
  background: white;
  color: #111319;
  transform: translateY(-170%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  width: min(100% - 40px, 1500px);
  min-height: 78px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  width: 58px;
  height: 58px;
  max-width: 58px;
  max-height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  text-decoration: none;
}

.head-logo,
.head-logo img {
  width: 56px;
  height: 56px;
  max-width: 56px;
  max-height: 56px;
  display: block;
}

.head-logo img {
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.38));
  transform-origin: 50% 70%;
}

.head-logo img.is-changing {
  animation: head-pop 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes head-pop {
  0% { transform: scale(1) rotate(0); }
  42% { transform: translateY(-5px) scale(0.88) rotate(-5deg); opacity: 0.7; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.plain-link,
.back-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.plain-link:hover,
.back-link:hover { color: white; }

.account-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: var(--blue);
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  transition: background 150ms ease, transform 150ms ease;
}

.account-button:hover {
  background: var(--blue-hover);
  transform: translateY(-1px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #63d698;
  box-shadow: 0 0 0 3px rgba(99, 214, 152, 0.15);
}

.hero {
  width: min(100% - 32px, 780px);
  margin: 0 auto;
  padding: 24px 0 72px;
  display: grid;
  justify-items: center;
  gap: 42px;
}

.hero-copy {
  max-width: 720px;
  text-align: center;
}

.hero h1,
.page-intro h1,
.error-page h1 {
  margin: 0;
  color: white;
  font-size: clamp(40px, 6vw, 62px);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.hero h1 span {
  color: var(--red);
  text-shadow: 0 0 26px rgba(233, 75, 75, 0.45);
}

.hero-lead {
  max-width: 690px;
  margin: 22px auto 0;
  color: #c4c7d0;
  font-size: 16px;
  line-height: 1.62;
}

.submission-card {
  width: min(100%, 620px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(20, 22, 28, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.idea-form,
.stack-form {
  display: grid;
  gap: 19px;
}

.idea-form label,
.stack-form label,
.delete-form label {
  display: grid;
  gap: 8px;
  color: #d8dbe2;
  font-size: 12px;
  font-weight: 720;
}

input,
textarea {
  width: 100%;
  border: 1px solid #363942;
  border-radius: 7px;
  outline: none;
  background: #24262c;
  color: white;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input {
  height: 45px;
  padding: 0 14px;
}

textarea {
  min-height: 142px;
  padding: 13px 14px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus {
  border-color: #6e84e8;
  background: #272a32;
  box-shadow: 0 0 0 3px rgba(75, 102, 216, 0.18);
}

input::placeholder,
textarea::placeholder { color: #969baa; }

label small,
.character-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.character-count {
  margin-top: -3px;
  text-align: right;
}

.identity-chip {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #202229;
  color: var(--muted-strong);
  font-size: 13px;
}

.identity-chip strong { color: white; }

.button {
  min-height: 45px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.button:hover { transform: translateY(-1px); }

.button-primary {
  background: var(--blue);
  color: white;
}

.button-primary:hover { background: var(--blue-hover); }

.button-dark {
  background: #eeeef2;
  color: #111319;
}

.button-outline {
  border-color: var(--line-strong);
  background: #171920;
  color: #e6e8ed;
}

.button-outline:hover {
  border-color: #596171;
  background: #20232b;
}

.button-full,
.submit-button { width: 100%; }

.submit-button { min-height: 47px; }

.form-note {
  margin: -6px 0 0;
  color: #858b99;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.latest-section {
  width: min(100% - 32px, var(--content));
  margin: 0 auto;
  padding: 0 0 100px;
}

.section-heading {
  margin-bottom: 27px;
  text-align: center;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.035em;
}

.section-heading p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.ideas-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.idea-card {
  min-width: 0;
  min-height: 188px;
  padding: 21px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 22, 28, 0.96);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.idea-card:hover {
  border-color: #3d4250;
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.idea-text,
.moderation-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.idea-text {
  flex: 1;
  color: #f0f1f4;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.52;
}

.idea-card footer {
  margin-top: 26px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  color: #777e8d;
  font-size: 10px;
}

.idea-card footer strong {
  color: #617ce5;
  font-size: 11px;
}

.idea-card footer time {
  flex: 0 0 auto;
  text-align: right;
}

.ideas-section-actions {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

.guest-badge,
.admin-badge,
.suspended-badge {
  display: inline-flex;
  margin-left: 7px;
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.guest-badge {
  background: #292c34;
  color: #9da3b0;
}

.admin-badge {
  background: var(--blue);
  color: white;
  vertical-align: middle;
}

.suspended-badge {
  background: rgba(239, 93, 98, 0.14);
  color: #ff8e92;
}

.empty-state {
  padding: 64px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: rgba(20, 22, 28, 0.72);
  text-align: center;
}

.empty-state > span {
  color: #7189ec;
  font-size: 28px;
}

.empty-state h2,
.empty-state h3 { margin: 16px 0 7px; }

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.flash {
  position: fixed;
  z-index: 900;
  top: 96px;
  left: 50%;
  width: min(560px, calc(100% - 32px));
  min-height: 52px;
  padding: 13px 14px 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.4);
  color: white;
  font-size: 13px;
  font-weight: 650;
  transform: translateX(-50%);
}

.flash-success { background: #196a49; }
.flash-error { background: #952e34; }

.flash-close {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  cursor: pointer;
  font-size: 18px;
}

.auth-dialog {
  width: min(460px, calc(100% - 28px));
  max-height: calc(100dvh - 30px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #15171d;
  color: var(--text);
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.58);
}

.auth-dialog::backdrop {
  background: rgba(3, 4, 7, 0.78);
  backdrop-filter: blur(4px);
}

.dialog-shell {
  position: relative;
  padding: 38px;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1c1e25;
  color: white;
  cursor: pointer;
  font-size: 19px;
}

.eyebrow {
  margin: 0 0 12px;
  color: #7f91df;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow-line {
  display: inline-block;
  width: 20px;
  height: 1px;
  margin: 0 8px 3px 0;
  background: currentColor;
}

.auth-panel h2 {
  margin: 0;
  font-size: 31px;
  letter-spacing: -0.035em;
}

.dialog-intro {
  margin: 9px 0 26px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.auth-switch {
  width: 100%;
  margin-top: 22px;
  padding: 14px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1d2027;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.auth-switch strong { color: white; }

.site-footer {
  min-height: 82px;
  padding: 0 max(20px, calc((100vw - var(--content)) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  background: rgba(8, 9, 13, 0.85);
  color: #747b89;
  font-size: 11px;
}

.inner-page {
  width: min(100% - 40px, var(--content));
  min-height: calc(100vh - 174px);
  margin: 0 auto;
  padding: 58px 0 92px;
}

.page-intro {
  max-width: 820px;
  margin-bottom: 42px;
}

.page-intro .back-link {
  display: inline-block;
  margin-bottom: 40px;
}

.page-intro h1 { font-size: clamp(42px, 6vw, 68px); }

.page-intro > p:last-child {
  margin: 17px 0 0;
  color: var(--muted);
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.8fr);
  gap: 20px;
}

.settings-card,
.admin-callout,
.logout-card,
.danger-zone,
.moderation-card,
.moderation-tabs {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(20, 22, 28, 0.96);
}

.settings-card { padding: clamp(24px, 4vw, 40px); }

.settings-heading {
  margin-bottom: 29px;
  display: flex;
  gap: 15px;
}

.settings-number {
  color: #687083;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.settings-heading h2,
.admin-callout h2,
.logout-card h2,
.danger-zone h2 {
  margin: 0;
  letter-spacing: -0.025em;
}

.settings-heading p,
.danger-zone p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.account-side {
  display: grid;
  align-content: start;
  gap: 20px;
}

.admin-callout {
  padding: 29px;
  background: #171b2a;
}

.admin-callout h2 {
  margin-bottom: 24px;
  font-size: 24px;
  line-height: 1.2;
}

.logout-card { padding: 26px 29px; }

.logout-card h2 {
  margin-bottom: 17px;
  font-size: 18px;
}

.danger-zone {
  margin-top: 20px;
  padding: 31px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 36px;
  border-color: rgba(239, 93, 98, 0.38);
}

.danger-zone > div { max-width: 720px; }

.button-danger {
  border-color: rgba(239, 93, 98, 0.7);
  color: #ff8f93;
  list-style: none;
}

.button-danger::-webkit-details-marker { display: none; }
.button-danger-solid { background: #b9383f; color: white; }

.delete-form {
  width: min(390px, 80vw);
  margin-top: 16px;
  padding: 18px;
  display: grid;
  gap: 15px;
  border: 1px solid rgba(239, 93, 98, 0.28);
  border-radius: 9px;
  background: #21181c;
}

.admin-page { width: min(100% - 40px, 1320px); }
.admin-intro { max-width: 940px; }

.moderation-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
}

.moderation-tab {
  min-height: 72px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.moderation-tab:last-child { border-right: 0; }

.moderation-tab strong {
  min-width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #252831;
  color: white;
  font-size: 10px;
}

.moderation-tab.is-active {
  background: #24315f;
  color: white;
}

.moderation-tab.is-active strong { background: var(--blue); }

.moderation-list {
  margin-top: 22px;
  display: grid;
  gap: 14px;
}

.moderation-card { padding: 25px; }

.moderation-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.moderation-card > header time {
  color: var(--muted);
  font-size: 10px;
}

.moderation-author {
  display: flex;
  align-items: center;
  gap: 11px;
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #252831;
  font-size: 13px;
  font-weight: 850;
}

.moderation-text {
  margin: 24px 0;
  color: #e9ebef;
  font-size: 17px;
  line-height: 1.55;
}

.moderation-actions {
  padding-top: 19px;
  display: grid;
  grid-template-columns: auto auto minmax(170px, 1fr) auto;
  gap: 9px;
  border-top: 1px solid var(--line);
}

.decision-accept { background: #174d36; color: #9ce0bc; }
.decision-ignore { background: #292c34; color: #c2c5ce; }
.decision-ban { background: #4a252b; color: #ff9ca0; }
.ban-reason input { height: 45px; font-size: 12px; }

.moderation-result {
  padding-top: 19px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.status-label {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.status-approved { background: #174d36; color: #9ce0bc; }
.status-ignored { background: #292c34; color: #c2c5ce; }
.status-banned { background: #4a252b; color: #ff9ca0; }
.moderation-empty { color: var(--text); }

.ideas-library { width: min(100% - 32px, var(--content)); }
.ideas-library-intro { max-width: 900px; }
.ideas-library-intro h1 { font-size: clamp(39px, 6vw, 66px); }
.all-ideas-grid { margin-top: 10px; }

.pagination {
  margin-top: 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.pagination > :last-child { justify-self: end; }
.pagination strong { color: white; }

.error-page {
  min-height: calc(100vh - 174px);
  padding: 70px 24px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.error-code {
  margin: 0 0 14px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.error-page > p:not(.error-code) {
  margin: 20px 0 26px;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid #7f96f0;
  outline-offset: 3px;
}

@media (max-width: 960px) {
  .ideas-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-grid { grid-template-columns: 1fr; }
  .account-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .moderation-actions { grid-template-columns: repeat(3, auto); }

  .ban-reason {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

@media (max-width: 680px) {
  .site-header {
    width: calc(100% - 24px);
    min-height: 78px;
  }

  .brand,
  .head-logo,
  .head-logo img {
    width: 48px;
    height: 48px;
    max-width: 48px;
    max-height: 48px;
  }

  .brand { flex-basis: 48px; }

  .desktop-link { display: none; }

  .account-button {
    min-height: 38px;
    padding: 0 13px;
  }

  .hero {
    padding: 26px 0 58px;
    gap: 32px;
  }

  .hero h1 { font-size: clamp(38px, 12vw, 52px); }
  .hero-lead { font-size: 14px; }
  .submission-card { padding: 21px; }
  .latest-section { padding-bottom: 72px; }
  .ideas-grid { grid-template-columns: 1fr; }
  .idea-card { min-height: 166px; }

  .site-footer {
    min-height: 104px;
    padding: 23px 16px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }

  .dialog-shell { padding: 34px 22px 24px; }

  .auth-switch {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .inner-page,
  .admin-page {
    width: calc(100% - 28px);
    padding: 42px 0 68px;
  }

  .page-intro .back-link { margin-bottom: 34px; }
  .account-side { grid-template-columns: 1fr; }

  .danger-zone {
    padding: 24px;
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .danger-zone details,
  .danger-zone summary { width: 100%; }

  .moderation-tabs { grid-template-columns: 1fr 1fr; }

  .moderation-tab {
    min-height: 62px;
    padding: 0 13px;
    border-bottom: 1px solid var(--line);
  }

  .moderation-tab:nth-child(2) { border-right: 0; }
  .moderation-tab:nth-child(3),
  .moderation-tab:nth-child(4) { border-bottom: 0; }

  .moderation-card { padding: 19px; }

  .moderation-card > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .moderation-actions { grid-template-columns: 1fr 1fr; }
  .moderation-actions .decision-ban { grid-column: 1 / -1; }
  .pagination { grid-template-columns: 1fr 1fr; }

  .pagination > span:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
