* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f6f6f6;
  color: #222;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

.site-container,
.admin-container {
  width: min(100% - 32px, 960px);
  margin: 0 auto;
}

.site-header,
.site-footer,
.admin-header {
  padding: 28px 0;
}

.site-header {
  border-bottom: 1px solid #ddd;
}

.site-header h1 {
  margin: 0;
}

.site-title {
  display: inline-block;
  font-size: 2rem;
  font-weight: bold;
  text-decoration: none;
}

.site-header p {
  margin: 6px 0 0;
  color: #666;
}

.site-main,
.admin-main {
  padding: 28px 0;
}

.post-card,
.single-post,
.admin-card {
  margin: 0 0 24px;
  padding: 24px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.post-card h2,
.single-post h1,
.admin-card h1 {
  margin-top: 0;
}

.post-card h2 a {
  text-decoration: none;
}

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

.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #eee;
  color: #666;
  font-size: .9rem;
}

.button,
button {
  display: inline-block;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  background: #222;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 28px;
}

.pagination a,
.pagination .current {
  min-width: 38px;
  padding: 7px 10px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 6px;
  text-decoration: none;
  background: #fff;
}

.pagination .current {
  background: #222;
  color: #fff;
  border-color: #222;
}

.pagination .ellipsis {
  min-width: 24px;
  padding: 7px 0;
  text-align: center;
  color: #777;
}

.site-footer {
  border-top: 1px solid #ddd;
  color: #666;
  font-size: .9rem;
}

.site-footer .copyright {
  margin-top: 12px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #ddd;
}

.admin-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.admin-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.admin-title-row h1 {
  margin: 0;
}

.admin-card-small {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

label {
  display: block;
  margin-bottom: 18px;
  font-weight: bold;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #bbb;
  border-radius: 6px;
  background: #fff;
  color: #222;
  font: inherit;
}

textarea {
  resize: vertical;
}

.checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 20px;
}

.checkboxes label {
  margin: 0;
  font-weight: normal;
}

.form-actions,
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.actions form {
  margin: 0;
}

.link-button {
  padding: 0;
  background: none;
  color: inherit;
  text-decoration: underline;
}

.link-button.danger {
  color: #a00000;
}

.notice {
  margin: 18px 0;
  padding: 12px 14px;
  border-radius: 6px;
  background: #e8f5e9;
}

.notice-error {
  background: #fdeaea;
}

.back-link {
  margin-top: 28px;
}

@media (max-width: 640px) {
  .site-container,
  .admin-container {
    width: min(100% - 20px, 960px);
  }

  .site-title {
    font-size: 1.6rem;
  }

  .post-card,
  .single-post,
  .admin-card {
    padding: 18px;
  }

  .post-footer,
  .admin-header,
  .admin-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
