:root {
  color-scheme: light;
  --fg: #1b1b1f;
  --muted: #6b6b75;
  --border: #dcdce2;
  --bg: #ffffff;
  --surface: #ffffff;
  --accent: #2a5db0;
  --pin-bg: #fff7e0;
  --pin-border: #e8cf8a;
  --button-bg: #f2f2f5;
  --primary-fg: #ffffff;
  --error: #b3261e;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --fg: #f1f1f4;
  --muted: #aaaab4;
  --border: #414149;
  --bg: #1b1b1f;
  --surface: #242429;
  --accent: #8cb4f5;
  --pin-bg: #3c3422;
  --pin-border: #796b43;
  --button-bg: #2d2d33;
  --primary-fg: #16161a;
  --error: #ffb4ac;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 64px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 16px;
}

.site-header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  margin: 0;
}

.brand-mark {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.notice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notice-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface);
}

.notice-card.pinned {
  background: var(--pin-bg);
  border-color: var(--pin-border);
}

.notice-card h2 {
  font-size: 1.05rem;
  margin: 0 0 8px;
}

.notice-body {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 8px;
}

.notice-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 32px 0;
}

.admin-panel {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.admin-panel form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-panel input[type="text"],
.admin-panel input[type="password"],
.admin-panel textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font: inherit;
  width: 100%;
}

.admin-panel textarea {
  min-height: 220px;
  resize: vertical;
}

.admin-panel input,
.admin-panel textarea {
  background: var(--surface);
  color: var(--fg);
}

.admin-panel label {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--button-bg);
  color: var(--fg);
  padding: 8px 12px;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--primary-fg);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  font-size: 17px;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--fg);
  background: var(--button-bg);
}

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

.site-footer {
  margin-top: 32px;
  text-align: center;
}

.admin-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 6px;
}

.form-error {
  color: var(--error);
  font-size: 0.85rem;
  min-height: 1.1em;
}

@media (max-width: 360px) {
  .site-header { gap: 8px; }
  .site-header h1 { font-size: 1.1rem; white-space: nowrap; }
  .brand-mark { width: 34px; height: 34px; }
  .theme-toggle { flex-basis: 36px; width: 36px; height: 36px; }
}
