:root {
  color-scheme: light;
  --ink: #172322;
  --muted: #5b6763;
  --cream: #fff8ec;
  --paper: rgba(255, 250, 240, 0.92);
  --paper-strong: rgba(255, 252, 246, 0.97);
  --teal: #124b49;
  --teal-dark: #092b2c;
  --coral: #b84b31;
  --gold: #d6a542;
  --green: #557a5a;
  --line: rgba(18, 75, 73, 0.2);
  --shadow: 0 24px 70px rgba(4, 18, 20, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-image:
    linear-gradient(180deg, rgba(9, 32, 33, 0.2), rgba(9, 32, 33, 0.52)),
    radial-gradient(circle at center, rgba(255, 244, 218, 0.38), rgba(9, 32, 33, 0.26) 42%, rgba(9, 32, 33, 0.58)),
    var(--page-bg-image);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

button,
input,
textarea {
  font: inherit;
  min-width: 0;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: inherit;
  touch-action: manipulation;
}

.page-shell {
  width: min(960px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.form-card,
.surface,
.metric-card,
.entry-card,
.empty-state {
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.form-card {
  width: min(640px, 100%);
  margin: 0 auto;
  padding: 30px;
  background: var(--paper-strong);
}

.login-card {
  max-width: 460px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--coral);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
  overflow-wrap: anywhere;
  hyphens: auto;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--teal-dark);
}

.form-card h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
  font-size: 1.35rem;
  color: var(--teal-dark);
}

.idea-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--teal-dark);
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(18, 75, 73, 0.24);
  border-radius: 8px;
  padding: 12px 13px;
  font-size: 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 130px;
}

input:focus,
textarea:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(184, 75, 49, 0.13);
}

.idea-form button,
.ghost-button {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 800;
}

.idea-form button {
  color: #fffaf2;
  background: linear-gradient(135deg, var(--teal), var(--coral));
}

.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #fffaf2;
  background: rgba(9, 43, 44, 0.5);
}

.quiet-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: #fffaf2;
  font-weight: 800;
  text-decoration: none;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}

.form-card .quiet-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--teal);
  text-shadow: none;
}

.title-block,
.topbar,
.entries-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.title-block > div,
.entries-title > div {
  min-width: 0;
}

.title-block {
  color: #fffaf2;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.42);
}

.title-block h1,
.title-block h2 {
  color: #fffaf2;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.entry-card,
.empty-state,
.surface,
.metric-card {
  background: var(--paper);
}

.entry-card {
  min-height: 168px;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.entry-meta {
  display: grid;
  gap: 4px;
}

.entry-meta strong {
  color: var(--teal-dark);
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.entry-meta span,
.theme-card span,
.metric-card span,
.empty {
  color: var(--muted);
}

.entry-card p,
.admin-entry-list p {
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 22px;
  text-align: center;
}

.empty-state p {
  margin: 0;
  color: var(--teal-dark);
  font-weight: 700;
}

.flash-stack {
  position: fixed;
  inset: 18px 18px auto auto;
  z-index: 10;
  display: grid;
  gap: 8px;
  max-width: min(380px, calc(100vw - 36px));
}

.flash {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.flash.success {
  color: #123729;
  background: #dff5dd;
}

.flash.error {
  color: #5b1615;
  background: #ffe1dc;
}

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

.metric-card {
  min-height: 120px;
  padding: 20px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.metric-card strong {
  color: var(--coral);
  font-size: 2.8rem;
  line-height: 1;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.surface {
  padding: 20px;
  overflow-x: auto;
  overflow-y: hidden;
}

.surface > * {
  min-width: 0;
}

.surface h2 {
  margin-bottom: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  overflow-wrap: anywhere;
}

th:last-child,
td:last-child {
  text-align: right;
}

.slot-list,
.keyword-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.pill,
.keyword-cloud span {
  max-width: 100%;
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--teal-dark);
  background: rgba(214, 165, 66, 0.22);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.keyword-cloud b {
  color: var(--coral);
}

.theme-list,
.admin-entry-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.theme-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 4px;
  background: rgba(255, 255, 255, 0.42);
}

.theme-card strong {
  color: var(--teal);
  overflow-wrap: anywhere;
}

.theme-card span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-entry-list article {
  border-bottom: 1px solid var(--line);
  padding: 13px 0;
  display: grid;
  gap: 8px;
}

.admin-entry-list article:last-child {
  border-bottom: 0;
}

.admin-entry-list div {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--teal-dark);
  min-width: 0;
}

.admin-entry-list span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.admin-entry-list strong {
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  body {
    background-attachment: scroll;
    background-position: center top;
  }

  .page-shell {
    width: min(100% - 22px, 960px);
    padding: 28px 0;
    justify-content: flex-start;
  }

  .form-card {
    padding: 22px;
  }

  .form-card h1 {
    font-size: clamp(1.85rem, 8vw, 2.35rem);
  }

  .title-block,
  .topbar,
  .entries-title {
    align-items: flex-start;
  }

  .metric-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-entry-list div {
    display: grid;
  }
}

@media (max-width: 430px) {
  .page-shell {
    width: min(100% - 20px, 960px);
    padding: 20px 0 28px;
    gap: 18px;
  }

  .form-card {
    padding: 18px;
  }

  .idea-form {
    gap: 14px;
    margin-top: 20px;
  }

  textarea {
    min-height: 116px;
  }

  .flash-stack {
    inset: 11px 11px auto 11px;
    max-width: none;
  }

  .entry-card,
  .empty-state,
  .surface,
  .metric-card {
    box-shadow: 0 18px 48px rgba(4, 18, 20, 0.32);
  }
}

@supports (min-height: 100dvh) {
  body,
  .page-shell {
    min-height: 100dvh;
  }
}
