:root {
  --orange: #e8590c;
  --orange-dark: #c94a08;
  --blue: #1864ab;
  --bg: #fdf7f0;
  --card: #ffffff;
  --text: #2b2118;
  --muted: #7a7166;
  --border: #ecdfd0;
  --green: #2b8a3e;
  --green-bg: #ebfbee;
  --red: #c92a2a;
  --red-bg: #fff5f5;
  font-size: 17px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  background-image:
    linear-gradient(135deg, rgba(232,89,12,0.06) 25%, transparent 25%),
    linear-gradient(225deg, rgba(232,89,12,0.06) 25%, transparent 25%);
  background-size: 40px 40px;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header.topbar {
  background: var(--orange);
  color: white;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

header.topbar a {
  color: white;
  text-decoration: none;
}

header.topbar .brand {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}

header.topbar .brand::before {
  content: "🏁 ";
}

header.topbar nav a {
  margin-left: 14px;
  font-size: 0.95rem;
  opacity: 0.95;
  border-bottom: 1px solid transparent;
}

header.topbar nav a:hover { border-color: white; }

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 22px 16px 60px;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 6px;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 10px;
}

p.subtitle {
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.center-card {
  max-width: 380px;
  margin: 40px auto;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  margin-top: 14px;
  font-size: 0.95rem;
}

label:first-child { margin-top: 0; }

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: #fffefc;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
}

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

button, .btn {
  display: inline-block;
  background: var(--orange);
  color: white;
  border: none;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  margin-top: 18px;
  width: 100%;
  text-align: center;
}

button:hover, .btn:hover { background: var(--orange-dark); }

.btn.secondary {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}

.btn.secondary:hover { background: #e7f1fb; }

.btn.danger {
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
  width: auto;
  padding: 8px 12px;
  font-size: 0.85rem;
  margin: 0;
}

.error {
  background: var(--red-bg);
  color: var(--red);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.92rem;
}

.success {
  background: var(--green-bg);
  color: var(--green);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.92rem;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list li {
  margin-bottom: 10px;
}

.post-list a,
.post-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}

.post-list a .pos,
.post-row .pos {
  background: var(--orange);
  color: white;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  margin-right: 12px;
  flex-shrink: 0;
}

.post-list a .title-wrap,
.post-row .title-wrap {
  display: flex;
  align-items: center;
  flex: 1;
}

.badge {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.done { background: var(--green-bg); color: var(--green); }
.badge.pending { background: #fff3bf; color: #8a6d00; }
.badge.failed { background: var(--red-bg); color: var(--red); }
.badge.text-type { background: #e7f1fb; color: var(--blue); }
.badge.photo { background: #f3e8ff; color: #7c3aed; }
.badge.wordle { background: #fff0e6; color: var(--orange-dark); }

.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 0.95rem;
  background: #fdfbf8;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  margin: 0;
  flex: 1;
  min-width: 140px;
}

.radio-option input { width: auto; margin: 0; }

.photo-preview {
  max-width: 100%;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  margin-top: 10px;
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; }

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.stat .num { font-size: 1.6rem; font-weight: 800; color: var(--orange); }
.stat .label { font-size: 0.8rem; color: var(--muted); }

.admin-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admin-nav a {
  background: white;
  border: 1.5px solid var(--border);
  padding: 8px 14px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.admin-nav a.active, .admin-nav a:hover {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.row-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

form.inline { display: inline; margin: 0; }

.muted { color: var(--muted); font-size: 0.85rem; }

.empty-hint {
  color: var(--muted);
  font-style: italic;
  padding: 20px 0;
  text-align: center;
}

@media (max-width: 480px) {
  .admin-grid { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat { padding: 10px; }
  .stat .num { font-size: 1.2rem; }
}

/* Wordle */
.wordle-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 16px 0;
}

.wordle-row {
  display: flex;
  gap: 6px;
}

.wordle-tile {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: white;
  border-radius: 6px;
  text-transform: uppercase;
}

.wordle-tile.correct { background: #4caf50; }
.wordle-tile.present { background: #d4a017; }
.wordle-tile.absent { background: #8a8a8a; }

.wordle-form label { margin-top: 0; }

.wordle-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1.3rem;
  font-family: inherit;
  text-align: center;
  letter-spacing: 6px;
  text-transform: uppercase;
  background: #fffefc;
}

.wordle-input:focus { outline: none; border-color: var(--orange); }
