:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --surface-variant: #f1f3f4;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-tertiary: #80868b;
  --border: #dadce0;
  --primary: #1a73e8;
  --primary-container: #e8f0fe;
  --primary-hover: #1557b0;
  --danger: #ea4335;
  --danger-hover: #c5221f;
  --success: #34a853;
  --warning: #fbbc04;
  --radius: 24px;
  --radius-btn: 24px;
  --radius-input: 8px;
  --radius-card: 16px;
  --radius-tag: 16px;
  --elevation-1: 0 1px 2px 0 rgba(60,64,67,0.08), 0 1px 3px 1px rgba(60,64,67,0.06);
  --elevation-2: 0 1px 2px 0 rgba(60,64,67,0.08), 0 2px 6px 2px rgba(60,64,67,0.06);
  --elevation-3: 0 1px 3px 0 rgba(60,64,67,0.08), 0 4px 8px 3px rgba(60,64,67,0.06);
  --font: "Google Sans Text", "Google Sans", "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  --font-display: "Google Sans Display", "Google Sans", "Roboto", -apple-system, BlinkMacSystemFont, "Noto Sans SC", sans-serif;
  --font-mono: "Google Sans Mono", "Fira Code", "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --transition: 0.25s cubic-bezier(0.2, 0, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
}

.container { max-width: 760px; margin: 0 auto; padding: 0 28px; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}
a:hover { color: var(--primary-hover); }

/* ═════════════════════════ Header ═════════════════════════ */
header.site-header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  height: 64px;
}
header.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}
header.site-header .logo {
  font-family: var(--font-display);
  font-size: 1.35em;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  transition: color var(--transition);
}
header.site-header .logo:hover { color: var(--primary); text-decoration: none; }
header.site-header nav { display: flex; align-items: center; gap: 4px; }
header.site-header nav a {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-btn);
  transition: all var(--transition);
  letter-spacing: 0.01em;
}
header.site-header nav a:hover {
  background: var(--surface-variant);
  color: var(--primary);
  text-decoration: none;
}

/* ═════════════════════════ Main ═════════════════════════ */
main.container {
  min-height: calc(100vh - 140px);
  padding-top: 48px;
  padding-bottom: 80px;
}

/* ═════════════════════════ Footer ═════════════════════════ */
footer.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}

/* ═════════════════════════ Hero ═════════════════════════ */
.page-header { margin-bottom: 12px; }
.page-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 8px;
}
.page-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 40px;
}

/* ═════════════════════════ Post Cards ═════════════════════════ */
.post-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px 32px;
  margin-bottom: 12px;
  transition: all var(--transition);
  cursor: default;
}
.post-card:hover {
  border-color: transparent;
  box-shadow: var(--elevation-2);
}
.post-card h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 500;
  margin-bottom: 4px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.post-card h2 a { color: var(--text); transition: color var(--transition); }
.post-card h2 a:hover { color: var(--primary); text-decoration: none; }
.post-meta {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 400;
}
.draft-badge {
  background: #fef7e0;
  color: #f09d00;
  padding: 3px 12px;
  border-radius: var(--radius-tag);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.tag-badge {
  background: var(--primary-container);
  color: var(--primary);
  padding: 2px 10px;
  border-radius: var(--radius-tag);
  font-size: 0.75rem;
  font-weight: 500;
}
.post-excerpt {
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.6;
  font-size: 0.9375rem;
}
.read-more {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-btn);
  padding: 4px 12px 4px 0;
  transition: all var(--transition);
  letter-spacing: 0.01em;
}
.read-more::after {
  content: "arrow_forward";
  font-family: "Material Symbols Outlined";
  font-size: 1.1rem;
  transition: transform var(--transition);
}
.read-more:hover { padding-right: 8px; text-decoration: none; }

/* ═════════════════════════ Article ═════════════════════════ */
.post-full h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 400;
  margin-bottom: 12px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.post-full .post-meta {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.post-content {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
}
.post-content h2, .post-content h3 {
  font-family: var(--font-display);
  color: var(--text);
  margin-top: 2.25em;
  margin-bottom: 0.5em;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.post-content h2 { font-size: 1.5rem; }
.post-content h3 { font-size: 1.2rem; }
.post-content p { margin-bottom: 1.25em; }
.post-content ul, .post-content ol { margin-bottom: 1.25em; padding-left: 24px; }
.post-content li { margin-bottom: 0.5em; }
.post-content li::marker { color: var(--primary); }
.post-content blockquote {
  border-left: 4px solid var(--primary);
  margin: 1.5em 0;
  padding: 16px 24px;
  background: var(--primary-container);
  border-radius: 0 var(--radius-input) var(--radius-input) 0;
  color: var(--text-secondary);
  font-style: italic;
}
.post-content pre {
  background: #1e1e1e;
  color: #e0e0e0;
  padding: 24px 28px;
  border-radius: var(--radius-card);
  overflow-x: auto;
  margin: 1.5em 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.65;
}
.post-content :not(pre) > code {
  background: var(--surface-variant);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--text);
}
.post-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}
.post-content img {
  max-width: 100%;
  border-radius: var(--radius-card);
  margin: 1em 0;
}
.post-content strong { font-weight: 500; }
.post-content em { font-style: italic; }

