:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #e5e3de;
  --text: #1f1f1d;
  --text-muted: #6b6a65;
  --primary: #b5552f;
  --primary-dark: #9a441f;
  --accent: #2f6b56;
  --star: #d99a3c;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --max-width: 880px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 16px 64px;
}

/* ---------- Gallery layout ---------- */
.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 16px 12px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
}

.gallery-hero { margin-bottom: 18px; }
.gallery-hero h2 {
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 26px;
  margin: 0 0 6px;
}

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

.gallery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gallery-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(0,0,0,0.09);
}
.gallery-card .thumb-wrap {
  aspect-ratio: 16 / 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.gallery-card .thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.gallery-card .thumb-wrap.thumb-fallback {
  background: linear-gradient(135deg, var(--primary), var(--star), var(--accent));
}
.gallery-card .thumb-wrap.thumb-fallback img { display: none; }
.gallery-card .card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.gallery-card h3 {
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 16px;
  margin: 0;
  line-height: 1.4;
}
.gallery-card .author {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.gallery-card .visit-btn {
  margin-top: auto;
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.gallery-card .visit-btn:hover { color: var(--primary-dark); text-decoration: underline; }

.side-panel { position: sticky; top: 84px; }
.side-content .card:last-child { margin-bottom: 0; }

.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 2px 12px;
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}
.link-btn:hover { color: var(--primary-dark); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side-panel { position: static; }
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

header.top .title-block h1 {
  font-size: 16px;
  margin: 0;
}
header.top .title-block p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.lang-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.lang-toggle:hover { border-color: var(--primary); color: var(--primary); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

h2 { font-size: 18px; margin: 0 0 4px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.subtitle { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 6px;
}
input[type=text], input[type=password], input[type=url], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}
textarea { min-height: 110px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background 0.15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.type-tabs { display: flex; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.type-tab {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
}
.type-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.hidden { display: none !important; }

.notice {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin: 10px 0;
}
.notice.error { background: #fbeae5; color: var(--primary-dark); border: 1px solid #f0c3b3; }
.notice.success { background: #e8f2ec; color: var(--accent); border: 1px solid #c3ded1; }
.notice.info { background: #f0f0ee; color: var(--text-muted); border: 1px solid var(--border); }

.stars {
  display: flex;
  gap: 4px;
  font-size: 26px;
  cursor: pointer;
  user-select: none;
}
.stars .star { color: #d8d6d0; transition: color 0.1s; }
.stars .star.on { color: var(--star); }

.submission-preview .text-block {
  white-space: pre-wrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
  font-size: 14px;
}
.submission-preview a.url-block {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  word-break: break-all;
  font-size: 14px;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 2px;
}
.progress-bar > div {
  height: 100%;
  background: var(--accent);
}

.review-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.review-item.completed { opacity: 0.55; }
.review-item .badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  margin-bottom: 8px;
}

table.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.stats-table th, table.stats-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.stats-table th { color: var(--text-muted); font-weight: 600; }

.comments-list { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.comments-list div { margin-bottom: 2px; }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

@media (max-width: 640px) {
  .settings-grid { grid-template-columns: 1fr; }
  header.top { padding: 12px; }
  .wrap { padding: 16px 12px 48px; }
  .card { padding: 16px; }
}
