/* 9517 網站樣式。色票、字型、字級照交接說明第 2 節；平面風格，不用漸層、陰影、發光。 */
:root {
  --ink: #23214F;
  --primary: #3B37A6;
  --primary-down: #2E2B86;
  --accent: #C6F36B;
  --paper: #FFFFFF;
  --mist: #F3F2FA;
  --line: #D9D7EC;
  --muted: #5B5880;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans TC", "PingFang TC",
    "Microsoft JhengHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border: 2px solid var(--primary);
  border-radius: 999px;
  background: var(--paper);
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: var(--paper);
}

.btn-primary:hover { background: var(--primary-down); border-color: var(--primary-down); }
.btn-primary:active { background: var(--primary-down); border-color: var(--primary-down); }
.btn-ghost:hover, .btn-ghost:active { background: var(--mist); }

/* 語言按鈕和篩選鈕：選中時 ink 底、白字 */
.lang button,
.chip {
  min-height: 44px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.lang button[aria-pressed="true"],
.chip[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

/* ---------- 頁首 ---------- */
.site-header { padding: 14px 0; }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--paper);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.lang {
  display: flex;
  gap: 6px;
}

.lang button { padding: 0 12px; font-size: 13px; }

/* ---------- 主視覺 ---------- */
.hero {
  padding-top: 40px;
  padding-bottom: 40px;
}

.hero-title {
  font-size: clamp(40px, 9vw, 64px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.hero-sub {
  max-width: 36em;
  margin-top: 16px;
  font-size: 18px;
}

.hero-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

/* ---------- 遊戲區 ---------- */
.games { padding-bottom: 48px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}

.card-thumb { display: block; }

.card-thumb img {
  display: block;
  width: 100%;
  height: auto;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 18px 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--mist);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.badge .icon { width: 16px; height: 16px; }
.badge.duo { background: var(--accent); }

.card-title {
  font-size: 20px;
  line-height: 1.3;
}

.card-desc {
  flex: 1;
  color: var(--muted);
  font-size: 15px;
}

.card-body .btn { margin-top: 6px; }

/* ---------- 頁尾 ---------- */
.site-footer {
  padding: 28px 0 40px;
  border-top: 2px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.site-footer p + p { margin-top: 4px; }

/* ---------- 提示框 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast:empty { display: none; }

/* ---------- 遊戲頁 ---------- */
.play-body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.play-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 2px solid var(--line);
  background: var(--paper);
}

.play-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.icon-btn:active { background: var(--mist); }

#btn-share {
  border-color: var(--accent);
  background: var(--accent);
}

.play-stage {
  flex: 1;
  min-height: 0;
  background: var(--mist);
}

.play-stage iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.missing {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  font-size: 18px;
  text-align: center;
}

@media (max-width: 640px) {
  .icon-btn { padding: 0 10px; }

  /* 窄畫面只顯示圖示，文字留給讀螢幕軟體 */
  .icon-btn .label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .toast { transition: none; }
}

/* ---------- 找不到頁面（404.html，G03） ---------- */
.notfound {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding-top: 64px;
  padding-bottom: 64px;
}

.notfound h1 { font-size: clamp(32px, 7vw, 48px); line-height: 1.2; }
.notfound p { color: var(--muted); font-size: 18px; }