.post-navigation {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.back-link {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  transition: color var(--transition);
}
.back-link:hover { color: var(--primary); }

/* ═════════════════════════ Comments ═════════════════════════ */
.comments-section {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.comments-section h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 24px;
}
.comment-form {
  margin-bottom: 32px;
}
.comment-form textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 0.9375rem;
  font-family: var(--font);
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--bg);
}
.comment-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}
.comment-form .form-row {
  display: flex;
  gap: 12px;
  margin: 12px 0;
}
.comment-form input[type="text"] {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 0.875rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--bg);
}
.comment-form input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}
.comment-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }
.comment-meta {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.comment-meta strong { color: var(--text-secondary); font-weight: 500; }
.comment-body {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
}

/* ═════════════════════════ Pagination ═════════════════════════ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  padding: 8px 0;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 20px;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-btn);
  transition: all var(--transition);
  min-width: 40px;
}
.pagination a {
  color: var(--primary);
  border: 1px solid var(--border);
}
.pagination a:hover { text-decoration: none; background: var(--primary-container); border-color: transparent; }
.page-info {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 400;
  padding: 0 8px;
}

/* ═════════════════════════ Buttons ═════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font);
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: all var(--transition);
  line-height: 1;
}
.btn:hover { text-decoration: none; background: var(--surface-variant); border-color: transparent; }
.btn:active { background: #e4e6e9; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: none;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-primary:active { background: #0d47a1; box-shadow: none; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--primary);
}
.btn-secondary:hover { background: var(--primary-container); border-color: transparent; }

.btn-danger {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--danger);
}
.btn-danger:hover { background: #fce8e6; border-color: transparent; }

.btn-sm { height: 32px; padding: 0 16px; font-size: 0.8125rem; border-radius: 20px; }

/* ═════════════════════════ Empty State ═════════════════════════ */
.empty-state {
  text-align: center;
  padding: 100px 0;
  color: var(--text-tertiary);
}
.empty-state p { margin-bottom: 24px; font-size: 1.0625rem; }
.empty-state .material-symbol { font-size: 64px; opacity: 0.25; margin-bottom: 20px; display: block; }

/* ═════════════════════════ Login ═════════════════════════ */
.login-container {
  max-width: 420px;
  margin: 120px auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 48px 40px;
  box-shadow: var(--elevation-2);
}
.login-container h1 {
  text-align: center;
  margin-bottom: 32px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.login-form .form-group { margin-bottom: 20px; }
.login-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 0.9375rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--bg);
}
.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}
.login-form .btn { width: 100%; height: 48px; font-size: 0.9375rem; margin-top: 8px; }

/* ═════════════════════════ Admin ═════════════════════════ */
.admin-page {
  background: var(--surface);
  --bg: #fff;
}

.admin-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: 64px;
  padding: 0;
}
.admin-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}
.admin-header .logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}
.admin-header .logo:hover { color: var(--primary); text-decoration: none; }
.admin-header nav { display: flex; align-items: center; gap: 0; }
.admin-header nav a,
.admin-header nav .user-info {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-btn);
  transition: all var(--transition);
}
.admin-header nav .user-info { opacity: 0.7; font-weight: 400; }
.admin-header nav a:hover {
  background: var(--surface-variant);
  color: var(--primary);
  text-decoration: none;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  gap: 16px;
}
.admin-toolbar h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* ═════════════════════════ Post Table ═════════════════════════ */
.post-list {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--elevation-1);
}
.post-list th, .post-list td {
  padding: 14px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.post-list th {
  background: var(--surface);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  height: 48px;
}
.post-list td { font-size: 0.875rem; }
.post-list tbody tr { transition: background var(--transition); }
.post-list tbody tr:last-child td { border-bottom: none; }
.post-list tbody tr:hover { background: var(--surface); }
.post-list small { color: var(--text-tertiary); font-size: 0.8125rem; display: block; margin-top: 2px; }
.post-list .actions { white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.post-list .actions form { display: inline; }

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-tag);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.badge-published { background: #e6f4ea; color: #1e8e3e; }
.badge-draft { background: #fef7e0; color: #f09d00; }

/* ═════════════════════════ Editor ═════════════════════════ */
.editor-form {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px;
  box-shadow: var(--elevation-1);
}
.editor-form .form-group { margin-bottom: 24px; }
.editor-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.editor-form input[type="text"],
.editor-form textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 0.9375rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--bg);
}
.editor-form input[type="text"]:focus,
.editor-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}
.editor-form textarea {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  resize: vertical;
  min-height: 360px;
}
.editor-form .form-hint {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9375rem !important;
  font-weight: 400 !important;
  color: var(--text);
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* ═════════════════════════ Alert ═════════════════════════ */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-input);
  margin-bottom: 24px;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
}
.alert-error { background: #fce8e6; color: #c5221f; }
.alert-success { background: #e6f4ea; color: #1e8e3e; }

/* ═════════════════════════ Responsive ═════════════════════════ */
@media (max-width: 640px) {
  .container { padding: 0 20px; }
  .page-title { font-size: 1.75rem; }
  .post-card { padding: 22px 20px; }
  .post-card h2 { font-size: 1.2rem; }
  .post-full h1 { font-size: 1.875rem; }
  .post-content { font-size: 1rem; }
  .login-container { margin: 60px auto; padding: 36px 28px; }
  .editor-form { padding: 24px 20px; }
  .post-list { font-size: 0.75rem; }
  .post-list th, .post-list td { padding: 10px 12px; }
  .post-list .actions { flex-wrap: wrap; gap: 4px; }
  .admin-toolbar { flex-direction: column; align-items: flex-start; }
  .comment-form .form-row { flex-direction: column; }
}

/* ═════════════════════════ Animations ═════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.post-card { animation: fadeUp 0.35s ease both; }
.post-card:nth-child(2) { animation-delay: 0.04s; }
.post-card:nth-child(3) { animation-delay: 0.08s; }
.post-card:nth-child(4) { animation-delay: 0.12s; }
.post-card:nth-child(5) { animation-delay: 0.16s; }
.post-card:nth-child(6) { animation-delay: 0.20s; }
