:root {
  --bg: #14151a;
  --surface: #1c1e26;
  --text: #e8e6e3;
  --muted: #9a9aa5;
  --flag-blue: #5bcefa;
  --flag-pink: #f5a9b8;
  --flag-white: #ffffff;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --glow-blue: 0 0 24px rgba(91, 206, 250, 0.18);
  --glow-pink: 0 0 24px rgba(245, 169, 184, 0.18);
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", "Berkeley Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  line-height: 1.6;
}

a {
  color: var(--flag-blue);
  text-decoration: none;
}
a:hover {
  color: var(--flag-pink);
  text-decoration: underline;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  font-weight: 700;
  color: var(--flag-white);
  letter-spacing: 0.02em;
}
.brand:hover {
  color: var(--flag-pink);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.intro {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--glow-blue);
}
.intro h1 {
  margin-top: 0;
}

.name-bethy a {
  color: var(--flag-pink);
  font-weight: 700;
}
.name-thorn a {
  color: var(--flag-blue);
  font-weight: 700;
}

.btc-address {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--glow-pink);
  word-break: break-all;
}

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem;
}

h1 {
  color: var(--flag-white);
}

.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--glow-blue);
  list-style: none;
  transition: box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: var(--glow-pink);
}

.work-list,
.essay-list {
  padding: 0;
  margin: 1rem 0;
}

.tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: rgba(91, 206, 250, 0.15);
  color: var(--flag-blue);
  font-size: 0.8rem;
}

.year,
.byline,
.meta,
.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.work-suggestions-list {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
}

.work-suggestion {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}
.work-suggestion:hover,
.work-suggestion:focus {
  box-shadow: var(--glow-blue);
  outline: none;
}

.essay-form,
.withdraw-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
}

input,
textarea,
select,
button {
  font-family: inherit;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--flag-blue);
  box-shadow: var(--glow-blue);
}

button {
  cursor: pointer;
  background: linear-gradient(135deg, rgba(91, 206, 250, 0.25), rgba(245, 169, 184, 0.25));
  border-color: rgba(255, 255, 255, 0.12);
  font-weight: 600;
}
button:hover {
  box-shadow: var(--glow-pink);
}
button.danger {
  background: rgba(245, 169, 184, 0.12);
}

.honeypot {
  position: absolute;
  left: -9999px;
}

/* Write/Preview editor tabs - pure CSS (radio + sibling selectors), no JS.
   The preview pane's content comes from the server (see POST /preview);
   this block only controls which pane is visible. */
.editor-tabs {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.tab-radio {
  display: none;
}

.tab-labels {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.5rem 0;
  background: var(--surface);
}

.tab-labels label {
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--muted);
}

#tab-write:checked ~ .tab-labels label[for="tab-write"],
#tab-preview:checked ~ .tab-labels label[for="tab-preview"] {
  background: var(--bg);
  color: var(--flag-white);
}

.tab-panes {
  background: var(--bg);
}

.tab-pane {
  display: none;
  padding: 1rem;
  min-height: 16rem;
}

#tab-write:checked ~ .tab-panes .write-pane,
#tab-preview:checked ~ .tab-panes .preview-pane {
  display: block;
}

.tab-pane textarea {
  width: 100%;
  border: none;
  padding: 0;
  min-height: 16rem;
}
.tab-pane textarea:focus {
  box-shadow: none;
}

.images-section {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius-md);
}
.images-section h2 {
  margin-top: 0;
  font-size: 1.05rem;
  color: var(--flag-white);
}

.image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}
.image-list:empty {
  display: none;
}

.uploaded-image {
  margin: 0;
  width: 9rem;
}
.uploaded-image img {
  display: block;
  width: 100%;
  height: 6rem;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: var(--glow-blue);
}
.uploaded-image figcaption {
  margin-top: 0.35rem;
}
.uploaded-image input {
  width: 100%;
  padding: 0.3rem 0.4rem;
  font-size: 0.75rem;
}

.image-upload-form {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0;
}
.image-upload-form label {
  flex: 1;
  min-width: 14rem;
}

.essay-body {
  margin-top: 1.5rem;
}
.essay-body :first-child {
  margin-top: 0;
}

.edit-link {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--glow-pink);
  word-break: break-all;
}

.error {
  color: var(--flag-pink);
}
.notice {
  color: var(--flag-blue);
}
.empty {
  color: var(--muted);
}

.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .site-header {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
  }
  main {
    padding: 1.25rem;
  }
  .site-footer {
    padding: 1.5rem 1rem;
  }
  .tab-labels label {
    padding: 0.5rem 0.75rem;
  }
  .tab-pane,
  .tab-pane textarea {
    min-height: 12rem;
  }
}
