/* ================================================
   NATIVE APP FEEL + HEADER v8 — NO HARDCODED COLOR
   ================================================ */

/* Disable pull-to-refresh & bounce */
html, body {
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: auto;
  touch-action: manipulation;
}

body {
  position: relative;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, pre, code, .result-text, .chat-bubble.ai {
  -webkit-user-select: text;
  user-select: text;
}

img {
  -webkit-user-drag: none;
  user-drag: none;
}
img.clickable {
  pointer-events: auto;
}

* {
  -webkit-overflow-scrolling: touch;
}

::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}
* {
  scrollbar-width: none;
}

button, a, .fx-card, .fx-icon-btn, .btn-action {
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

/* ==== HEADER ==== */
header.fx-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 10px 14px;
  margin: 0;
  box-sizing: border-box;
  width: 100%;
  max-width: 100vw;
  background: rgba(255,255,255,0.9);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(148,163,184,0.15);
}

body.theme-dark header.fx-header {
  background: rgba(15,23,42,0.9);
  border-bottom-color: rgba(255,255,255,0.08);
}

/* ==== SEARCH BAR ==== */
.fx-search-wrap {
  width: 100%;
  max-width: 100%;
  padding: 14px 14px 10px;
  box-sizing: border-box;
}

.fx-search-wrap input {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  transition: all .2s;
  background: #fff;
  border: 1.5px solid rgba(148,163,184,0.25);
  color: #0f172a;
  box-shadow: 0 2px 12px rgba(30,64,175,0.06);
}

.fx-search-wrap input::placeholder { color: #94a3b8; }
.fx-search-wrap input:focus {
  border-color: #0EA5E9;
  box-shadow: 0 4px 18px rgba(14,165,233,0.15), 0 0 0 4px rgba(14,165,233,0.08);
}

body.theme-dark .fx-search-wrap input {
  background: rgba(30,41,59,0.7);
  border-color: rgba(255,255,255,0.1);
  color: #f1f5f9;
}

/* ==== PRELOAD ==== */
html.preload body { opacity: 0; }
html.preload { background: #f0f7ff; }
html[data-theme="dark"].preload { background: #0a0f1a; }

/* ==== EDIT NAME MODAL ==== */
.enm-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.enm-modal {
  width: 100%;
  max-width: 360px;
  border-radius: 22px;
  padding: 26px 22px 20px;
  text-align: center;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15,23,42,0.35);
  animation: enmSlide .3s cubic-bezier(.2,.9,.3,1.2);
}

@keyframes enmSlide {
  from { opacity: 0; transform: translateY(24px) scale(.95); }
  to { opacity: 1; transform: none; }
}

.enm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(14,165,233,.15), rgba(99,102,241,.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.enm-title {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}
.enm-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 18px;
  line-height: 1.4;
}
.enm-input {
  width: 100%;
  padding: 14px 16px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  font-size: 15px;
  font-family: inherit;
  color: #0f172a;
  text-align: center;
  outline: none;
  box-sizing: border-box;
  font-weight: 600;
}
.enm-input:focus {
  border-color: #0EA5E9;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(14,165,233,0.1);
}
.enm-counter {
  font-size: 10px;
  color: #94a3b8;
  text-align: right;
  margin-top: 6px;
  margin-bottom: 18px;
  font-family: monospace;
  font-weight: 600;
}
.enm-counter.warn { color: #dc2626; }
.enm-buttons { display: flex; gap: 8px; }
.enm-btn {
  flex: 1;
  padding: 13px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  border: 0;
}
.enm-btn.ghost {
  background: #f1f5f9;
  color: #64748b;
}
.enm-btn.primary {
  background: linear-gradient(135deg, #0EA5E9, #6366F1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(14,165,233,0.3);
}

body.theme-dark .enm-modal { background: #1e293b; }
body.theme-dark .enm-title { color: #f1f5f9; }
body.theme-dark .enm-sub { color: #94a3b8; }
body.theme-dark .enm-input {
  background: rgba(15,23,42,0.6);
  border-color: rgba(255,255,255,0.1);
  color: #f1f5f9;
}
body.theme-dark .enm-btn.ghost {
  background: rgba(51,65,85,0.8);
  color: #cbd5e1;
}
