* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  background: #f7f7f5;
  color: #111111;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 16px 0 32px;
}

.logo {
  display: inline-flex;
}

.main {
  display: grid;
  gap: 24px;
}

.bi-text {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.15;
}

.bi-zh {
  display: block;
}

.bi-en {
  display: block;
  font-size: 12px;
  color: #6f7680;
}

.logo .bi-zh,
.hero .bi-zh,
.page-hero .bi-zh,
.panel h1 .bi-zh {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.logo .bi-en,
.hero .bi-en,
.page-hero .bi-en,
.panel h1 .bi-en {
  font-size: 14px;
}

.panel h2 .bi-zh {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel h2 .bi-en {
  font-size: 12px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-top: 6px;
}

.nav form {
  margin: 0;
}

.nav-link {
  color: #6f7680;
  font-size: 14px;
  transition: color 0.18s ease;
}

.nav-link:hover {
  color: #111111;
}

.flash-list {
  display: grid;
  gap: 8px;
}

.flash {
  padding: 12px 14px;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background: #ffffff;
  color: #6f7680;
  box-shadow: 0 8px 20px rgba(17, 17, 17, 0.03);
}

.hero {
  padding: 32px 0 8px;
}

.hero h1,
.page-hero h1,
.panel h1,
.panel h2 {
  margin: 0;
}

.hero-text,
.install-tip,
.page-hero p,
.panel-note,
.empty {
  margin: 0;
  max-width: 760px;
  color: #6f7680;
}

.hero-text,
.panel-note {
  margin-top: 16px;
}

.install-tip {
  margin-top: 12px;
}

.page-hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 0 0;
  text-align: center;
}

.page-hero p {
  margin: 14px auto 0;
}

.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 4px 0 8px;
}

.category-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid #e8e8e8;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #6f7680;
  font-size: 14px;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.category-item:hover {
  background: #ffffff;
  border-color: #dcdcdc;
  color: #111111;
  transform: translateY(-1px);
}

.category-item.active {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 24px 20px;
}

.card {
  background: transparent;
}

.photo-button {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #ebebe8;
  box-shadow: 0 10px 28px rgba(17, 17, 17, 0.04);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.photo-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(17, 17, 17, 0.08);
}

.photo-button img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.card-info {
  display: grid;
  gap: 4px;
  padding: 12px 4px 0;
}

.card-title {
  font-weight: 600;
  word-break: break-all;
}

.card-text {
  font-size: 13px;
  color: #6f7680;
}

.empty {
  padding: 16px 0 8px;
}

.auth-shell,
.admin-shell {
  display: grid;
  gap: 24px;
}

.auth-shell {
  max-width: 460px;
  margin: 0 auto;
  padding-top: 16px;
}

.admin-shell {
  max-width: 960px;
  margin: 0 auto;
}

.panel {
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 12px 28px rgba(17, 17, 17, 0.04);
}

.panel-note {
  margin-bottom: 24px;
}

.admin-top {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.simple-form {
  display: grid;
  gap: 16px;
}

.simple-form label {
  display: grid;
  gap: 8px;
}

.simple-form label .bi-zh {
  font-weight: 600;
  color: #111111;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.inline-form input[type="text"] {
  width: auto;
  flex: 1 1 220px;
}

input[type="text"],
input[type="password"],
input[type="file"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background: #ffffff;
  color: #111111;
}

input::placeholder {
  color: #7f858d;
}

button {
  padding: 11px 16px;
  border: 1px solid #111111;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  cursor: pointer;
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

button:hover {
  opacity: 0.92;
}

button:active {
  transform: translateY(1px);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
}

.login-panel button {
  width: 100%;
}

.inline-form select {
  min-width: 180px;
  flex: 1 1 180px;
}

.inline-form button {
  flex: 0 0 auto;
}

.danger-button {
  background: #ffffff;
  color: #111111;
  border-color: #e8e8e8;
}

.danger-button:hover {
  background: #f3f3f1;
}

.category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.category-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background: #fafaf8;
}

.category-list form {
  margin: 0;
}

.admin-list {
  display: grid;
  gap: 18px;
}

.admin-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  align-items: start;
  padding: 18px 0;
  border-top: 1px solid #e8e8e8;
}

.admin-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.admin-item img {
  width: 140px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  background: #ebebe8;
}

.admin-item-body {
  display: grid;
  gap: 12px;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 17, 17, 0.88);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-box {
  position: relative;
  max-width: min(92vw, 1200px);
  max-height: 90vh;
}

.lightbox-box img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 14px;
}

.lightbox-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #e8e8e8;
  border-radius: 999px;
  background: #ffffff;
  color: #111111;
}

@media (max-width: 860px) {
  .header,
  .admin-top,
  .admin-item {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
  }

  .admin-item img {
    width: 100%;
    max-width: 360px;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 20px 16px 40px;
  }

  .logo .bi-zh,
  .hero .bi-zh,
  .page-hero .bi-zh,
  .panel h1 .bi-zh {
    font-size: 30px;
  }

  .panel {
    padding: 20px;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 12px;
  }

  .category-bar {
    gap: 8px;
  }

  .category-item {
    padding: 8px 12px;
    font-size: 13px;
  }

  .photo-button img {
    aspect-ratio: 3 / 4;
  }
}

@media (max-width: 430px) {
  .nav {
    gap: 8px 14px;
  }

  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-form select,
  .inline-form input[type="text"],
  .inline-form button {
    width: 100%;
  }
}
