:root {
  --bg: #ffffff;
  --surface-light: #f6f7f8;
  --surface-dark: #171a21;
  --surface: var(--surface-light);
  --text: #1a1a1a;
  --muted: #666;
  --accent-light: #2563eb;
  --accent-dark: #6ea8ff;
  --accent: var(--accent-light);
  --border: #ddd;
  --error: #b91c1c;
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: var(--surface-dark);
  --text: #e7e9ee;
  --muted: #a3a9b7;
  --accent: var(--accent-dark);
  --border: #2d3340;
  --error: #f87171;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--body-font, Inter, system-ui, -apple-system, sans-serif);
  background: var(--bg);
  color: var(--text);
}

.site-header,
.container {
  width: min(760px, 92vw);
  margin: 0 auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.logo,
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

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

.admin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
}

.admin-button:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.theme-switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 2.5rem;
  height: 1.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.theme-switch input::after {
  content: "";
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--muted);
  position: absolute;
  left: 0.16rem;
  top: 0.15rem;
  transition: transform 0.2s ease, background 0.2s ease;
}

.theme-switch input:checked {
  background: var(--accent);
}

.theme-switch input:checked::after {
  transform: translateX(1.05rem);
  background: #fff;
}

.container { padding: 1.5rem 0 2rem; }

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

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.8rem;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.post-form {
  display: grid;
  gap: 0.65rem;
}

input, textarea, button {
  font: inherit;
  border-radius: 8px;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.65rem;
}

button {
  width: fit-content;
  border: 0;
  padding: 0.55rem 0.95rem;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.error {
  color: var(--error);
  margin-top: 0;
}

.post-content img,
.post-content iframe {
  max-width: 100%;
}


.editor-toolbar {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.editor-action {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.35rem 0.55rem;
}

.editor-action:hover {
  opacity: 0.92;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin-bottom: 0.35rem;
}

.post-content ul,
.post-content ol {
  padding-left: 1.4rem;
}

.post-content code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.08rem 0.3rem;
}


.image-upload-group {
  display: grid;
  gap: 0.55rem;
}

.upload-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 94%, var(--accent) 6%), var(--surface));
  box-shadow: 0 10px 25px color-mix(in srgb, var(--bg) 88%, #000 12%);
}

.upload-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.upload-card-header label {
  font-weight: 700;
  font-size: 1.04rem;
}

.upload-chip {
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.upload-chip.upload-chip-muted {
  color: var(--muted);
  border-color: color-mix(in srgb, var(--muted) 55%, var(--border));
  background: color-mix(in srgb, var(--muted) 14%, transparent);
}

.upload-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.upload-card input[type="file"] {
  border: 1px dashed color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 10px;
  padding: 0.55rem;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.upload-card input[type="file"]::file-selector-button {
  font: inherit;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--text);
  padding: 0.38rem 0.7rem;
  margin-right: 0.65rem;
  cursor: pointer;
}

.upload-card input[type="file"]::file-selector-button:hover {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
}

.upload-status {
  margin: 0.05rem 0 0;
}

.ql-toolbar.ql-snow {
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  background: var(--surface);
}

.quill-editor.ql-container.ql-snow {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

.quill-editor .ql-editor {
  min-height: 240px;
  color: var(--text);
}

.notice {
  color: var(--accent);
  margin-top: 0;
}

input[type="color"] {
  width: 4rem;
  padding: 0.2rem;
  height: 2.2rem;
}


.admin-post-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.8rem;
}

.admin-post-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.admin-post-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-post-actions form {
  margin: 0;
}

.button-danger {
  background: var(--error);
}


.audio-indicator {
  margin-left: 0.35rem;
  font-size: 0.95rem;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
}

.audio-attachment-group {
  display: grid;
  gap: 0.6rem;
}

.current-audio-card {
  display: grid;
  gap: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.current-audio-title {
  margin: 0;
}

.current-audio-name {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
  word-break: break-word;
}

.remove-audio-toggle {
  justify-self: start;
}

.current-audio-card audio {
  margin-bottom: 0;
}

.checkbox-inline input[type="checkbox"] {
  width: auto;
}

audio {
  width: 100%;
  margin-bottom: 1rem;
}
