:root {
  --bg: #EFF6F8;
  --surface: #FFFFFF;
  --ink: #12313D;
  --muted: #52707C;
  --border: #D5E4EA;
  --gold: #FFC83D;
  --gold-deep: #D99B00;
  --mint: #22B883;
  --coral: #FF5D73;
  --shadow: 0 10px 28px rgba(18, 49, 61, 0.08);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, .cyb-brand-text {
  font-family: 'Fredoka', system-ui, -apple-system, sans-serif;
  margin: 0;
}

.cyb-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 18px;
}

.cyb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 18px;
  max-width: 980px;
  margin: 0 auto;
}
.cyb-header-right {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.cyb-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
}
.cyb-brand-icon { width: 30px; height: 30px; flex-shrink: 0; }
.cyb-sub-link {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 600;
  margin-left: 6px;
}
.cyb-sub-link:hover { color: var(--ink); }

.cyb-nav {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
  font-size: 0.92rem;
}
.cyb-nav a {
  padding: 6px 10px;
  border-radius: 10px;
  color: var(--muted);
}
.cyb-nav a:hover { color: var(--ink); background: rgba(18, 49, 61, 0.06); }

.cyb-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 26px;
  padding: 28px;
  box-shadow: var(--shadow);
  margin-top: 8px;
}
.cyb-hero h1 {
  font-size: clamp(2rem, 4.4vw, 2.9rem);
  line-height: 1.08;
  margin-bottom: 12px;
}
.cyb-hero p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 1.04rem;
  font-weight: 600;
}
.cyb-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: var(--ink);
  font-family: 'Fredoka', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.08rem;
  padding: 13px 26px;
  border-radius: 16px;
  border: 2px solid #E5A910;
  box-shadow: 0 4px 0 #D99B00;
  transition: transform 0.1s ease;
}
.cyb-cta:active { transform: translateY(2px); box-shadow: 0 2px 0 #D99B00; }

.cyb-preview-card {
  background: #F6FAFC;
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 14px;
}
.cyb-mini-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  aspect-ratio: 1;
}
.cyb-mini-cell {
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  background: #FFFFFF;
  border: 1px solid #D9E6EC;
  color: var(--ink);
}
.cyb-mini-cell.wall { background: #CBDCE3; border-color: #B7CDD6; }
.cyb-mini-cell.go { background: var(--mint); color: #FFFFFF; border-color: #19986B; font-size: 0.62rem; }
.cyb-mini-cell.end { background: var(--coral); color: #FFFFFF; border-color: #DF3E55; font-size: 0.56rem; }
.cyb-mini-cell.gold { background: #FFF2C2; border-color: #F4C430; }

.cyb-shelf {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 20px;
}
.cyb-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cyb-card.live { border-color: #BCE5D5; }
.cyb-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cyb-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: #E7F3F7;
  color: var(--muted);
}
.cyb-badge.live { background: #DCF7EC; color: #117A55; }
.cyb-progress-chip {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #FFF2C2;
  border: 1px solid #F4C430;
  color: #7A5200;
}
.cyb-card p { margin: 0; color: var(--muted); font-size: 0.88rem; font-weight: 500; }

.cyb-footer {
  max-width: 980px;
  margin: 26px auto 20px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--muted);
}
.cyb-footer-links { display: inline-flex; gap: 16px; }
.cyb-footer a:hover { color: var(--ink); }

/* Game Page */
body.cyb-play-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.cyb-play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}
.cyb-stage-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2px 10px 18px;
}
#game-stage {
  width: min(440px, 100%);
  height: min(760px, calc(100dvh - 108px));
  min-height: 520px;
  border-radius: 24px;
  overflow: hidden;
  background: #FFF9EC;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
}
#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.cyb-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  max-width: 440px;
  margin: 8px auto 6px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.cyb-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
}
.cyb-dot-go { color: #117A55; }
.cyb-dot-end { color: #D9304A; }
.cyb-dot-gold { color: #B87B00; }
.cyb-dot-mud { color: #7C3AED; }

.cyb-seo-guide {
  width: min(520px, 100%);
  margin: 14px auto 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 16px 18px;
  font-size: 0.88rem;
  color: var(--muted);
}
.cyb-seo-guide h1 {
  font-size: 1.15rem;
  color: var(--ink);
  margin-bottom: 6px;
}
.cyb-seo-guide h2 {
  font-size: 0.96rem;
  color: var(--ink);
  margin: 12px 0 6px;
}
.cyb-seo-guide p {
  margin: 0 0 8px;
  line-height: 1.5;
}
.cyb-seo-guide ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}
.cyb-seo-guide li + li { margin-top: 4px; }
.cyb-faq-item + .cyb-faq-item { margin-top: 8px; }
.cyb-faq-q {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}

.cyb-pill-btn, .cyb-account-action {
  appearance: none;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.cyb-pill-btn:hover, .cyb-account-action:hover { background: #F5FAFC; }
#cyb-account-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}
.cyb-account-name { color: var(--ink); }
.cyb-account-sep { color: var(--muted); }

[hidden] { display: none !important; }
.cyb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 49, 61, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}
.cyb-modal-backdrop[hidden] { display: none; }
.cyb-modal-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(18, 49, 61, 0.24);
  position: relative;
  text-align: center;
}
.cyb-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #F6FAFC;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}
.cyb-modal-card h2 { font-size: 1.4rem; margin-bottom: 6px; }
.cyb-modal-note { margin: 0 0 18px; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.cyb-auth-methods {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#cyb-google-login-btn { order: 1; }
.cyb-auth-divider {
  order: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cyb-auth-divider::before,
.cyb-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.cyb-email-auth {
  order: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cyb-dev-btn {
  order: 4;
  width: 100%;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1.5px solid #E5A910;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.cyb-auth-methods.cn-first .cyb-email-auth { order: 1; }
.cyb-auth-methods.cn-first .cyb-auth-divider { order: 2; }
.cyb-auth-methods.cn-first #cyb-google-login-btn { order: 3; }
.cyb-auth-methods.cn-first .cyb-dev-btn { order: 4; }
.cyb-email-row {
  display: flex;
  gap: 8px;
}
.cyb-auth-input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1.5px solid #D0DCE2;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: #FFFFFF;
  outline: none;
}
.cyb-auth-input:focus { border-color: #12313D; }
.cyb-otp-input {
  letter-spacing: 0.14em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cyb-email-btn {
  white-space: nowrap;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid #12313D;
  background: #12313D;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}
.cyb-email-btn:hover:not(:disabled) { opacity: 0.92; }
.cyb-email-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.cyb-verify-btn {
  white-space: nowrap;
  padding: 0 16px;
  border-radius: 12px;
  border: 1.5px solid #E5A910;
  background: var(--gold);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}
.cyb-verify-btn:hover:not(:disabled) { filter: brightness(0.97); }
.cyb-verify-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.cyb-google-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1.5px solid #D0DCE2;
  background: #FFFFFF;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.cyb-google-btn:hover { background: #F8FBFD; }
.cyb-dev-btn[hidden] { display: none; }
.cyb-auth-status {
  margin-top: 10px;
  min-height: 18px;
  color: #167F5B;
  font-size: 0.84rem;
  font-weight: 700;
}
.cyb-auth-status:empty { display: none; }
.cyb-auth-err {
  margin-top: 8px;
  min-height: 18px;
  color: var(--coral);
  font-size: 0.84rem;
  font-weight: 700;
}

.cyb-doc {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 26px;
  margin-top: 10px;
}
.cyb-doc h1 { font-size: 1.8rem; margin-bottom: 12px; }
.cyb-doc h2 { font-size: 1.15rem; margin: 18px 0 8px; }
.cyb-doc p, .cyb-doc li { color: var(--muted); line-height: 1.65; }

@media (max-width: 760px) {
  .cyb-hero { grid-template-columns: 1fr; padding: 20px; }
  .cyb-shelf { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .cyb-stage-wrap { padding: 0 0 18px; }
  #game-stage {
    width: 100vw;
    height: calc(100dvh - 96px);
    min-height: 460px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .cyb-seo-guide {
    width: calc(100% - 20px);
    margin: 12px 10px 4px;
  }
}
