:root {
  --ink: #17181d;
  --muted: #6f7480;
  --line: #e4e7ec;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --brand: #d81f2a;
  --brand-dark: #9f1821;
  --gold: #c8962f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(200,150,47,.12), transparent 28%),
    linear-gradient(180deg, #fafbfc 0%, #f3f5f8 100%);
}
a { color: inherit; text-decoration: none; }
.breaks-table-title-link {
  text-decoration: underline;
  text-underline-offset: 3px;
}
img { display: block; max-width: 100%; }
h1, h2, h3, p, td, th, span, a, strong, dd, dt {
  overflow-wrap: anywhere;
}
main {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
  overflow-x: clip;
}
.site-footer {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 32px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}
.site-footer a {
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  color: #fff;
  background:
    radial-gradient(circle at 20% 20%, rgba(200,150,47,.22), transparent 40px),
    linear-gradient(135deg, #07080c 0%, #14161d 58%, #2b1119 100%);
  border-bottom: 3px solid var(--brand);
  position: sticky;
  top: 0;
  z-index: 10;
  overflow: hidden;
  isolation: isolate;
}
.site-header > :not(.navbar-stars) {
  position: relative;
  z-index: 2;
}
.navbar-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.navbar-star {
  position: absolute;
  left: var(--star-x);
  top: var(--star-y);
  width: var(--star-size);
  height: var(--star-size);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(255,255,255,.95), 0 0 9px rgba(255,255,255,.5);
  opacity: .18;
  animation: navbar-star-twinkle var(--star-duration) ease-in-out var(--star-delay) infinite;
}
.navbar-star.gold {
  background: #ffd878;
  box-shadow: 0 0 5px rgba(255,216,120,.95), 0 0 10px rgba(200,150,47,.65);
}
.navbar-star.red {
  background: #ff8f98;
  box-shadow: 0 0 5px rgba(255,143,152,.9), 0 0 10px rgba(216,31,42,.55);
}
@keyframes navbar-star-twinkle {
  0%, 100% { opacity: .12; transform: scale(.65); }
  38% { opacity: var(--star-opacity); transform: scale(1.35); }
  56% { opacity: .28; transform: scale(.85); }
  76% { opacity: .55; transform: scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .navbar-star {
    animation: none;
    opacity: .5;
  }
}
.brand img {
  height: 60px;
  width: auto;
}
.site-header nav {
  display: flex;
  gap: 14px;
  flex: 1;
  flex-wrap: wrap;
}
.site-header nav a,
.member-links,
.member-links a,
.link-button {
  color: #fff;
  font-size: 14px;
}
.member-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.member-chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}
.hero,
.panel,
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(18,24,34,.05);
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr);
  gap: 24px;
  padding: 36px;
  color: #fff;
  background: linear-gradient(135deg, rgba(7,8,12,.98), rgba(23,24,31,.98));
}
.hero-side {
  display: grid;
  gap: 12px;
}
.metric {
  padding: 16px;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.metric strong {
  display: block;
  font-size: 20px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}
.button,
button {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  padding: 12px 18px;
  cursor: pointer;
  margin-top: 8px;
}
.button.secondary,
.button.small.secondary {
  background: #1f2530;
}
.button.small,
button.small {
  padding: 8px 12px;
  font-size: 13px;
}
.button.danger { background: #87141c; }
.button:disabled,
button:disabled {
  background: #9ca3af;
  color: #f3f4f6;
  cursor: not-allowed;
  opacity: .8;
}
.site-header .button,
.site-header button,
.member-links .button,
.member-links button,
.actions .button,
.actions button,
.admin-actions .button,
.admin-actions button,
.inline-form .button,
.inline-form button,
.oauth-actions .button,
.oauth-actions button {
  margin-top: 0;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f7e8ea;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin: 28px 0 14px;
}
.card-grid,
.rules-grid,
.admin-nav-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.card { overflow: hidden; }
.card > img,
.panel.mini > img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  width: 100%;
}
.card-body,
.panel,
.panel.mini {
  padding: 18px;
}
.nav-card,
.shop-card,
.panel.mini {
  min-width: 0;
}
.progress {
  height: 8px;
  border-radius: 999px;
  background: #ebeef3;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--gold));
}
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .8fr);
  gap: 24px;
}
.detail-media,
.detail-copy {
  display: grid;
  gap: 16px;
}
.cover {
  border-radius: 14px;
  border: 1px solid var(--line);
}
.thumbs,
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.thumbs img,
.gallery-grid img {
  border-radius: 10px;
  border: 1px solid var(--line);
  aspect-ratio: 1;
  object-fit: cover;
}
.specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.specs div {
  padding: 14px;
  border-radius: 12px;
  background: #f7f8fa;
  border: 1px solid var(--line);
}
.auth-shell {
  display: flex;
  justify-content: center;
}
.auth-card { width: min(560px, 100%); }
.oauth-actions,
.stack-form,
.reserve-form { display: grid; gap: 12px; }
.auth-card .oauth-actions {
  margin-top: 20px;
}
.auth-card .button,
.auth-card .button.secondary,
.reserve-form .button,
.stack-form .button {
  width: 100%;
}
.shop-card .shop-description {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.shop-card .shop-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.shop-card .shop-price {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}
.order-items {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}
.order-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f8fa;
}
.order-item span {
  color: var(--muted);
  font-size: 13px;
}
.admin-orders-list-panel {
  overflow-x: auto;
}
.admin-orders-table {
  min-width: 980px;
}
.admin-order-items {
  display: grid;
  min-width: 220px;
}
.admin-order-item-line {
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.admin-order-item-line:last-child {
  border-bottom: 0;
}
.admin-order-item-line strong,
.admin-order-item-line span {
  display: block;
}
.admin-order-item-line span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.admin-order-review-form {
  display: grid;
  grid-template-columns: 100px minmax(160px, 1fr) auto;
  align-items: end;
  gap: 8px;
  min-width: 360px;
}
.admin-order-review-form label {
  gap: 4px;
  font-size: 12px;
}
.admin-order-review-form select {
  width: 100px;
  align-self: end;
}
.admin-order-review-form textarea {
  min-height: 44px;
  padding: 8px 10px;
}
.shipment-list-panel {
  overflow-x: auto;
}
.shipment-records-table {
  min-width: 1050px;
}
.shipment-batch-items {
  display: grid;
  gap: 5px;
  min-width: 220px;
}
.shipment-status-form {
  display: grid;
  grid-template-columns: 110px minmax(160px, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 390px;
}
.shipment-status-form select {
  width: 110px;
}
.shipment-status-form input {
  min-width: 0;
}
.account-orders-toggle {
  margin-top: 18px;
}
.account-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.account-tabs a {
  padding: 10px 18px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 800;
}
.account-tabs a.active {
  border-bottom-color: var(--brand);
  color: var(--ink);
}
.account-profile-sections {
  display: grid;
  gap: 18px;
}
.account-profile-sections h2 {
  margin-top: 0;
}
.account-profile-form input:disabled {
  background: #eef0f3;
  color: var(--muted);
  cursor: not-allowed;
}
.account-profile-sections .text-link {
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.account-orders-toggle summary {
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}
.account-orders-toggle[open] summary {
  margin-bottom: 14px;
}
.account-order-slots {
  margin: 8px 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
}
.account-payment-title-link {
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.account-payment-detail {
  scroll-margin-top: 110px;
}
.account-payment-detail-head {
  margin-bottom: 12px;
}
.account-payment-detail-head p {
  margin: 4px 0 0;
  color: var(--muted);
}
.account-payment-reports {
  margin-top: 10px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }
label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}
input,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d8dde6;
  background: #fff;
  color: var(--ink);
}

select {
  width: 100px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d8dde6;
  background: #fff;
  color: var(--ink);
}
.reservation-slot-list {
  display: grid;
  gap: 0;
}
.reservation-slot-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.reservation-slot-row:nth-child(odd),
tbody tr:nth-child(odd),
.order-item:nth-child(odd),
.ship-check:nth-child(odd) {
  background: #fff;
}
.reservation-slot-row:nth-child(even),
tbody tr:nth-child(even),
.order-item:nth-child(even),
.ship-check:nth-child(even) {
  background: #f3f4f6;
}
.reservation-slot-row:last-child {
  border-bottom: 0;
}
.reservation-slot-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}
.reservation-slot-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.reservation-slot-name span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.reservation-slot-name strong {
  overflow-wrap: anywhere;
}
.reservation-detail-field {
  min-width: 0;
}
.reservation-detail-field span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.reservation-detail-field strong {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 500;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-actions form,
.admin-actions a {
  max-width: 100%;
}
.checklist {
  display: grid;
  gap: 10px;
}
.ship-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
}
.ship-check span {
  line-height: 1.5;
}
.empty {
  color: var(--muted);
}
.notice {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 700;
}
.notice.error {
  background: #ffe8e8;
  color: #7e1f24;
}
.notice.success {
  background: #e5f7ec;
  color: #1c5b34;
}
.inline-form { display: inline; }
.link-button {
  background: transparent;
  padding: 0;
}
@media (max-width: 960px) {
  .hero,
  .detail-layout,
  .card-grid,
  .rules-grid,
  .admin-nav-grid,
  .specs,
  .form-grid,
  .thumbs,
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  main {
    width: min(100%, calc(100% - 20px));
    padding: 18px 0 32px;
  }
  .site-header {
    flex-wrap: wrap;
    gap: 14px;
    padding: 12px 16px;
  }
  .site-header nav,
  .member-links {
    width: 100%;
  }
  .site-header nav {
    gap: 10px;
  }
  .site-header nav a,
  .member-links a,
  .member-chip {
    font-size: 13px;
  }
  .site-header nav a,
  .member-links a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }
  .brand img {
    height: 48px;
  }
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }
  .panel,
  .panel.mini,
  .card-body {
    padding: 14px;
  }
  .actions {
    gap: 8px;
  }
  .actions .button,
  .actions form,
  .actions a {
    width: 100%;
  }
  .actions .button,
  .actions button {
    width: 100%;
  }
  .member-chip {
    width: auto;
    border-radius: 12px;
  }
  .member-links {
    flex-wrap: nowrap;
  }
  .member-links .member-chip {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .member-links .inline-form {
    display: block;
    flex: 0 0 auto;
  }
  .member-links .link-button {
    white-space: nowrap;
  }
  .account-tabs a {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 6px;
    text-align: center;
    white-space: nowrap;
  }
  .member-account-tabs {
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .member-account-tabs a {
    flex: 0 0 auto;
    padding-inline: 12px;
  }
  .shop-card .shop-description {
    display: none;
  }
  .shop-card .shop-teaser {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .shop-card .stack-form {
    gap: 8px;
  }
  .shop-card input,
  .shop-card button {
    padding: 10px 12px;
  }
  .auth-card,
  .detail-copy,
  .detail-media {
    min-width: 0;
  }
  .reserve-form input,
  .stack-form input,
  .stack-form select,
  .stack-form textarea,
  .form-grid input,
  .form-grid select,
  .form-grid textarea {
    font-size: 16px;
  }
  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }
  thead {
    display: none;
  }
  tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  td {
    border: 0;
    padding: 8px 0;
  }
  td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  .breaks-list-panel {
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .admin-orders-list-panel {
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .admin-orders-table {
    min-width: 0;
  }
  .admin-orders-table tbody tr {
    padding: 12px 10px;
  }
  .admin-orders-table tbody td {
    padding: 6px 0;
  }
  .admin-order-items {
    min-width: 0;
  }
  .admin-order-review-form {
    grid-template-columns: 100px minmax(0, 1fr) auto;
    min-width: 0;
  }
  .shipment-list-panel {
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .shipment-records-table {
    min-width: 0;
  }
  .shipment-status-form {
    grid-template-columns: 100px minmax(0, 1fr) auto;
    min-width: 0;
  }
  .shipment-status-form input,
  .shipment-status-form select {
    font-size: 16px;
  }
  .admin-breaks-table tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 8px;
    padding: 12px 10px;
  }
  .admin-breaks-table tbody td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
  }
  .admin-breaks-table tbody td[data-label="團名"] {
    grid-column: 1 / -1;
    grid-row: 1;
    font-size: 15px;
    font-weight: 800;
  }
  .admin-breaks-table tbody td[data-label="團名"]::before {
    display: none;
  }
  .admin-breaks-table tbody td[data-label="團號"],
  .admin-breaks-table tbody td[data-label="已售 / 總位"],
  .admin-breaks-table tbody td[data-label="每張價格"] {
    grid-row: 2;
    white-space: nowrap;
  }
  .admin-breaks-table tbody td[data-label="團號"] {
    grid-column: 1;
  }
  .admin-breaks-table tbody td[data-label="已售 / 總位"] {
    grid-column: 2;
  }
  .admin-breaks-table tbody td[data-label="每張價格"] {
    grid-column: 3;
  }
  .admin-breaks-table tbody td[colspan] {
    grid-column: 1 / -1;
  }
  .admin-breaks-table tbody td[data-label="狀態"] {
    grid-column: 1 / 3;
    grid-row: 3;
  }
  .admin-breaks-table tbody td[data-label="操作"] {
    grid-column: 3;
    grid-row: 3;
    align-self: end;
  }
  .admin-breaks-table tbody td[data-label="操作"]::before {
    display: none;
  }
  .admin-breaks-table .status-inline-form,
  .admin-breaks-table .admin-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .admin-breaks-table .status-inline-form select {
    width: 100px;
    min-width: 100px;
  }
  .admin-breaks-table .status-inline-form button,
  .admin-breaks-table .admin-actions .button,
  .admin-breaks-table .admin-actions button,
  .admin-breaks-table .admin-actions .inline-form {
    width: auto;
    flex: 0 0 auto;
  }
  .admin-breaks-table .status-inline-form button,
  .admin-breaks-table .admin-actions .button,
  .admin-breaks-table .admin-actions button {
    padding-inline: 10px;
  }
  .admin-breaks-table .admin-actions .inline-form {
    display: inline-flex;
  }
  .reservation-slot-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 10px 0;
  }
  .reservation-slot-column {
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 10px;
    min-width: 0;
  }
  .reservation-detail-field span {
    margin-bottom: 1px;
    font-size: 11px;
  }
  .reservation-detail-field strong {
    font-size: 13px;
  }
  .admin-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-actions .inline-form,
  .admin-actions a,
  .admin-actions button,
  .admin-actions select {
    width: 100%;
  }
  .admin-actions .inline-form {
    display: block;
  }
  .specs div {
    padding: 12px;
  }
  .checklist {
    gap: 14px;
  }
  .ship-check {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafbfc;
  }
}
