:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  color: #1c2d27;
  background: #edf4ef;
  --purple: #174f40;
  --purple-2: #9a6815;
  --line: #d4e0d8;
  --muted: #62736b;
  --gold: #d4ad4c;
  --green: #174f40;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding-bottom: 92px; }
body.completed { padding-bottom: 0; }
button, input, select { font: inherit; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: white;
  background: #1f5d4c url("assets/nz-hero-green-v1.jpg") center center / cover no-repeat;
  border-bottom: 3px solid rgba(218, 177, 73, .86);
  box-shadow: 0 10px 34px rgba(5, 45, 34, .2);
  padding: 30px 20px 28px;
}
.hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 38, 29, .12), rgba(4, 38, 29, .02) 55%, rgba(4, 38, 29, .3));
}
.hero__inner, main { width: min(1240px, 100%); margin: 0 auto; }
.hero__inner { position: relative; z-index: 1; }
.hero__top { display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
.eyebrow {
  margin: 0 0 8px; opacity: .94; font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-shadow: 0 2px 8px rgba(3, 29, 22, .72);
}
.hero__brand-picture { display: block; }
.hero__brand {
  display: block; width: min(1040px, 94%); max-height: 164px;
  margin: 22px auto 18px; object-fit: contain; object-position: center;
  filter: drop-shadow(0 5px 8px rgba(2, 25, 18, .42));
}
.hero__rules {
  flex: 0 0 auto; color: #ffe28c; font-size: 14px; font-weight: 800;
  text-decoration: underline; text-underline-offset: 4px;
  text-shadow: 0 2px 8px rgba(3, 29, 22, .72);
}
.hero-language-switch {
  display: flex; align-items: center; gap: 5px; color: rgba(255,255,255,.72);
}
.hero-language-switch button {
  min-height: 32px; border: 0; border-radius: 999px; padding: 5px 11px;
  color: white; background: transparent; font-size: 13px; font-weight: 800;
  text-shadow: 0 2px 8px rgba(3, 29, 22, .72); cursor: pointer;
}
.hero-language-switch button[aria-pressed="true"] {
  color: #174f40; background: #ffe28c; text-shadow: none;
}
h1 { margin: 0 0 8px; font-size: clamp(28px, 7vw, 44px); }
.hero h1, .hero__inner > p:last-child {
  text-align: center;
  text-shadow: 0 3px 12px rgba(3, 29, 22, .76);
}
.hero p:last-child { margin: 0; }

main { padding: 18px 16px; }
.test-banner {
  border: 2px solid #9c4a00;
  background: #fff2d8;
  color: #713500;
  border-radius: 10px;
  padding: 13px 14px;
  margin-bottom: 14px;
  font-weight: 800;
  text-align: center;
}
.notice {
  border: 1px solid var(--line);
  border-left: 4px solid var(--purple-2);
  background: white;
  border-radius: 10px;
  padding: 13px 14px;
  margin-bottom: 14px;
}
.notice[hidden] { display: none; }
.notice.error { border-left-color: #b3261e; color: #7c1e19; }
.notice.success { border-left-color: #238636; color: #176128; }
.prelaunch-schedule {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px; margin: 0 0 18px;
}
.prelaunch-schedule[hidden] { display: none; }
.prelaunch-stage {
  padding: 20px 22px; border: 1px solid #c9dacf; border-radius: 14px;
  background: white; box-shadow: 0 8px 24px rgba(17, 66, 51, .07);
}
.prelaunch-stage__label {
  margin: 0 0 7px; color: #9a690b; font-size: 14px; font-weight: 900;
  letter-spacing: .06em;
}
.prelaunch-stage h2 { margin: 0 0 12px; color: var(--purple); font-size: 20px; line-height: 1.45; }
.prelaunch-stage__time { margin: 0; color: #28483e; font-size: 16px; font-weight: 900; line-height: 1.5; }
.prelaunch-stage__quota {
  margin: 9px 0 0; color: #5a7067; font-size: 15px; font-weight: 700; line-height: 1.5;
}
.auth-actions {
  display: flex; align-items: center; gap: 10px;
  margin: -4px 0 14px; padding: 12px 14px;
  border: 1px solid #b8d8c5; border-radius: 10px; background: #f4fbf6;
}
.auth-actions button, .auth-actions a {
  min-height: 42px; border: 0; border-radius: 9px; padding: 9px 16px;
  font-weight: 800; text-align: center; text-decoration: none; cursor: pointer;
}
.auth-actions button { color: white; background: #06c755; }
.auth-actions a {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--purple); background: #e4f2e8;
}

.login-guide {
  width: min(760px, 100%); margin: 18px auto 32px; padding: 34px;
  border: 1px solid #c9dacf; border-top: 5px solid var(--gold);
  border-radius: 18px; background: rgba(255,255,255,.97);
  box-shadow: 0 18px 45px rgba(17, 66, 51, .12);
}
.login-guide__eyebrow {
  margin: 0 0 8px; color: #9a690b; font-size: 14px; font-weight: 900;
  letter-spacing: .08em;
}
.login-guide h2 { margin: 0 0 14px; color: var(--purple); font-size: clamp(26px, 4vw, 38px); }
.login-guide__intro { margin: 0; color: #38584e; font-size: 17px; line-height: 1.7; }
.login-guide__points {
  display: grid; gap: 10px; margin: 22px 0; padding: 0; list-style: none;
}
.login-guide__points li {
  position: relative; padding-left: 30px; color: #28483e; font-weight: 700; line-height: 1.55;
}
.login-guide__points li::before {
  position: absolute; left: 0; top: .05em; color: #238636; font-size: 18px;
  font-weight: 900; content: "✓";
}
.login-guide__actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.login-guide__actions button, .login-guide__actions a {
  min-height: 50px; border: 0; border-radius: 10px; padding: 12px 18px;
  font-weight: 900; text-align: center; text-decoration: none; cursor: pointer;
}
.login-guide__actions button { color: white; background: #06c755; }
.login-guide__actions a {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--purple); background: #e4f2e8;
}
.login-guide__note { margin: 18px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
body.desktop-login-required #searchToolbar,
body.desktop-login-required .selection-summary,
body.desktop-login-required #teamGrid,
body.desktop-login-required #emptyTeams,
body.desktop-login-required #submitBar { display: none; }

.toolbar {
  display: grid; grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center; gap: 10px; margin-bottom: 12px;
}
.toolbar input, .toolbar select {
  width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 9px;
  background: white; padding: 9px 12px;
}
.category-filters {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px;
  border: 1px solid var(--line); border-radius: 12px; background: white;
}
.category-filters button {
  min-height: 36px; border: 0; border-radius: 9px; padding: 7px 13px;
  color: var(--muted); background: transparent; font-size: 13px;
  font-weight: 800; white-space: nowrap; cursor: pointer;
}
.category-filters button[aria-pressed="true"] {
  color: white; background: var(--purple);
}
.selection-summary { display: flex; justify-content: space-between; gap: 12px; margin: 12px 2px; color: var(--muted); }
.selection-summary strong { color: var(--purple); white-space: nowrap; }
.empty-teams {
  margin: 20px 0; padding: 28px 16px; border: 1px dashed var(--line);
  border-radius: 13px; color: var(--muted); background: white; text-align: center;
}

.team-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.team-card {
  position: relative; display: block; min-height: 150px; padding: 14px 14px 58px;
  background: white; border: 2px solid transparent; border-radius: 13px;
  box-shadow: 0 3px 16px rgba(40, 22, 62, .07); cursor: pointer;
}
.team-card:hover { border-color: #d8bd76; }
.team-card.selected { border-color: var(--purple-2); background: #fff9e9; }
.team-card input { position: absolute; opacity: 0; pointer-events: none; }
.team-card__image {
  display: block; width: calc(100% + 28px); aspect-ratio: 16 / 9;
  margin: -14px -14px 12px; border-radius: 11px 11px 0 0; object-fit: cover;
  background: #e6eee9;
}
.team-card__category { display: inline-block; color: var(--purple-2); font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.team-card h2 { font-size: 18px; margin: 0 0 6px; }
.team-card p { color: var(--muted); margin: 4px 0; font-size: 14px; line-height: 1.45; }
.team-card__video {
  position: absolute; left: 14px; bottom: 18px; display: inline-block;
  max-width: calc(100% - 112px); color: var(--purple-2);
  font-size: 14px; font-weight: 800; text-decoration: underline;
  text-underline-offset: 3px;
}
.team-card__check {
  position: absolute; right: 14px; bottom: 14px; min-width: 66px; height: 34px;
  padding: 0 10px; border: 1px solid var(--purple-2); border-radius: 999px;
  display: grid; place-items: center; background: white; color: var(--purple-2);
  font-size: 12px; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
}
.team-card.selected .team-card__check { background: var(--purple-2); color: white; border-color: var(--purple-2); }

.submit-bar {
  position: fixed; z-index: 5; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom));
}
.submit-bar button, dialog button {
  min-height: 46px; border: 0; border-radius: 10px; color: white;
  background: var(--purple); padding: 10px 20px; font-weight: 700;
}
.submit-bar button { display: block; width: min(600px, 100%); margin: 0 auto; }
.submit-bar .browse-share-button { background: #06c755; }
.browse-share-status {
  width: min(600px, 100%); min-height: 20px; margin: 8px auto 0;
  text-align: center; font-size: 13px;
}
button:disabled { opacity: .42; cursor: not-allowed; }
main button {
  min-height: 44px; border: 0; border-radius: 9px; color: white;
  background: var(--purple); padding: 9px 16px; font-weight: 700;
}
table { width: 100%; border-collapse: collapse; background: white; border-radius: 10px; overflow: hidden; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--purple); background: #edf5f0; }
pre { max-width: 100%; overflow: auto; background: #123c32; color: #f8fbf9; padding: 14px; border-radius: 10px; }

dialog { width: min(560px, calc(100% - 28px)); border: 0; border-radius: 16px; padding: 22px; }
dialog::backdrop { background: rgba(7, 31, 24, .66); }
dialog h2 { margin-top: 0; }
.confirm-list { display: grid; gap: 8px; margin: 14px 0; }
.confirm-list div { background: #eef5f1; border-radius: 8px; padding: 10px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
dialog button.secondary { color: var(--purple); background: #eaf2ed; }
.receipt { padding: 12px; background: #eef5f1; border-radius: 9px; overflow-wrap: anywhere; }

.video-dialog {
  width: min(920px, calc(100% - 28px));
  max-width: none;
  padding: 0;
  overflow: hidden;
  color: white;
  background: #111;
}
.video-dialog[open] { display: flex; flex-direction: column; }
.video-dialog__header {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 14px; background: #123c32;
}
.video-dialog__header h2 {
  margin: 0; overflow: hidden; font-size: 16px; line-height: 1.35;
  text-overflow: ellipsis; white-space: nowrap;
}
.video-dialog__close {
  flex: 0 0 auto; min-height: 40px; padding: 8px 14px;
  color: var(--purple); background: white;
}
.video-dialog__player { width: 100%; aspect-ratio: 16 / 9; background: black; }
.video-dialog__player iframe { display: block; width: 100%; height: 100%; border: 0; }

.success-screen {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  background: #1f5d4c url("assets/nz-hero-green-v1.jpg") center center / cover no-repeat;
}
.success-card {
  width: min(520px, 100%);
  padding: 34px 24px;
  border-radius: 22px;
  border: 1px solid rgba(218, 177, 73, .72);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 18px 60px rgba(18, 7, 29, .28);
  text-align: center;
}
.success-check {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  background: #238636;
  font-size: 44px;
  font-weight: 800;
}
.success-eyebrow {
  margin: 0 0 8px;
  color: var(--purple-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.success-card h1 { margin: 0 0 12px; color: var(--purple); }
.success-card > p { line-height: 1.6; }
.success-card button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 11px;
  padding: 11px 18px;
  font-weight: 800;
}
.share-button { margin-top: 12px; color: white; background: #06c755; }
.success-close { margin-top: 10px; color: var(--purple); background: #eaf2ed; }
.share-status { min-height: 24px; margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.share-status.success { color: #176128; }
.share-status.error { color: #7c1e19; }

@media (max-width: 900px) {
  .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .prelaunch-schedule { grid-template-columns: 1fr; }
  .prelaunch-stage { padding: 18px; }
  .auth-actions { align-items: stretch; flex-direction: column; }
  .auth-actions button, .auth-actions a { width: 100%; }
  .login-guide { margin-top: 10px; padding: 24px 20px; }
  .login-guide__actions { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .category-filters { display: grid; grid-template-columns: .7fr 1fr 1.45fr; width: 100%; }
  .category-filters button { min-width: 0; padding-inline: 7px; }
  .team-grid { grid-template-columns: 1fr; }
  .selection-summary { align-items: flex-start; flex-direction: column; gap: 4px; }
  .hero__top { align-items: center; flex-direction: row; justify-content: space-between; gap: 8px; }
  .hero__rules { max-width: 46%; font-size: 11px; text-align: right; }
  .hero-language-switch { gap: 2px; }
  .hero-language-switch button { min-height: 30px; padding: 4px 8px; font-size: 12px; }
  .hero { padding: 16px 14px 18px; background-position: center center; }
  .hero__brand {
    width: min(100%, 390px); height: auto; max-width: 100%; max-height: none;
    margin: 14px auto 14px;
  }
  .hero h1 { margin-bottom: 6px; font-size: clamp(28px, 8vw, 34px); }
  .video-dialog {
    width: 100vw; height: 100dvh; max-height: 100dvh;
    margin: 0; border-radius: 0;
  }
  .video-dialog__player { margin: auto 0; }
}
