/* ZincirX shared theme — used across portfolio + all games */
:root {
  --bg-grad-1: #ffe5b0;
  --bg-grad-2: #ffb86b;
  --bg-grad-3: #c86b2a;
  --ink:       #231712;
  --ink-2:     #3b2616;
  --cream:     #fff5d6;
  --paper:     #fffaea;
  --red:       #e53935;
  --red-d:     #b71c1c;
  --gold:      #f4c542;
  --gold-d:    #d4a422;
  --green:     #2e7a2e;
  --green-l:   #7dd87d;
  --blue:      #4a90e2;
  --pink:      #ff8fb1;
  --font:      "Fredoka", "Comic Sans MS", "Chalkboard SE", system-ui, sans-serif;

  --shadow-hard: 0 4px 0 var(--ink);
  --shadow-soft: 0 8px 24px rgba(0,0,0,0.2);
  --radius:      14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}
html, body { overflow-x: hidden; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 50%, var(--bg-grad-3) 100%);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  -webkit-overflow-scrolling: touch;
}

/* Allow text selection in inputs + form fields even if UI text is no-select */
input, textarea { user-select: text; -webkit-user-select: text; }

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
}

/* ===== Shared header ===== */
.zx-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(255, 245, 214, 0.85);
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}
.zx-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.zx-logo {
  font-weight: 900;
  font-size: 22px;
  color: var(--red);
  text-shadow: 2px 2px 0 var(--gold);
  letter-spacing: 1px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.zx-logo:hover { text-decoration: none; transform: rotate(-2deg); transition: transform .15s; }
.zx-logo__emoji { font-size: 28px; }

.zx-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}
.zx-nav a {
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
}
.zx-nav a:hover {
  background: rgba(0,0,0,0.06);
  text-decoration: none;
}
.zx-nav a.active {
  background: var(--red);
  color: white;
}

/* On narrow screens, nav becomes a dropdown menu behind a hamburger */
@media (max-width: 720px) {
  .zx-nav {
    display: none;
  }
  .zx-nav.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    background: rgba(255, 245, 214, 0.98);
    border-bottom: 3px solid var(--ink);
    padding: 8px;
    gap: 4px;
    z-index: 49;
  }
  .zx-nav.open a {
    display: block;
    padding: 12px;
    font-size: 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.08);
  }
  .zx-hamburger { display: grid !important; }
}
.zx-hamburger {
  display: none;
  width: 40px; height: 40px;
  border: 2px solid var(--ink);
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
  place-items: center;
  font-size: 20px;
  font-family: inherit;
}

.zx-streak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: linear-gradient(135deg, #ffdd55, #ff9500);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
  box-shadow: 0 2px 0 var(--ink);
  color: var(--ink);
}

.zx-lang, .zx-namebtn {
  border: 2px solid var(--ink);
  background: white;
  border-radius: 8px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 2px 0 var(--ink);
  font-family: inherit;
  cursor: pointer;
}
.zx-lang:hover, .zx-namebtn:hover { background: var(--cream); }
.zx-namebtn {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.zx-namebtn--ghost { opacity: 0.7; background: transparent; }

/* ===== Container ===== */
.zx-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ===== Cards ===== */
.zx-card {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow-hard);
  padding: 20px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.zx-card:hover {
  transform: translateY(-4px) rotate(-0.5deg);
  box-shadow: 0 8px 0 var(--ink);
}

/* ===== Buttons ===== */
.zx-btn {
  display: inline-block;
  padding: 12px 22px;
  background: var(--red);
  color: white;
  border: 3px solid var(--ink);
  border-radius: 12px;
  font-weight: 900;
  font-size: 16px;
  box-shadow: var(--shadow-hard);
  transition: transform 0.1s, box-shadow 0.1s;
  letter-spacing: 1px;
  cursor: pointer;
  text-decoration: none !important;
}
.zx-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--ink);
}
.zx-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink);
}
.zx-btn--gold  { background: var(--gold); color: var(--ink); }
.zx-btn--green { background: var(--green); color: white; }
.zx-btn--ghost { background: white; color: var(--ink); }

/* ===== Friend challenge banner ===== */
.challenge-banner {
  display: flex;
  gap: 10px;
  align-items: center;
  background: linear-gradient(135deg, #ffdd55, #ff6600);
  color: var(--ink);
  padding: 10px 14px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  margin: 0 auto 10px;
  max-width: 560px;
  box-shadow: 0 3px 0 var(--ink);
  font-size: 14px;
  animation: challenge-pulse 2s ease-in-out infinite;
}
.challenge-banner__emoji { font-size: 24px; }
.challenge-banner__text { line-height: 1.3; }
.challenge-banner__text b { color: var(--red); }
@keyframes challenge-pulse {
  0%, 100% { box-shadow: 0 3px 0 var(--ink); }
  50%      { box-shadow: 0 3px 0 var(--ink), 0 0 20px rgba(255, 221, 85, 0.8); }
}
.challenge-victory {
  background: linear-gradient(135deg, #7dd87d, #2e7a2e);
  color: white;
  padding: 14px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  font-weight: 700;
  text-align: center;
  margin: 10px 0;
  box-shadow: 0 3px 0 var(--ink);
}

/* ===== Footer ===== */
.zx-footer {
  max-width: 1200px;
  margin: 40px auto 0;
  padding: 24px 16px;
  text-align: center;
  color: rgba(35, 23, 18, 0.6);
  font-size: 13px;
  line-height: 1.7;
}
.zx-footer a { color: var(--ink-2); text-decoration: underline; }

/* ===== App-mode (Capacitor native) tweaks ===== */
html.zx-native body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
html.zx-native .zx-header {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
html.zx-native .ad-slot,
html.zx-standalone .ad-slot {
  display: none !important;
}
html.zx-native .zx-footer {
  display: none !important;
}
/* Small screens: tighten portfolio grid padding */
@media (max-width: 480px) {
  .zx-container { padding: 14px 10px; }
  .zx-card { padding: 16px; }
}

/* ===== Bottom nav (mobile + native app) ===== */
.zx-bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--cream);
  border-top: 3px solid var(--ink);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
  z-index: 90;
  padding-bottom: env(safe-area-inset-bottom);
}
.zx-bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  color: var(--ink-2);
  text-decoration: none !important;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.5px;
  transition: color 0.1s, transform 0.1s;
}
.zx-bottom-nav__icon { font-size: 22px; }
.zx-bottom-nav__item.active { color: var(--red); }
.zx-bottom-nav__item:active { transform: scale(0.9); }

/* Show on mobile width OR when running native */
@media (max-width: 720px) {
  .zx-bottom-nav { display: flex; }
  /* Reserve space so content doesn't hide under the bar */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}
html.zx-native .zx-bottom-nav { display: flex; }
html.zx-native body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

/* Hide bottom nav on game pages so taps don't accidentally exit the game */
body.zx-in-game .zx-bottom-nav { display: none !important; }
body.zx-in-game { padding-bottom: env(safe-area-inset-bottom) !important; }
