body { background: linear-gradient(180deg, #d4ece9 0%, #eef7f5 50%, #fbf1e8 100%); }
[hidden] { display: none !important; }
.muted { color: var(--ink-soft); margin: 0; }
.small { font-size: 13px; }

/* ---- 按鈕與欄位 ---- */

.ghost-button {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  color: var(--teal-deep);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}
.ghost-button:hover { background: #fff; }
.text-button {
  border: 0;
  background: none;
  padding: 4px 6px;
  border-radius: 8px;
  color: var(--teal-deep);
  font-weight: 700;
  font-size: 14px;
}
.text-button:hover { background: var(--teal-mist); }
.text-button.danger { color: var(--danger); }
.text-button.danger:hover { background: #fde6e3; }
.danger-button {
  min-height: 44px;
  padding: 0 20px;
  border: 2px solid #f1c3bd;
  border-radius: 999px;
  background: #fff;
  color: var(--danger);
  font-weight: 800;
}
.danger-button:hover { background: #fde6e3; }

.field { display: grid; gap: 6px; font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.field input {
  height: 48px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--cream);
  font-size: 16px;
  color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--teal); background: #fff; }
.form-message { margin: 0; min-height: 1.4em; font-weight: 700; font-size: 14px; }
.form-message.is-error { color: var(--danger); }
.form-message.is-ok { color: var(--success); }

/* ---- 登入 ---- */

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); padding: 32px 28px; display: grid; gap: 16px; }
.login-card h1 { margin: 0; font-size: 28px; font-weight: 900; }

/* ---- 版面 ---- */

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px 0;
}
.brand { display: grid; line-height: 1.25; }
.brand strong { font-size: 22px; font-weight: 900; color: var(--teal-deep); }
.brand span { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 18px 24px 40px; display: grid; gap: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { margin: 2px 0 0; font-size: 20px; }

/* ---- 目前梯次 ---- */

.current-card { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.current-main { display: grid; gap: 14px; min-width: 0; }
.status-chip {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}
.status-chip.is-open { background: #e5f4ec; color: #2c7a54; }
.status-chip.is-open::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse 1.6s infinite; }
.status-chip.is-closed { background: #fff3d6; color: #8a5a0b; }
.label-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.label-row h1 { margin: 0; font-size: clamp(24px, 3.4vw, 34px); font-weight: 900; overflow-wrap: anywhere; }
.label-input {
  width: min(420px, 100%);
  height: 48px;
  padding: 0 14px;
  border: 2px solid var(--teal);
  border-radius: 14px;
  font-size: 22px;
  font-weight: 800;
}
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { padding: 10px 16px; border-radius: 16px; background: var(--teal-mist); min-width: 120px; }
.stat b { display: block; font-size: 28px; line-height: 1.1; color: var(--teal-deep); }
.stat span { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.current-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.qr-box { display: grid; gap: 8px; justify-items: center; text-align: center; }
.qr-box .qr { padding: 10px; border-radius: 16px; background: #fff; border: 2px solid var(--line); }
.qr-box .qr img, .qr-box .qr canvas { display: block; width: 168px; height: 168px; }
.qr-box small { font-weight: 700; color: var(--ink-soft); overflow-wrap: anywhere; }

.start-form { display: grid; gap: 12px; padding: 16px; border-radius: var(--radius); background: var(--cream); border: 2px dashed var(--line); }
.start-form .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.start-form .field { flex: 1 1 260px; }

/* ---- 座位表 ---- */

.board-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.board-legend span { display: inline-flex; align-items: center; gap: 4px; }
.seat-board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.seat {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  gap: 2px;
  min-height: 92px;
  padding: 8px 6px;
  border: 2px dashed #e3d9cc;
  border-radius: 16px;
  background: rgba(255, 255, 255, .6);
  color: #b8ab9d;
  font-weight: 800;
}
.seat .seat-no { font-size: 13px; }
.seat .seat-animal { font-size: 26px; line-height: 1.2; }
.seat .seat-area { font-size: 11px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.seat .seat-progress { width: 100%; height: 5px; border-radius: 99px; background: var(--teal-mist); overflow: hidden; }
.seat .seat-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--coral)); }
.seat.is-taken { border: 2px solid var(--seat-color, var(--teal)); background: #fff; color: var(--ink); cursor: pointer; box-shadow: var(--shadow-soft); }
.seat.is-taken:hover { transform: translateY(-2px); }
.seat.is-done { background: linear-gradient(160deg, #fff, #fff3d6); }
.seat.is-done::after { content: "🏅"; position: absolute; top: 4px; right: 6px; font-size: 14px; }

/* ---- 梯次清單 ---- */

.session-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.session-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--cream);
  border: 2px solid transparent;
}
.session-item.is-current { border-color: var(--teal); background: #fff; }
.session-item.is-viewing { box-shadow: 0 0 0 3px var(--sun); }
.session-item strong { display: block; font-size: 16px; overflow-wrap: anywhere; }
.session-item small { color: var(--ink-soft); font-weight: 700; }
.session-item .actions { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- 修改密碼 ---- */

.password-card { padding: 18px 22px; }
.password-card summary { cursor: pointer; font-weight: 800; color: var(--teal-deep); }
.password-form { display: grid; gap: 12px; margin-top: 14px; max-width: 420px; }

/* ---- 座位詳細 ---- */

.seat-dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(380px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.seat-dialog::backdrop { background: rgba(31, 60, 62, .45); }
.seat-dialog-body { padding: 24px; display: grid; gap: 14px; }
.seat-dialog-body .who { display: flex; align-items: center; gap: 14px; }
.seat-dialog-body .who span { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; font-size: 32px; border: 4px solid #fff; box-shadow: var(--shadow-soft); }
.seat-dialog-body h3 { margin: 0; font-size: 22px; }
.seat-dialog-body dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.seat-dialog-body dt { color: var(--ink-soft); font-weight: 700; }
.seat-dialog-body dd { margin: 0; font-weight: 700; }
.seat-dialog-body .dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }

/* ---- 投影畫面 ---- */

.projector {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, #cfeae7, #fdf0e6);
  overflow: auto;
}
.projector-inner { display: grid; gap: 14px; justify-items: center; text-align: center; }
.projector-brand { margin: 0; font-size: 22px; font-weight: 900; color: var(--teal); letter-spacing: .08em; }
.projector h1 { margin: 0; font-size: clamp(32px, 5vw, 56px); font-weight: 900; }
.projector-qr { padding: 20px; border-radius: 28px; background: #fff; box-shadow: var(--shadow); }
.projector-qr img, .projector-qr canvas { display: block; width: min(44vh, 70vw); height: min(44vh, 70vw); }
.projector-url { margin: 0; font-size: clamp(22px, 3vw, 34px); font-weight: 900; color: var(--teal-deep); }
.projector-steps { margin: 0; font-size: clamp(16px, 2vw, 22px); font-weight: 700; color: var(--ink-soft); }
.projector-count { margin: 0; padding: 8px 22px; border-radius: 999px; background: var(--coral); color: #fff; font-size: clamp(18px, 2.4vw, 28px); font-weight: 900; }
.projector-close { position: fixed; top: 18px; right: 18px; width: 52px; height: 52px; border: 0; border-radius: 50%; background: #fff; font-size: 30px; box-shadow: var(--shadow-soft); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  translate: -50% 0;
  z-index: 200;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .current-card { grid-template-columns: 1fr; }
  .qr-box { justify-self: start; }
  .seat-board { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .admin-shell { padding: 14px 16px 32px; }
  .admin-top { padding: 14px 16px 0; }
  .current-card { padding: 18px 16px; }
  .seat-board { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .seat { min-height: 80px; }
  .session-item { grid-template-columns: 1fr; }
  .session-item .actions { justify-content: flex-start; }
}
