:root {
  --paper: #f4ecdf;
  --paper-2: #fffaf3;
  --ink: #2a211c;
  --muted: #6b5b52;
  --maple: #b8432f;
  --maple-deep: #8d3122;
  --leaf: #3d5a46;
  --gold: #a68455;
  --line: rgba(42, 33, 28, 0.12);
  --shadow: 0 18px 40px rgba(90, 48, 28, 0.08);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "PMingLiU", "Songti TC", serif;
  --sans: "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --radius: 18px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(184, 67, 47, 0.08), transparent 32%),
    linear-gradient(180deg, #f7f1e7 0%, var(--paper) 28%, #efe4d4 100%);
  font-family: var(--sans);
  line-height: 1.65;
  min-height: 100vh;
}
img { max-width: 100%; }
a { color: var(--maple-deep); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.25; font-weight: 600; }
p { margin: 0 0 0.8rem; }
button, input, textarea, select { font: inherit; color: inherit; }
.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: white;
  padding: 8px 12px;
  z-index: 5;
}
.skip:focus { left: 8px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(244, 236, 223, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner, .footer-inner, main, .admin-main {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  position: relative;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.25rem;
}
.nav-check { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle {
  display: none;
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.site-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.site-nav a, .linkish {
  text-decoration: none;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 999px;
}
.site-nav a.is-on, .filters a.is-on { background: #2a211c; color: #fffaf3; }
.badge {
  display: inline-block;
  min-width: 1.2em;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--maple);
  color: white;
  font-size: 0.75rem;
  text-align: center;
}
.inline-form { display: inline; }
.linkish {
  border: 0;
  background: transparent;
  cursor: pointer;
}
.danger, .linkish.danger { color: var(--maple-deep); }

.banner {
  background: var(--maple-deep);
  color: #fffaf3;
  text-align: center;
  padding: 8px 16px;
}
.banner-note { background: var(--leaf); }

main { padding: 28px 0 64px; }
.hero, .split, .detail {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: start;
}
.kicker { letter-spacing: 0.08em; color: var(--gold); font-size: 0.92rem; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); margin: 0 0 8px; }
.lead { font-size: 1.15rem; }
.about { color: var(--muted); max-width: 38rem; }
.ticket, .auth-card, .price-box, .summary, .note-block, .admin-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.ticket { padding: 22px; position: relative; transform: rotate(1.2deg); }
.stamp {
  display: inline-block;
  border: 2px solid var(--maple);
  color: var(--maple);
  border-radius: 999px;
  padding: 2px 10px;
  letter-spacing: 0.12em;
}
.actions, .wrap { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fffaf3;
  text-decoration: none;
  padding: 10px 18px;
  cursor: pointer;
}
.btn-maple { background: var(--maple); border-color: var(--maple-deep); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-small { padding: 6px 12px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 3px solid rgba(184, 67, 47, 0.45);
  outline-offset: 2px;
}

.section { margin-top: 48px; }
.section-head, .page-head { display: flex; justify-content: space-between; gap: 12px; align-items: end; }
.page-head { display: block; margin-bottom: 18px; }
.page-head h1, .section h2 { margin-bottom: 6px; }
.steps, .progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 0; list-style: none; }
.steps li, .card, .gallery figure, .cart-row {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.steps li { padding: 16px; }
.steps span { color: var(--maple); font-family: var(--serif); }
.cards, .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cards-list { grid-template-columns: 1fr; }
.card {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  padding: 10px;
}
.card img, .ph, .gallery img, .cover, .thumb, .sample-row img, .work-edit img {
  width: 100%;
  object-fit: cover;
  border-radius: 12px;
  background: #eadccb;
}
.card img, .ph { height: 140px; }
.gallery img { aspect-ratio: 4 / 5; display: block; }
.gallery button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery figure { margin: 0; overflow: hidden; }
.gallery figcaption { padding: 10px 12px 14px; }
.ph-lg { min-height: 320px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters a { text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; color: var(--ink); background: var(--paper-2); }
.empty { padding: 24px; background: var(--paper-2); border-radius: var(--radius); }
.pre { white-space: pre-wrap; }
.note-block, .summary, .price-box, .auth-card { padding: 18px; }
.note-block { margin-top: 18px; }

.detail-copy h1 { margin-top: 0; }
.price-start strong { font-size: 1.4rem; }
.options { display: grid; gap: 14px; }
.opt { border: 1px solid var(--line); border-radius: 14px; margin: 0; padding: 12px; }
.opt legend em, .muted, .opt-help { color: var(--muted); font-style: normal; font-size: 0.92rem; }
.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
}
.choice:hover { background: rgba(184, 67, 47, 0.06); }
.choice em { margin-left: auto; color: var(--maple-deep); font-style: normal; }
.stepper, .qty-line, .qty-form { display: flex; align-items: center; gap: 8px; }
.stepper button, .nowrap button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
}
input[type="number"], input[type="text"], input[type="email"], input[type="password"], input:not([type]), textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 10px 12px;
}
.qty-line input, .qty-form input, .stepper input { width: 88px; }
.price-box { position: sticky; top: 88px; }
.price-box strong { display: block; font-size: 2rem; font-family: var(--serif); }
.stack-form, .auth-card { display: grid; gap: 12px; }
.auth-card { width: min(460px, 100%); margin: 12px auto; }
label { display: grid; gap: 4px; }
.checkline { display: flex; align-items: center; gap: 8px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.form-row > label { flex: 1 1 140px; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

.cart-list { display: grid; gap: 12px; }
.cart-row { display: flex; justify-content: space-between; gap: 16px; padding: 16px; }
.cart-row.is-bad { outline: 2px solid var(--maple); }
.cart-actions { display: grid; justify-items: end; gap: 8px; min-width: 180px; }
.total-bar {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #2a211c;
  color: #fffaf3;
  border-radius: var(--radius);
}
.total-bar .btn-maple { background: #fffaf3; color: var(--maple-deep); border-color: transparent; }
.total-bar strong { font-size: 1.8rem; font-family: var(--serif); }
.message-box textarea, .message-pre {
  width: 100%;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.92rem;
}
.message-pre {
  white-space: pre-wrap;
  background: #2a211c;
  color: #fffaf3;
  padding: 16px;
  border-radius: 14px;
}
.summary li { display: flex; justify-content: space-between; gap: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--paper-2); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 8px; background: rgba(184, 67, 47, 0.12); }
.progress { grid-template-columns: repeat(6, 1fr); }
.progress li, .timeline li { background: transparent; border: 0; padding: 8px 0; }
.progress li { border-top: 4px solid var(--line); color: var(--muted); }
.progress li.is-done { border-color: var(--maple); color: var(--ink); }
.progress li.is-current { font-weight: 700; }
.timeline { list-style: none; padding: 0; }
.page-narrow { width: min(720px, 100%); }
.flash { padding: 10px 14px; border-radius: 12px; margin: 0 0 12px; }
.flash-ok { background: #e5f0e4; }
.flash-warn { background: #f8e7c8; }
.flash-bad { background: #f8d7d1; }
.lightbox { border: 0; border-radius: 18px; max-width: min(920px, 94vw); background: var(--paper-2); }
.lightbox::backdrop { background: rgba(42, 33, 28, 0.72); }
.lightbox img { max-height: 75vh; display: block; margin: 0 auto; }
.shop-tools { display: flex; gap: 8px; margin: 0 0 14px; }
.shop-tools input { flex: 1; }
.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.shop-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  color: inherit;
  text-decoration: none;
  border: 1px solid rgba(42, 33, 28, 0.08);
  border-radius: 2px;
  overflow: hidden;
}
.shop-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: #f3f3f3;
  cursor: zoom-in;
}
a.shop-card .shop-thumb { cursor: pointer; }
.shop-thumb img, .shop-thumb .ph { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0; }
.shop-meta { display: grid; gap: 4px; padding: 8px 8px 10px; }
.shop-meta em { color: var(--muted); font-style: normal; font-size: 0.75rem; }
.shop-meta strong {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.92rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}
.shop-meta b { color: #ee4d2d; font-size: 1.05rem; }
.discord-btn { background: #5865f2; border-color: #5865f2; color: white; }
.detail-page { display: flex; flex-direction: column; gap: 28px; }
.detail-article, .reading { width: min(46rem, 100%); }
.reading { margin-top: 28px; }
.ticket-summary, .shop-blurb {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 0.75rem; }
.prose h1 { font-size: 1.7rem; margin: 0.2rem 0 0.5rem; }
.prose h2 { font-size: 1.35rem; margin: 1rem 0 0.4rem; }
.prose h3, .prose h4 { font-size: 1.12rem; margin: 0.85rem 0 0.35rem; }
.prose ul, .prose ol { margin: 0 0 0.8rem 1.2rem; padding: 0; }
.prose blockquote {
  margin: 0 0 0.8rem;
  padding-left: 12px;
  border-left: 3px solid var(--maple);
  color: var(--muted);
}
.prose code { background: rgba(42, 33, 28, 0.06); padding: 0 4px; border-radius: 4px; }
.prose pre {
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  background: #2a211c;
  color: #fffaf3;
}
.prose pre code { background: none; color: inherit; padding: 0; }
.prose { overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 0.8rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose-compact p { display: inline; margin: 0; }
.prose-compact p + p::before { content: " "; }
.prose-compact ul, .prose-compact ol { display: block; margin: 0.45rem 0 0.2rem 1.15rem; }
.prose-compact h1, .prose-compact h2, .prose-compact h3 { font-size: 1rem; margin: 0.35rem 0; }
.steps .prose { font-size: 0.95rem; }
.banner .prose p { display: inline; margin: 0; }
.banner .prose p + p::before { content: " "; }
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; background: #2a211c; color: #f6efe6; }
.site-footer a { color: #f6efe6; }
.footer-inner { display: grid; gap: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px; }
.copy { color: rgba(246, 239, 230, 0.7); }

@media (min-width: 720px) {
  .shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1080px) {
  .shop-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 900px) {
  .hero, .split, .detail, .steps, .progress { grid-template-columns: 1fr; }
  .ticket { transform: none; }
  .price-box { position: sticky; bottom: 8px; }
  .cart-row, .total-bar, .section-head { display: grid; justify-items: start; }
  .cart-actions { justify-items: start; }
}
@media (max-width: 860px) {
  .header-inner { flex-wrap: wrap; padding: 10px 0; }
  .nav-toggle { display: inline-flex; }
  .site-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
  .nav-check:checked ~ .site-nav { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
