/* ==========================================================================
   HopeLands 陣型平台 v0.1 — 樣式表
   主題色（取自聯盟盾徽）：
   - 金色 Gold:      #D6A83A
   - 藍色 Blue:      #1C4A96
   - 綠色 Green:     #2EA05A
   - 深藍底 Navy:    #122040
   ========================================================================== */

:root {
  --bg-deep: #0b152b;
  --bg-navy: #122040;
  --bg-card: #16284f;
  --bg-card-elevated: #1c3363;
  --bg-input: #0e1b36;

  --gold: #d6a83a;
  --gold-light: #f2cf76;
  --gold-dark: #a87f1e;
  --blue: #1c4a96;
  --blue-light: #5c93ed;
  --green: #2ea05a;
  --green-light: #6be098;

  --text-main: #f3f6fc;
  --text-muted: #b2c3e0;
  --text-dim: #849bc2;

  --border-subtle: rgba(138, 174, 232, 0.22);
  --border-gold: rgba(214, 168, 58, 0.55);
  --danger: #f87171;
  --danger-bg: rgba(127, 29, 29, 0.35);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 10px 28px rgba(4, 10, 24, 0.45);

  /* Modern Web Guidance: form-factor-adaptation target size */
  --target-size: 24px;
}

@media (pointer: coarse) {
  :root {
    --target-size: 44px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  /* Prevent sticky top header & bottom mobile bar from obscuring focused/anchored elements */
  scroll-padding-top: calc(7.5rem + env(safe-area-inset-top, 0px));
  scroll-padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none;
  }
}

body {
  margin: 0;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  background-color: var(--bg-navy);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(28, 74, 150, 0.42), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(46, 160, 90, 0.16), transparent 40%),
    linear-gradient(180deg, #0d1933 0%, #122040 50%, #0b152b 100%);
  color: var(--text-main);
  line-height: 1.6;
  overflow-wrap: break-word;
  padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 900px) {
  body {
    padding-bottom: 0;
  }
}

/* Modern Web Guidance: form-factor-adaptation */
img,
video,
svg {
  max-inline-size: 100%;
  block-size: auto;
}

:where(a, code) {
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
h4 {
  margin-top: 0;
  line-height: 1.3;
  text-wrap: balance;
}

p,
li,
dd {
  text-wrap: pretty;
}

:where(
  button,
  select,
  textarea,
  input:not([type="checkbox"], [type="radio"]),
  [role="button"],
  nav a,
  label:has(input[type="checkbox"], input[type="radio"])
) {
  min-block-size: var(--target-size);
  min-inline-size: var(--target-size);
}

:where([role="button"], nav a, label:has(input[type="checkbox"], input[type="radio"])) {
  display: inline-flex;
  align-items: center;
}

:where(nav, nav ul, .toolbar) {
  display: flex;
  flex-wrap: wrap;
}

:where(.toolbar > :not(button, input, select, textarea, a, [role="button"], label)) {
  min-inline-size: 0;
}

/* Visually hidden utility (accessible to screen readers) */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 999;
  background: var(--gold);
  color: #0b152b;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 1rem;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 21, 43, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  padding-top: env(safe-area-inset-top, 0px);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 0.65rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-main);
  min-inline-size: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
}

