/* Shared components (modal, forms, buttons, toasts). Prefixed "cbx-" so they never clash with the game's own styles. */
:root {
  --cbx-ink: #22183a;
  --cbx-ink-2: #5b5470;
  --cbx-line: #e7e2f1;
  --cbx-bg: #ffffff;
  --cbx-soft: #f6f3fc;
  --cbx-primary: #7c3aed;
  --cbx-primary-2: #ec4899;
  --cbx-accent: #ffb020;
  --cbx-ok: #16a34a;
  --cbx-warn: #d97706;
  --cbx-err: #dc2626;
  --cbx-radius: 18px;
  --cbx-shadow: 0 24px 60px -18px rgba(34, 24, 58, .45);
  --cbx-font: 'Fredoka', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
html.cbx-locked { overflow: hidden; }

.cbx-overlay { position: fixed; inset: 0; z-index: 200000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(22, 14, 40, .58); backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s ease; font-family: var(--cbx-font); color: var(--cbx-ink); }
.cbx-overlay.cbx-show { opacity: 1; }
.cbx-modal { position: relative; width: 100%; max-height: calc(100vh - 32px); overflow: auto; background: var(--cbx-bg); border-radius: 24px; box-shadow: var(--cbx-shadow);
  transform: translateY(14px) scale(.98); transition: transform .25s cubic-bezier(.2, .9, .3, 1.2); outline: none; text-align: left; }
.cbx-overlay.cbx-show .cbx-modal { transform: none; }
.cbx-modal::before { content: ''; position: sticky; top: 0; display: block; height: 6px; background: linear-gradient(90deg, #7c3aed, #ec4899, #ffb020, #22c55e, #06b6d4); z-index: 2; }
.cbx-sm { max-width: 420px; } .cbx-md { max-width: 480px; } .cbx-lg { max-width: 720px; }
.cbx-modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 4px; }
.cbx-modal-title { flex: 1; margin: 0; font-size: 1.45rem; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.cbx-modal-body { padding: 10px 22px 22px; }
.cbx-x { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--cbx-soft); color: var(--cbx-ink); font-size: 16px; cursor: pointer; transition: background .15s, transform .15s; }
.cbx-x:hover { background: #ece6fa; transform: rotate(90deg); }

.cbx-p { margin: 0 0 14px; color: var(--cbx-ink-2); font-size: 1rem; line-height: 1.5; }
.cbx-hint { margin: 6px 0; color: var(--cbx-ink-2); font-size: .9rem; }
.cbx-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cbx-end { justify-content: flex-end; margin-top: 14px; }
.cbx-stack > * + * { margin-top: 12px; }

.cbx-field { margin-bottom: 12px; }
.cbx-label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; color: var(--cbx-ink); }
.cbx-inwrap { position: relative; display: flex; }
.cbx-input, .cbx-select, .cbx-textarea { width: 100%; font: inherit; font-size: 1rem; color: var(--cbx-ink); background: #fff; border: 2px solid var(--cbx-line); border-radius: 14px; padding: 12px 14px; transition: border-color .15s, box-shadow .15s; box-sizing: border-box; -webkit-user-select: text; user-select: text; }
.cbx-input:focus, .cbx-select:focus, .cbx-textarea:focus { outline: none; border-color: var(--cbx-primary); box-shadow: 0 0 0 4px rgba(124, 58, 237, .15); }
.cbx-has-err .cbx-input { border-color: var(--cbx-err); }
.cbx-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-size: 18px; }
.cbx-eye:hover { background: var(--cbx-soft); }
.cbx-inwrap:has(.cbx-eye) .cbx-input { padding-right: 52px; }
.cbx-ferr { min-height: 0; color: var(--cbx-err); font-size: .86rem; margin-top: 4px; }
.cbx-ferr:empty { display: none; }

.cbx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 1rem; line-height: 1; padding: 13px 20px; border-radius: 14px; border: 2px solid transparent; cursor: pointer;
  text-decoration: none; transition: transform .12s, box-shadow .15s, background .15s, opacity .15s; white-space: nowrap; color: var(--cbx-ink); background: var(--cbx-soft); }
.cbx-btn:hover:not(:disabled) { transform: translateY(-1px); }
.cbx-btn:active:not(:disabled) { transform: translateY(1px); }
.cbx-btn:disabled { opacity: .55; cursor: not-allowed; }
.cbx-btn:focus-visible, .cbx-x:focus-visible, .cbx-eye:focus-visible, .cbx-link:focus-visible { outline: 3px solid rgba(124, 58, 237, .5); outline-offset: 2px; }
.cbx-primary { color: #fff; background: linear-gradient(135deg, var(--cbx-primary), var(--cbx-primary-2)); box-shadow: 0 10px 22px -10px rgba(124, 58, 237, .8); }
.cbx-danger { color: #fff; background: var(--cbx-err); }
.cbx-ghost { background: transparent; border-color: var(--cbx-line); }
.cbx-block { width: 100%; }
.cbx-disabled { opacity: .55; cursor: not-allowed; }
.cbx-small { padding: 8px 12px; font-size: .88rem; border-radius: 10px; }
.cbx-link { background: none; border: 0; padding: 0; font: inherit; color: var(--cbx-primary); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.cbx-spin { width: 16px; height: 16px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .45); border-top-color: currentColor; animation: cbx-rot .8s linear infinite; }
.cbx-ghost .cbx-spin { border-color: rgba(0, 0, 0, .15); border-top-color: var(--cbx-primary); }
@keyframes cbx-rot { to { transform: rotate(360deg); } }

.cbx-alert { border-radius: 14px; padding: 12px 14px; font-size: .95rem; line-height: 1.45; margin-bottom: 14px; background: var(--cbx-soft); border: 1px solid var(--cbx-line); }
.cbx-alert.cbx-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.cbx-alert.cbx-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.cbx-alert.cbx-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.cbx-alert:empty { display: none; }
.cbx-divider { display: flex; align-items: center; gap: 12px; color: var(--cbx-ink-2); font-size: .85rem; margin: 16px 0; }
.cbx-divider::before, .cbx-divider::after { content: ''; flex: 1; height: 1px; background: var(--cbx-line); }
.cbx-buybox { margin-top: 16px; padding: 16px; border-radius: 18px; background: linear-gradient(135deg, #fff7ed, #fdf2f8); border: 1px dashed #fdba74; text-align: center; }
.cbx-buybox p { margin: 0 0 12px; font-weight: 600; line-height: 1.45; }
.cbx-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--cbx-soft); color: var(--cbx-ink-2); white-space: nowrap; }
.cbx-badge.cbx-ok { background: #dcfce7; color: #166534; } .cbx-badge.cbx-warn { background: #fef3c7; color: #92400e; }
.cbx-badge.cbx-err { background: #fee2e2; color: #991b1b; } .cbx-badge.cbx-info { background: #ede9fe; color: #5b21b6; }
.cbx-card { background: #fff; border: 1px solid var(--cbx-line); border-radius: var(--cbx-radius); padding: 16px; }
.cbx-section + .cbx-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--cbx-line); }
.cbx-section h3 { margin: 0 0 8px; font-size: 1.1rem; }
.cbx-kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .95rem; }
.cbx-kv dt { color: var(--cbx-ink-2); } .cbx-kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* game page: saving status pill and account panel */
.cbx-status { font-family: var(--cbx-font); font-weight: 700; font-size: 15px; color: #2d2a32; background: #fff; border: 3px solid #2d2a32; border-radius: 30px; padding: 6px 12px; box-shadow: 0 4px 0 #2d2a32; cursor: pointer; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.cbx-status[data-state=synced] { background: #dcfce7; } .cbx-status[data-state=syncing], .cbx-status[data-state=paused] { background: #fef9c3; }
.cbx-status[data-state=error], .cbx-status[data-state=denied], .cbx-status[data-state=conflict] { background: #fee2e2; } .cbx-status[data-state=offline] { background: #e5e7eb; }
@media (max-width: 640px) { .cbx-status { order: 10; font-size: 13px; padding: 5px 10px; } }
.cbx-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.cbx-stat { background: var(--cbx-soft); border-radius: 14px; padding: 10px; text-align: center; }
.cbx-stat b { display: block; font-size: 1.25rem; } .cbx-stat span { font-size: .8rem; color: var(--cbx-ink-2); }
.cbx-ach { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cbx-achv { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 8px; border-radius: 14px; border: 2px dashed var(--cbx-line); opacity: .6; }
.cbx-achv.got { opacity: 1; border-style: solid; border-color: #fcd34d; background: linear-gradient(160deg, #fffbeb, #fdf2f8); }
.cbx-achv .i { font-size: 26px; } .cbx-achv b { font-size: .9rem; } .cbx-achv small { font-size: .75rem; color: var(--cbx-ink-2); }
.cbx-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cbx-choice ul { margin: 8px 0 0; padding-left: 18px; }
@media (max-width: 560px) { .cbx-stats { grid-template-columns: 1fr 1fr; } .cbx-ach { grid-template-columns: 1fr 1fr; } .cbx-choices { grid-template-columns: 1fr; } }
.cbx-toasts { position: fixed; z-index: 210000; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; font-family: var(--cbx-font); }
.cbx-toast { pointer-events: auto; padding: 12px 16px; border-radius: 14px; background: var(--cbx-ink); color: #fff; font-weight: 600; box-shadow: var(--cbx-shadow); opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; }
.cbx-toast.cbx-show { opacity: 1; transform: none; }
.cbx-toast.cbx-success { background: #15803d; } .cbx-toast.cbx-error { background: #b91c1c; } .cbx-toast.cbx-warn { background: #b45309; }

@media (max-width: 520px) {
  .cbx-overlay { align-items: flex-end; padding: 0; }
  .cbx-modal { max-height: 94vh; border-radius: 24px 24px 0 0; }
  .cbx-modal-head { padding: 18px 18px 4px; } .cbx-modal-body { padding: 8px 18px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .cbx-overlay, .cbx-modal, .cbx-toast, .cbx-btn, .cbx-x { transition: none; }
}

/* ---------- "Save Progress with Google" (Google sign-in button guidelines: light theme) ---------- */
.gsi-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 40px; padding: 0 14px 0 12px; border-radius: 20px;
  background: #fff; border: 1px solid #747775; color: #1f1f1f; font-family: 'Roboto', arial, sans-serif; font-weight: 500; font-size: 14px; letter-spacing: .25px; line-height: 20px;
  white-space: nowrap; cursor: pointer; transition: background-color .2s, box-shadow .2s; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.gsi-btn .gsi-icon { display: flex; width: 20px; height: 20px; flex: none; }
.gsi-btn:hover:not(:disabled) { background: #f7f8f8; box-shadow: 0 1px 2px 0 rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15); }
.gsi-btn:active:not(:disabled) { background: #eeeff0; }
.gsi-btn:focus-visible { outline: 3px solid rgba(66, 133, 244, .55); outline-offset: 2px; }
.gsi-btn:disabled { cursor: default; border-color: rgba(31, 31, 31, .12); color: rgba(31, 31, 31, .38); }
.gsi-btn:disabled .gsi-icon { opacity: .38; }
.gsi-btn.cbx-busy .cbx-spin { border-color: rgba(0, 0, 0, .12); border-top-color: #4285f4; }

/* game page: Google saving slot in the top bar and the reminder banner on the home screen */
.cbx-cloudslot { display: flex; align-items: center; }
.cbx-gbanner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 12px; max-width: 620px; padding: 12px 14px; border-radius: 18px;
  background: #fff; border: 3px solid #2d2a32; box-shadow: 0 4px 0 #2d2a32; font-family: var(--cbx-font); color: #2d2a32; text-align: left; }
.cbx-gbanner[hidden] { display: none; }
.cbx-gbanner-text { flex: 1 1 240px; display: flex; flex-direction: column; gap: 2px; }
.cbx-gbanner-text b { font-size: 17px; } .cbx-gbanner-text span { font-size: 15px; font-weight: 500; opacity: .85; }
@media (max-width: 640px) {
  .cbx-cloudslot { order: 10; width: 100%; justify-content: center; }
  .cbx-gbanner { margin-left: auto; margin-right: auto; justify-content: center; text-align: center; }
}

/* Etsy buttons: Etsy orange with the Etsy "E" mark */
.cbx-etsy { color: #fff; background: #f1641e; box-shadow: 0 10px 22px -10px rgba(241, 100, 30, .8); }
.cbx-etsy:hover:not(.cbx-disabled) { background: #e2560f; }
.cbx-etsy .etsy-mark { display: inline-flex; width: 18px; height: 18px; }

/* ---------- Add to Home Screen ---------- */
.cbx-install-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 20px; border: 3px solid #2d2a32; background: #fff2a8;
  box-shadow: 0 3px 0 #2d2a32; font-family: var(--cbx-font); font-weight: 700; font-size: 15px; color: #2d2a32; white-space: nowrap; cursor: pointer; }
.cbx-install-btn:hover { background: #ffe97a; }
.cbx-install-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #2d2a32; }
.cbx-install-btn[hidden] { display: none; }
.cbx-install-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.cbx-install-hero img { flex: none; border-radius: 18px; box-shadow: 0 10px 22px -12px rgba(124, 58, 237, .8); }
.cbx-install-hero .cbx-p { margin: 0; }
.cbx-steps { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 12px; }
.cbx-steps li { display: flex; align-items: flex-start; gap: 12px; font-size: 1.02rem; line-height: 1.45; }
.cbx-stepn { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--cbx-primary), var(--cbx-primary-2)); }
.cbx-key { display: inline-block; padding: 1px 8px; border-radius: 8px; border: 1px solid var(--cbx-line); background: var(--cbx-soft); font-weight: 700; white-space: nowrap; }
@media (max-width: 640px) { .cbx-install-btn { order: 11; } }
.pf-applist { display: flex; flex-wrap: wrap; gap: 8px; }
