:root {
  --ink: #1c2b22;
  --ink-soft: #26392c;
  --paper: #f7f1e3;
  --paper-dim: #efe7d3;
  --flash: #f2c14e;
  --rose: #c97b84;
  --sage: #7c9a82;
  --text-dark: #23241f;
  --muted: #6b6a63;
  --line: #ddd2b8;
  --error: #b23b3b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 6px;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-size: 30px;
  line-height: 1.15;
  margin: 0 0 6px;
  color: var(--paper);
}

.subtitle {
  font-size: 14px;
  color: rgba(247, 241, 227, 0.65);
  margin: 0 0 24px;
}

.card {
  background: var(--paper);
  border-radius: 16px;
  padding: 20px;
  color: var(--text-dark);
}

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--text-dark);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  margin-bottom: 18px;
}

input[type="text"]:focus,
select:focus {
  outline: 2px solid var(--flash);
  outline-offset: 1px;
}

.photo-drop {
  width: 100%;
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 32px 12px;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 18px;
}

.preview-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: var(--ink);
  margin-bottom: 18px;
}

.preview-wrap img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.preview-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(28, 43, 34, 0.85);
  border: none;
  color: var(--paper);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-accent {
  background: var(--flash);
  color: var(--ink);
}

.error-text {
  color: var(--error);
  font-size: 13px;
  margin: -8px 0 14px;
}

.success {
  text-align: center;
  padding: 28px 8px;
}

.success .check {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--sage);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 26px;
  color: var(--paper);
}

.success p.small {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 16px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--rose);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px;
}

.footnote {
  text-align: center;
  font-size: 11px;
  color: rgba(247, 241, 227, 0.35);
  margin-top: 24px;
}

.progress-block {
  margin-bottom: 18px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.progress-label span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(247, 241, 227, 0.7);
}

.progress-label span:last-child {
  color: var(--flash);
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(247, 241, 227, 0.15);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--flash);
  width: 0%;
  transition: width 0.6s ease;
}

a.tab-btn {
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
}

.done-note {
  font-size: 12px;
  color: var(--rose);
  margin: -10px 0 16px;
}

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Admin ---- */

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.tabs {
  display: flex;
  gap: 4px;
  background: rgba(247, 241, 227, 0.08);
  padding: 4px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--paper);
  padding: 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--flash);
  color: var(--ink);
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.select-pill {
  background: rgba(247, 241, 227, 0.1);
  border: 1px solid rgba(247, 241, 227, 0.2);
  color: var(--paper);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
}

.icon-btn {
  background: rgba(247, 241, 227, 0.1);
  border: none;
  color: var(--paper);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.sub-card {
  background: var(--paper);
  color: var(--text-dark);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sub-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--ink);
}

.sub-card .meta {
  padding: 10px 12px;
}

.sub-card .meta .top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.badge {
  display: inline-block;
  background: var(--rose);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.sub-name {
  font-weight: 700;
  font-size: 14px;
  margin: 2px 0;
}

.sub-challenge-text {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 4px;
}

.sub-time {
  font-size: 11px;
  color: #9a9a90;
}

.delete-btn {
  border: none;
  background: none;
  color: var(--error);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.challenge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.challenge-number {
  width: 40px;
  flex-shrink: 0;
  font-weight: 800;
  color: var(--rose);
  text-align: center;
}

.challenge-row input[type="text"] {
  margin-bottom: 0;
  flex: 1;
}

.empty-state {
  text-align: center;
  padding: 60px 12px;
  color: rgba(247, 241, 227, 0.6);
  font-size: 14px;
}

.login-wrap {
  max-width: 360px;
  margin: 15vh auto 0;
  padding: 0 20px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.total-note {
  font-size: 12px;
  color: rgba(247, 241, 227, 0.55);
  margin-bottom: 14px;
}