.brand-title {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.badge-version {
  font-size: 0.72rem;
  background: var(--blue);
  color: #fff;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.brand-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.header-controls {
  gap: 0.5rem;
  align-items: center;
}

.role-preview-control {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.control-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.select-compact {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.5rem;
  font-size: 0.8rem;
  max-width: 100%;
}

/* Primary Nav */
.primary-nav {
  background: rgba(18, 32, 64, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  gap: 0.35rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  gap: 0.35rem;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text-main);
  background: rgba(28, 74, 150, 0.35);
}

.nav-link.is-active {
  color: #0b152b;
  background: var(--gold);
  border-color: var(--gold-light);
  font-weight: 700;
}

.nav-num {
  font-size: 0.72rem;
  opacity: 0.8;
}

/* Mobile quick hides to keep 375px header compact */
@media (max-width: 640px) {
  .primary-nav {
    display: none;
  }
  .control-label {
    display: none;
  }
  .header-inner {
    padding-block: 0.45rem;
    gap: 0.45rem;
  }
  .brand-logo {
    width: 34px;
    height: 34px;
  }
  .brand-title {
    font-size: 1rem;
  }
  .brand-subtitle {
    font-size: 0.72rem;
  }
  .header-controls {
    width: 100%;
    flex-wrap: nowrap;
    gap: 0.35rem;
  }
  .role-preview-control {
    flex: 1 1 0;
    min-inline-size: 0;
  }
  .select-compact {
    width: 100%;
    font-size: 0.75rem;
    padding: 0.25rem 0.35rem;
  }
  .header-controls .btn-sm {
    font-size: 0.75rem;
    padding: 0.28rem 0.5rem;
    flex-shrink: 0;
  }
}

/* ==========================================================================
   Buttons & Badges
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.25;
  transition: transform 0.1s, background-color 0.15s, border-color 0.15s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  font-size: 0.82rem;
  padding: 0.38rem 0.72rem;
}

.btn-gold {
  background: linear-gradient(180deg, #e5ba4c 0%, #c99625 100%);
  color: #0a1428;
  border-color: #f6d889;
  box-shadow: 0 2px 10px rgba(214, 168, 58, 0.25);
}

.btn-gold:hover,
.btn-gold:focus-visible {
  background: linear-gradient(180deg, #f0c965 0%, #d6a83a 100%);
}

.btn-green {
  background: linear-gradient(180deg, #36b567 0%, #25894b 100%);
  color: #ffffff;
  border-color: #6be098;
}

.btn-green:hover,
.btn-green:focus-visible {
  background: linear-gradient(180deg, #42c775 0%, #2ea05a 100%);
}

.btn-outline {
  background: rgba(14, 27, 54, 0.75);
  color: var(--text-main);
  border-color: rgba(138, 174, 232, 0.4);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  border-color: var(--gold);
  color: var(--gold-light);
  background: rgba(28, 74, 150, 0.35);
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: rgba(28, 74, 150, 0.45);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.badge-gold {
  background: rgba(214, 168, 58, 0.2);
  color: var(--gold-light);
  border-color: var(--border-gold);
}

.badge-green {
  background: rgba(46, 160, 90, 0.22);
  color: var(--green-light);
  border-color: rgba(46, 160, 90, 0.6);
}

.badge-blue {
  background: rgba(28, 74, 150, 0.55);
  color: #bae6fd;
  border-color: rgba(92, 147, 237, 0.55);
}

/* ==========================================================================
   Page Sections & Indicators
   ========================================================================== */
.page-section {
  padding-block: 2.25rem;
  border-bottom: 1px solid rgba(138, 174, 232, 0.15);
}

.page-section[hidden] {
  display: none !important;
}

.page-indicator {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.page-step {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #0b152b;
  background: var(--gold);
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
}

.page-tag {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.section-header {
  margin-bottom: 1.35rem;
}

.section-title {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  color: var(--gold-light);
  margin-bottom: 0.45rem;
}

.section-desc {
  color: var(--text-muted);
  margin: 0;
  max-width: 72ch;
}

.section-block {
  margin-top: 2rem;
}

.subsection-title {
  font-size: 1.15rem;
  color: var(--gold-light);
  margin-bottom: 0.9rem;
}

/* ==========================================================================
   Modern Web Guidance: Card Component (<article class="card">)
   ========================================================================== */
.card {
  container-type: inline-size;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* ==========================================================================
   PAGE 01: Hero & Recruitment
   ========================================================================== */
.hero-card {
  background: linear-gradient(145deg, rgba(28, 74, 150, 0.45) 0%, rgba(18, 32, 64, 0.92) 65%, rgba(11, 21, 43, 0.96) 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 3vw, 2rem);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  box-shadow: var(--shadow-card);
}

@media (min-width: 920px) {
  .hero-card {
    grid-template-columns: 1.55fr 0.85fr;
    align-items: center;
  }
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--green-light);
  background: rgba(46, 160, 90, 0.16);
  border: 1px solid rgba(46, 160, 90, 0.45);
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: clamp(1.45rem, 3.6vw, 2.2rem);
  color: #ffffff;
  margin-bottom: 0.75rem;
}

.hero-lead {
  color: var(--text-muted);
  margin-bottom: 1.15rem;
  font-size: 0.96rem;
}

.fact-badges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.fact-badge {
  background: rgba(11, 21, 43, 0.7);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
}

.fact-value {
  font-weight: 800;
  font-size: 1rem;
  color: var(--gold-light);
}

.fact-label {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.join-cta-box {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: rgba(11, 21, 43, 0.78);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.95rem;
}

.join-clan-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.join-clan-row-sub {
  padding-top: 0.85rem;
  border-top: 1px dashed rgba(138, 174, 232, 0.25);
}

.join-badge-gold,
.join-badge-green {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
}

.join-badge-gold {
  background: var(--gold);
  color: #0b152b;
}

.join-badge-green {
  background: var(--green);
  color: #ffffff;
}

.join-clan-title {
  font-size: 1.1rem;
  margin-bottom: 0.15rem;
}

.clan-tag-code {
  color: var(--gold-light);
  background: rgba(214, 168, 58, 0.14);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.join-clan-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.join-clan-actions {
  gap: 0.5rem;
}

.shield-showcase {
  background: rgba(11, 21, 43, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.hero-shield-img {
  width: 148px;
  height: 148px;
  border-radius: 16px;
  border: 2px solid var(--border-gold);
}

.shield-caption strong {
  display: block;
  color: var(--gold-light);
  margin-bottom: 0.3rem;
}

.shield-caption p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 0;
}

/* 4-column responsive grid */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.feature-card header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.feature-card h3 {
  margin: 0;
  font-size: 1.08rem;
  color: #fff;
}

.feature-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), #0f2c5c);
  border: 1px solid var(--gold);
  color: var(--gold-light);
  font-weight: 800;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.feature-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Schedule Banner */
.schedule-banner {
  background: linear-gradient(135deg, rgba(22, 40, 79, 0.95), rgba(14, 27, 54, 0.95));
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
}

@media (min-width: 820px) {
  .schedule-banner {
    grid-template-columns: 0.9fr 1.4fr;
    align-items: center;
  }
}

.schedule-intro h2 {
  font-size: 1.25rem;
  margin-block: 0.4rem;
  color: var(--gold-light);
}

.schedule-intro p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.schedule-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.schedule-item {
  background: rgba(11, 21, 43, 0.78);
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
}

.schedule-date {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--green-light);
}

.schedule-time {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold-light);
  margin-block: 0.15rem 0.4rem;
}

.schedule-detail strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
}

.schedule-detail p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Recruit templates drawer */
.recruit-copy-drawer {
  margin-top: 1.35rem;
  background: rgba(14, 27, 54, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.recruit-drawer-summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--gold-light);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.drawer-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.recruit-templates-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.85rem;
}

.template-box {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.template-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.84rem;
}

.template-pre {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: inherit;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.55rem;
  border-radius: 6px;
}

/* ==========================================================================
   PAGE 02: Clans & League Tiers
   ========================================================================== */
.league-tier-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.35rem;
}

.league-tier-pill {
  background: rgba(14, 27, 54, 0.88);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.tier-champ1 { border-left: 4px solid var(--gold); }
.tier-champ2 { border-left: 4px solid #f59e0b; }
.tier-champ3 { border-left: 4px solid var(--blue-light); }
.tier-master { border-left: 4px solid var(--green); }

.tier-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
}

.clans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1rem;
}

.clan-card-highlight {
  border-color: var(--border-gold);
  background: linear-gradient(180deg, rgba(28, 51, 99, 0.95) 0%, rgba(22, 40, 79, 0.95) 100%);
}

.clan-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.clan-card-header h3 {
  margin-bottom: 0.2rem;
  font-size: 1.18rem;
}

.clan-tag-line {
  margin: 0;
  font-size: 0.85rem;
  color: var(--gold-light);
}

.clan-meta-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.86rem;
}

.clan-meta-list div {
  display: grid;
  grid-template-columns: 4.8rem 1fr;
  gap: 0.4rem;
}

.clan-meta-list dt {
  color: var(--text-dim);
  font-weight: 600;
}

.clan-meta-list dd {
  margin: 0;
  color: var(--text-main);
}

.clan-card-footer {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   PAGE 03: Base Vault (陣型庫)
   ========================================================================== */
.badge-sample-inline {
  font-size: 0.78rem;
  background: var(--gold);
  color: #0b152b;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  vertical-align: middle;
}

.filter-panel {
  background: rgba(11, 21, 43, 0.82);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 0.75rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.filter-group select {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  font-size: 0.88rem;
  width: 100%;
}

.filter-status-bar {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.filter-count {
  font-size: 0.85rem;
  color: var(--gold-light);
  font-weight: 700;
}

.bases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
  gap: 1.15rem;
}

/* Modern Web Guidance: dynamic-sort view-transition-name */
.base-card {
  view-transition-name: match-element;
  padding: 0;
  overflow: clip;
  border-color: rgba(214, 168, 58, 0.35);
}

.base-card[hidden] {
  display: none !important;
}

/* Direct child <img> of <article class="card base-card"> (Modern Web Guidance: card) */
.base-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--border-subtle);
  background: #0b162c;
}

.base-card-header,
.base-card-content,
.base-card-footer {
  padding-inline: 1.05rem;
}

.base-card-header {
  padding-top: 0.85rem;
}

.base-meta-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.badge-sample {
  background: var(--gold);
  color: #0b152b;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
}

.badge-th {
  background: var(--blue);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
}

.badge-tier {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
}

.tier-s {
  background: rgba(214, 168, 58, 0.25);
  color: #fde68a;
  border: 1px solid var(--gold);
}

.tier-a {
  background: rgba(46, 160, 90, 0.25);
  color: #a7f3d0;
  border: 1px solid var(--green);
}

.tier-b {
  background: rgba(92, 147, 237, 0.25);
  color: #bae6fd;
  border: 1px solid var(--blue-light);
}

.badge-defense {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
}

.base-card-title {
  font-size: 1.12rem;
  margin-bottom: 0.4rem;
  color: #fff;
}

.base-modes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mode-tag,
.patch-tag {
  font-size: 0.74rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.mode-tag {
  background: rgba(28, 74, 150, 0.45);
  color: #dbeafe;
}

.patch-tag {
  background: rgba(46, 160, 90, 0.18);
  color: var(--green-light);
}

.score-difficulty-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  background: rgba(11, 21, 43, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.65rem;
}

.score-pill,
.difficulty-pill {
  display: flex;
  flex-direction: column;
}

.score-label {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.score-num {
  font-size: 1.12rem;
  color: var(--gold-light);
}

.diff-hardest strong { color: #fca5a5; }
.diff-hard strong { color: #fcd34d; }
.diff-medium strong { color: var(--green-light); }

.base-summary {
  font-size: 0.87rem;
  color: var(--text-muted);
  margin-block: 0 0.65rem;
}

.base-details-dl {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.base-details-dl div {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.35rem;
}

.base-details-dl dt {
  color: var(--text-dim);
  font-weight: 600;
}

.base-details-dl dd {
  margin: 0;
}

.base-details-dl a {
  color: var(--gold-light);
}

.report-stats-box {
  background: rgba(11, 21, 43, 0.78);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
}

.report-stats-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  margin-bottom: 0.45rem;
}

.avg-stars-badge {
  color: var(--gold-light);
  font-weight: 700;
}

.star-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.star-chip {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 0.2rem 0.35rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.star-chip strong {
  color: #fff;
}

.base-card-footer {
  margin-top: auto;
  padding-block: 0.85rem;
  background: rgba(11, 21, 43, 0.55);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.base-card-footer .btn {
  flex: 1 1 130px;
}

/* Container query for wide single-card layout */
@container (inline-size > 36rem) {
  .score-difficulty-box {
    grid-template-columns: 9rem 1fr;
  }
}

/* ==========================================================================
   PAGE 04: Featured Recommendations (本期推薦)
   ========================================================================== */
.featured-issue-banner {
  background: linear-gradient(160deg, rgba(28, 51, 99, 0.92), rgba(14, 27, 54, 0.96));
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 2.5vw, 1.65rem);
  box-shadow: var(--shadow-card);
}

.issue-header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.issue-main-title {
  font-size: clamp(1.2rem, 2.6vw, 1.55rem);
  margin-block: 0.35rem 0;
  color: #fff;
}

.issue-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.date-chip {
  background: rgba(11, 21, 43, 0.8);
  border: 1px solid var(--border-subtle);
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.date-chip strong {
  color: var(--gold-light);
}

.issue-summary-text {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.meta-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.meta-box {
  background: rgba(11, 21, 43, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
}

.meta-hard {
  border-left: 4px solid var(--green);
}

.meta-easy {
  border-left: 4px solid var(--gold);
}

.meta-box h4 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  color: #fff;
}

.meta-box p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.featured-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}

.featured-mini-card {
  background: rgba(11, 21, 43, 0.82);
  padding: 0.95rem;
}

.featured-mini-card h4 {
  font-size: 0.98rem;
  margin-block: 0.35rem 0;
}

.featured-mini-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.featured-mini-card footer {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
}

.history-item.is-selected {
  border-color: var(--gold);
  background: rgba(28, 51, 99, 0.88);
}

.history-item h4 {
  font-size: 1rem;
  margin-block: 0.35rem 0;
}

.history-item p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0;
}

/* ==========================================================================
   PAGE 05: Membership & Registration Form (validate-input-after-interaction)
   ========================================================================== */
.tier-cards-grid {
  margin-bottom: 1.5rem;
}

.tier-card {
  position: relative;
}

.tier-card-top {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(28, 51, 99, 0.95), rgba(22, 40, 79, 0.95));
}

.tier-level-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.tier-tag-blue {
  background: var(--blue);
  color: #fff;
}

.tier-tag-gold {
  background: var(--gold);
  color: #0b152b;
}

.tier-cond {
  font-size: 0.84rem;
  color: var(--gold-light);
  margin-block: 0 0.5rem;
}

.tier-perks {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.membership-form-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 880px) {
  .membership-form-layout {
    grid-template-columns: 1.25fr 0.95fr;
    align-items: start;
  }
}

.form-card,
.passkey-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  box-shadow: var(--shadow-card);
}

.form-card-head h3,
.passkey-info-card h3 {
  margin-block: 0.4rem;
  color: var(--gold-light);
}

.form-card-head p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}

.field {
  margin-bottom: 1.05rem;
}

.field label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
}

.req-star {
  color: var(--gold);
}

.opt-tag {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Modern Web Guidance: validate-input-after-interaction
   Format hints placed ABOVE the input so mobile keyboards/autocomplete popovers do not cover them */
.hint {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.field input:not([type="checkbox"], [type="radio"]),
.field select,
.full-width-select {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1.5px solid rgba(138, 174, 232, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
}

.field input[type="file"] {
  padding: 0.45rem;
  font-size: 0.84rem;
}

.error-msg {
  display: none;
  color: var(--danger);
  font-size: 0.84rem;
  margin-top: 0.35rem;
  font-weight: 600;
}

/* Modern Web Guidance: :is(:user-invalid, .user-invalid-fallback) */
:is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--danger) !important;
  background-color: var(--danger-bg) !important;
}

:is(:user-invalid, .user-invalid-fallback) + .error-msg {
  display: block;
}

:is(:user-valid, .user-valid-fallback) {
  border-color: var(--green) !important;
}

.screenshot-preview {
  margin-top: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: rgba(46, 160, 90, 0.15);
  border: 1px solid var(--green);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--green-light);
}

.form-actions {
  gap: 0.65rem;
  margin-top: 1.1rem;
}

.reg-result-box {
  margin-top: 1rem;
  padding: 0.9rem;
  background: rgba(46, 160, 90, 0.18);
  border: 1px solid var(--green);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.passkey-feature-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.passkey-feature-list li {
  background: rgba(11, 21, 43, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.passkey-feature-list strong {
  color: #fff;
  font-size: 0.9rem;
}

.passkey-feature-list span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.passkey-demo-box {
  background: rgba(28, 74, 150, 0.28);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
}

.passkey-demo-box h4 {
  margin-bottom: 0.3rem;
  color: var(--gold-light);
}

.passkey-demo-box p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-block: 0 0.65rem;
}

/* ==========================================================================
   PAGE 06: Sources & Credits (來源與致謝)
   ========================================================================== */
.creator-policy-banner {
  background: linear-gradient(135deg, rgba(214, 168, 58, 0.16), rgba(18, 32, 64, 0.92));
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.policy-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.policy-text h3 {
  font-size: 1.05rem;
  color: var(--gold-light);
  margin-bottom: 0.35rem;
}

.policy-text p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.table-scroll-region {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(11, 21, 43, 0.75);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 540px;
}

.data-table th,
.data-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.data-table th {
  background: rgba(28, 74, 150, 0.38);
  color: var(--gold-light);
  font-weight: 700;
}

.creators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.95rem;
}

.creator-card h4 {
  font-size: 1.12rem;
  margin-block: 0.35rem 0.15rem;
  color: #fff;
}

.creator-region {
  font-size: 0.8rem;
  color: var(--gold-light);
  margin: 0;
}

.creator-card p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 0;
}

.creator-card footer {
  margin-top: auto;
  padding-top: 0.45rem;
}

.creator-card-featured {
  border-color: var(--border-gold);
  background: linear-gradient(180deg, rgba(28, 51, 99, 0.92), rgba(22, 40, 79, 0.95));
}

/* ==========================================================================
   Footer & Mobile Bottom Bar
   ========================================================================== */
.site-footer {
  background: #081021;
  border-top: 1px solid var(--border-subtle);
  padding-block: 1.75rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.footer-brand strong {
  color: var(--gold-light);
  display: block;
}

.footer-brand p {
  margin: 0;
  font-size: 0.8rem;
}

.footer-disclaimer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.85rem;
}

.disclaimer-primary,
.disclaimer-en {
  margin-block: 0 0.35rem;
}

.footer-disclaimer a {
  color: var(--gold-light);
}

/* Mobile Fixed Bottom Nav (Modern Web Guidance: safe-area-inset padding) */
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: rgba(9, 17, 36, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-gold);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding-bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
  padding-left: max(0.25rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.25rem, env(safe-area-inset-right, 0px));
}

@media (min-width: 900px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding-block: 0.35rem;
  border-radius: 6px;
}

.bottom-nav-num {
  font-size: 0.65rem;
  opacity: 0.75;
}

.bottom-nav-item.is-active {
  color: var(--gold-light);
  background: rgba(214, 168, 58, 0.16);
}

/* ==========================================================================
   Dialogs (<dialog closedby="any">) & Choice Cards
   ========================================================================== */
dialog {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 0;
  width: min(92vw, 500px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
}

dialog::backdrop {
  background-color: rgba(6, 12, 26, 0.78);
  backdrop-filter: blur(4px);
}

.dialog-inner {
  padding: 1.2rem;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.dialog-header h2 {
  font-size: 1.15rem;
  margin: 0;
  color: var(--gold-light);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.dialog-subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-block: 0 1rem;
}

.star-choice-fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin: 0 0 1rem;
}

.star-choice-fieldset legend {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold-light);
  padding-inline: 0.35rem;
}

.star-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
}

/* Modern Web Guidance: Choice cards — never change layout-affecting properties on selection */
.choice-card {
  padding: 0.55rem 0.7rem;
  background: rgba(11, 21, 43, 0.75);
  border: 2px solid transparent;
  cursor: pointer;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
}

.choice-card:has(> :checked) {
  border-color: var(--gold);
  background: rgba(214, 168, 58, 0.14);
}

.choice-card span {
  display: flex;
  flex-direction: column;
}

.choice-card strong {
  font-size: 0.86rem;
}

.choice-card small {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.dialog-actions {
  gap: 0.55rem;
  margin-top: 1rem;
}

.sim-step {
  background: rgba(11, 21, 43, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  margin-bottom: 0.75rem;
}

.sim-step strong {
  display: block;
  font-size: 0.88rem;
  color: var(--gold-light);
  margin-bottom: 0.25rem;
}

.sim-step p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-block: 0 0.5rem;
}

.sim-status-text {
  color: var(--green-light) !important;
  font-weight: 600;
  margin-bottom: 0 !important;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: calc(4.8rem + env(safe-area-inset-bottom, 0px));
  right: 1rem;
  left: 1rem;
  max-width: 380px;
  margin-inline: auto;
  z-index: 90;
  background: #102a1e;
  color: #d1fae5;
  border: 1.5px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
}
