:root {
  --bg: #f3f1ec;
  --panel: #fffefa;
  --ink: #1d2320;
  --muted: #65716d;
  --line: #d9d5cb;
  --accent: #1f6f64;
  --accent-dark: #18564e;
  --accent-soft: #dff1ee;
  --danger-bg: #fff0ea;
  --danger: #a33a1f;
  --code-bg: #151a1d;
  --code-ink: #e8f0ee;
  --shadow: 0 18px 60px rgba(31, 36, 33, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 111, 100, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(181, 78, 47, 0.08), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

.page-shell,
.admin-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.center-shell,
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.hero,
.thanks-panel,
.login-panel,
.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 34px;
  margin-bottom: 20px;
}

.thanks-panel,
.login-panel,
.empty-state {
  width: min(520px, 100%);
  padding: 32px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.lead {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.alert {
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 1px solid #f2c9b8;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
}

.alert.compact {
  margin-bottom: 16px;
}

.alert.success {
  border-color: #b9ddd4;
  background: #ecf8f5;
  color: var(--accent-dark);
}

.submission-form {
  display: grid;
  gap: 18px;
}

.form-section {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.86);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

label.wide {
  grid-column: span 2;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c7c2b7;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  min-height: 46px;
  padding: 10px 12px;
}

input:focus,
textarea:focus,
.code-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(31, 111, 100, 0.14);
}

.variant-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 12px;
}

.variant-option {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid #c7c2b7;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.variant-option input {
  width: 18px;
  min-height: 18px;
  margin: 0 10px 0 0;
  accent-color: var(--accent);
}

.variant-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.code-editor {
  position: relative;
  min-height: 260px;
  border: 1px solid #273135;
  border-radius: 8px;
  overflow: hidden;
  background: var(--code-bg);
}

.code-editor pre,
.code-editor textarea {
  margin: 0;
  padding: 18px;
  min-height: 260px;
  white-space: pre-wrap;
  overflow: auto;
  font: 15px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  tab-size: 4;
}

.code-editor pre {
  pointer-events: none;
  color: var(--code-ink);
}

.code-editor textarea {
  position: absolute;
  inset: 0;
  resize: vertical;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  caret-color: #ffffff;
}

.code-editor textarea::selection {
  background: rgba(125, 217, 201, 0.32);
  color: transparent;
}

.tok-keyword {
  color: #7dd9c9;
  font-weight: 700;
}

.tok-string {
  color: #f2c078;
}

.tok-comment {
  color: #84928f;
  font-style: italic;
}

.tok-number {
  color: #9fc5ff;
}

.actions {
  display: flex;
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.ghost-button,
.copy-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 7px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  min-width: 150px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.primary-button.full {
  width: 100%;
}

.secondary-button {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.copy-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #405056;
  background: #243036;
  color: #e9f3f0;
  font-size: 13px;
}

.danger-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #d8a698;
  background: #fff5f1;
  color: var(--danger);
  font-size: 13px;
}

.danger-button:hover {
  background: #ffe8df;
}

.login-panel {
  display: grid;
  gap: 16px;
}

.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-header h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 48px);
}

.admin-count {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 14px 0 0;
  padding: 0 12px;
  border: 1px solid #b9ddd4;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.variant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
}

.variant-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 254, 250, 0.9);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.variant-tab span {
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ece8df;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.variant-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.variant-tab.active span {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.variant-tab.utility {
  margin-left: auto;
}

.submissions-list {
  display: grid;
  gap: 18px;
}

.submission-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.9);
}

.submission-card.checked {
  border-color: #c8ddd8;
  background: rgba(247, 252, 250, 0.9);
}

.submission-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.submission-meta h2 {
  margin-bottom: 6px;
  font-size: 21px;
}

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

.submission-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.check-form {
  margin: 0;
}

.check-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #c7c2b7;
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.check-button.checked {
  border-color: #b9ddd4;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.check-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.check-box {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
}

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

.admin-code-block {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #273135;
  border-radius: 8px;
  background: var(--code-bg);
}

.code-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #273135;
  color: #e9f3f0;
}

.admin-code-block pre {
  min-height: 170px;
  max-height: 380px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: var(--code-ink);
  font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre;
}

.admin-code-block pre.empty-code {
  color: #84928f;
  font-style: italic;
}

@media (max-width: 760px) {
  .page-shell,
  .admin-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 20px;
  }

  .hero,
  .form-section,
  .admin-header,
  .submission-card {
    padding: 18px;
  }

  .field-grid,
  .variant-group,
  .code-pair {
    grid-template-columns: 1fr;
  }

  label.wide {
    grid-column: auto;
  }

  .admin-header,
  .submission-meta {
    display: grid;
  }

  .admin-actions {
    justify-content: stretch;
  }

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

  .variant-tab.utility {
    margin-left: 0;
  }

  .admin-actions > *,
  .secondary-button,
  .ghost-button,
  .submission-tools,
  .submission-tools form,
  .danger-button {
    width: 100%;
  }

  .submission-tools {
    justify-content: stretch;
  }
}
