@font-face {
  font-family: 'Lagu Sans';
  src: url('../assets/fonts/Lagu Sans Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lagu Sans';
  src: url('../assets/fonts/Lagu Sans Light Italic.otf') format('opentype');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Lagu Sans';
  src: url('../assets/fonts/Lagu Sans Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lagu Sans';
  src: url('../assets/fonts/Lagu Sans Regular Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Lagu Sans';
  src: url('../assets/fonts/Lagu Sans Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lagu Sans';
  src: url('../assets/fonts/Lagu Sans SemiBold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lagu Sans';
  src: url('../assets/fonts/Lagu Sans Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lagu Sans';
  src: url('../assets/fonts/Lagu Sans Bold Italic.otf') format('opentype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg-app:        #d0d5dc;
  --bg-sidebar:    #c8cdd5;
  --bg-chat:       #e8eaee;
  --text-sender:   #8b8e96;
  --bg-header:     #d8dbe2;
  --bg-bubble:     #ffffff;
  --bg-input:      #e0e3e8;
  --border-soft:   rgba(160,168,185,0.5);
  --border-med:    rgba(140,150,170,0.7);
  --accent-gold:   #c8a84b;
  --accent-dark:   #7a6530;
  --text-primary:  #2a2e3a;
  --text-secondary:#5a6075;
  --text-muted:    #8a90a0;
  --text-light:    #aab0c0;
  --contact-hover: rgba(200,205,215,0.8);
  --contact-active:#e8e0c8;
  --shadow-soft:   0 2px 12px rgba(0,0,0,0.08);
  --radius:        8px;
  --radius-sm:     5px;
  --ed-bg:         #1a1e28;
  --ed-border:     #2e3548;
  --ed-accent:     #4f7cff;
  --ed-teal:       #38d9c0;
  --ed-text:       #c8cedd;
  --ed-muted:      #5a6280;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: 'Lagu Sans', sans-serif; }
html { font-synthesis: none; }
body { font-family: 'Lagu Sans', sans-serif; background: #181c26; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-med); border-radius: 4px; }
 
/* TOP NAV */
#app-nav {
  background: rgba(30,34,46,0.97);
  border-bottom: 1px solid rgba(200,168,75,0.25);
  padding: 0 20px;
  height: 44px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; gap: 16px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-icon { width: 28px; height: 28px; background: rgba(200,168,75,0.15); border: 1px solid rgba(200,168,75,0.4); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--accent-gold); }
.nav-title { font-family: 'Lagu Sans', sans-serif; font-size: 15px; font-weight: 700; letter-spacing: 4px; color: var(--accent-gold); }
.nav-dot { width: 4px; height: 4px; background: var(--accent-gold); border-radius: 50%; opacity: 0.5; }
.nav-subtitle { font-size: 11px; color: rgba(200,168,75,0.5); letter-spacing: 1px; font-weight: 300; }
.nav-actions { display: flex; gap: 8px; }
.nav-btn { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm); color: #8890a8; font-family: 'Lagu Sans', sans-serif; font-size: 11px; font-weight: 700; padding: 5px 14px; cursor: pointer; letter-spacing: 0.5px; transition: all 0.2s; }
.nav-btn:hover { border-color: var(--ed-accent); color: #fff; }
.nav-btn.teal { border-color: rgba(56,217,192,0.3); color: var(--ed-teal); }
.nav-btn.teal:hover { background: rgba(56,217,192,0.1); }
.nav-btn.gold { border-color: rgba(200,168,75,0.4); color: var(--accent-gold); }
.nav-btn.gold:hover { background: rgba(200,168,75,0.1); }
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-menu { display: none; position: absolute; top: calc(100% + 4px); right: 0; background: var(--bg-panel); border: 1px solid rgba(200,168,75,0.35); border-radius: var(--radius-sm); z-index: 999; min-width: 120px; overflow: hidden; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.nav-dropdown-menu.open { display: block; }
.nav-dropdown-menu button { display: block; width: 100%; background: none; border: none; color: var(--accent-gold); font-family: 'Lagu Sans', sans-serif; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; padding: 9px 16px; text-align: left; cursor: pointer; transition: background 0.15s; white-space: nowrap; }
.nav-dropdown-menu button:hover { background: rgba(200,168,75,0.1); }
 
/* WAVESLINE WINDOW */
#wavesline-window {
  flex: 1; display: flex; min-height: 0;
  background: var(--bg-app);
  background-image: radial-gradient(ellipse at 30% 50%, rgba(200,168,75,0.03) 0%, transparent 60%);
}
 
/* SIDEBAR */
#sidebar { width: 310px; min-width: 240px; background: var(--bg-sidebar); border-right: 1px solid var(--border-med); display: flex; flex-direction: column; flex-shrink: 0; position: relative; }
#sidebar::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 1px; background: linear-gradient(180deg, transparent, rgba(200,168,75,0.3), transparent); pointer-events: none; }
#contacts-list { flex: 1; overflow-y: auto; }
 
.contact-item { display: flex; align-items: center; gap: 0; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border-soft); position: relative; transition: background 0.15s; min-height: 62px; }
.contact-item:hover { background: var(--contact-hover); }
.contact-item.active { background: var(--contact-active); border-left: 3px solid var(--accent-gold); padding-left: 11px; }
.contact-item.active::after { content: '▶'; position: absolute; right: 10px; font-size: 8px; color: var(--accent-gold); }
.contact-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--bg-input); border: 1px solid var(--border-med); display: flex; align-items: center; justify-content: center; font-family: 'Lagu Sans', sans-serif; font-size: 14px; font-weight: 700; color: var(--text-secondary); overflow: hidden; flex-shrink: 0; }
.contact-avatar img { width: 125%; height: 125%; object-fit: cover; object-position: center; margin: -10%; }
.contact-avatar img.avatar-uploaded { width: 100%; height: 100%; margin: 0; }
.contact-vline { width: 1px; height: 38px; background: linear-gradient(180deg, transparent, var(--border-med), transparent); margin: 0 10px; flex-shrink: 0; }
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 14px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.2px; }
.contact-bar { height: 1px; background: linear-gradient(90deg, var(--accent-gold), transparent); opacity: 0.3; margin-top: 4px; }
.contact-preview { font-size: 10px; color: var(--text-muted); margin-top: 3px; letter-spacing: 1.5px; font-weight: 300; font-family: 'Lagu Sans', sans-serif; }
.contact-delete { background: none; border: none; color: var(--text-light); cursor: pointer; font-size: 15px; padding: 2px 4px; border-radius: 3px; transition: color 0.15s; opacity: 0; flex-shrink: 0; }
.contact-item:hover .contact-delete { opacity: 1; }
.contact-delete:hover { color: #e05050; }
 
/* Group avatar — circle with chat bubble icon */
.group-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--contact-active);
  border: 1px solid rgba(200,168,75,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.group-avatar svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
 
/* Group editor panel */
.group-member-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 100px;
  overflow-y: auto;
  margin-bottom: 6px;
  border: 1px solid var(--ed-border);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  background: rgba(255,255,255,0.02);
}
.group-member-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ed-text);
  padding: 2px 0;
}
.group-member-item input[type="checkbox"] { accent-color: var(--ed-teal); cursor: pointer; }
.group-member-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.group-existing-list { display: flex; flex-direction: column; gap: 3px; max-height: 90px; overflow-y: auto; margin-bottom: 6px; }
 
/* CHAT PANEL */
#chat-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-chat); position: relative; overflow: hidden; }
#chat-panel::before, #chat-panel::after { display: none; }
 
/* Bottom-left decorative chrome */
#chat-decor { display: none; }
.cd-line { position: absolute; top: 0; bottom: 0; width: 1px; }
.cd-line-bold { left: 8px; background: rgba(160,168,185,0.22); }
.cd-line-thin  { left: 14px; background: rgba(160,168,185,0.10); }
.cd-svg { position: absolute; left: 0; bottom: 0; width: 200px; height: 160px; }
 
/* Chat Header */
#chat-header { background: var(--bg-header); border-bottom: 2px solid rgba(200,168,75,0.25); padding: 14px 28px 12px; flex-shrink: 0; position: relative; z-index: 1; }
#header-contact-name { font-size: 20px; font-weight: 700; color: var(--text-primary); letter-spacing: 0.3px; font-family: 'Lagu Sans', sans-serif; }
#header-meta { display: flex; align-items: center; gap: 12px; margin-top: 3px; }
.header-tag { font-size: 10px; color: var(--text-muted); letter-spacing: 1px; font-weight: 300; font-family: 'Lagu Sans', sans-serif; }
.header-dot { width: 5px; height: 5px; background: var(--accent-gold); border-radius: 50%; opacity: 0.6; }
 
/* Date sep */
.wl-date-sep { display: flex; align-items: center; gap: 10px; padding: 8px 28px; flex-shrink: 0; position: relative; z-index: 1; }
.wl-date-line { flex: 1; height: 1px; background: var(--border-soft); }
.wl-date-text { font-size: 10px; color: var(--text-muted); letter-spacing: 2px; font-weight: 300; display: flex; align-items: center; gap: 6px; }
.wl-date-dot { width: 4px; height: 4px; background: var(--accent-gold); border-radius: 50%; opacity: 0.5; }
 
/* Messages */
#messages-scroll { flex: 1; overflow-y: auto; padding: 8px 28px 20px; display: flex; flex-direction: column; gap: 0; position: relative; z-index: 1; background-color: #dbe0e3; background-image: url('../assets/background/default.webp'); background-repeat: no-repeat; background-position: left bottom; background-size: 1609px 1030px; }
#empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--text-muted); padding: 40px; }
.empty-line-icon { display: flex; align-items: center; gap: 0; opacity: 0.45; }
.empty-line-icon .el-line { width: 60px; height: 1px; background: var(--text-muted); }
.empty-line-icon .el-circle { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--text-muted); display: flex; align-items: center; justify-content: center; margin: 0 2px; }
.empty-line-icon .el-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); }
.empty-text { font-size: 13px; letter-spacing: 0.3px; opacity: 0.55; font-family: 'Lagu Sans', sans-serif; }
 
/* Message block */
 
/* Bubble */
.wl-bubble { background: var(--bg-bubble); border: 1px solid var(--border-soft); border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 12px 16px; font-size: 16px; line-height: 1.6; color: var(--text-primary); word-break: break-word; width: fit-content; max-width: 100%; box-shadow: var(--shadow-soft); position: relative; font-family: 'Lagu Sans', sans-serif; font-weight: 700; }
.wl-bubble::before { content: ''; position: absolute; top: -1px; left: -8px; border: 4px solid transparent; border-right-color: var(--border-soft); border-top-color: var(--border-soft); }
.wl-bubble::after { content: ''; position: absolute; top: 0; left: -6px; border: 3px solid transparent; border-right-color: var(--bg-bubble); border-top-color: var(--bg-bubble); }
.bubble-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; letter-spacing: 0.2px; }
.bubble-img { max-width: 100%; max-height: 280px; border-radius: var(--radius-sm); display: block; }
.sticker-el { font-size: 62px; line-height: 1; }
.sticker-img { width: 120px; height: 120px; object-fit: contain; display: block; }
 
/* Sticker picker */
#chat-order-row { display: flex; }
#chat-sender-radios { display: flex; }
 
.sys-radio-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.sys-radio-row input[type="radio"] { accent-color: var(--ed-teal); flex-shrink: 0; cursor: pointer; }
.sys-radio-label { min-width: 48px; cursor: pointer; }
.sys-radio-input { flex: 1; transition: opacity 0.15s; }
.sys-radio-input:disabled { opacity: 0.3; cursor: default; }
#chat-stk-popout { box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
#chat-stk-btn { transition: border-color 0.15s, color 0.15s; }
 
.stk-vol-btn { background: rgba(255,255,255,0.04); border: 1px solid var(--ed-border); border-radius: var(--radius-sm); color: var(--ed-muted); font-family: 'Lagu Sans', sans-serif; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; padding: 3px 10px; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.stk-vol-btn.active { border-color: var(--ed-teal); color: var(--ed-teal); background: rgba(56,217,192,0.08); }
.stk-char-section { margin-bottom: 8px; }
.stk-char-label { font-size: 9px; font-weight: 700; letter-spacing: 1px; color: var(--ed-muted); text-transform: uppercase; margin-bottom: 4px; }
.stk-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.stk-item { width: 54px; height: 54px; border-radius: var(--radius-sm); border: 2px solid transparent; cursor: pointer; overflow: hidden; background: rgba(255,255,255,0.04); display: flex; align-items: center; justify-content: center; transition: border-color 0.15s, background 0.15s; flex-shrink: 0; flex-direction: column; }
.stk-item:hover { border-color: rgba(56,217,192,0.4); background: rgba(56,217,192,0.06); }
.stk-item.selected { border-color: var(--ed-teal); background: rgba(56,217,192,0.12); }
.stk-item img { width: 46px; height: 46px; object-fit: contain; }
 
/* Message block (avatar + name + bubble) */
.msg-block { display: flex; gap: 14px; padding: 8px 0; align-items: flex-start; }
.msg-block.rover-side { flex-direction: row-reverse; }
.msg-block-avatar { width: 68px; height: 68px; border-radius: 50%; background: var(--bg-input); border: 2px solid var(--border-med); display: flex; align-items: center; justify-content: center; font-family: 'Lagu Sans', sans-serif; font-size: 21px; font-weight: 700; color: var(--text-secondary); flex-shrink: 0; margin-top: 2px; position: relative; }
.msg-block-avatar img { width: 125%; height: 125%; object-fit: cover; object-position: center; margin: -10%; border-radius: 50%; }
.msg-block-avatar img.avatar-uploaded { width: 100%; height: 100%; margin: 0; border-radius: 50%; }
.msg-block-avatar img.avatar-preset { border-radius: 0; }
.msg-block-avatar:has(img.avatar-uploaded) { border-color: transparent; }
.msg-block-avatar:has(img.avatar-uploaded)::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--avatar-border-color, var(--border-med)); pointer-events: none; z-index: 2; }
.msg-block-body { min-width: 0; max-width: 75%; }
.msg-block-body.rover-body { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; }
.msg-block-sender { font-size: 18px; font-weight: 700; color: var(--text-sender); margin-bottom: 4px; letter-spacing: 0.3px; font-family: 'Lagu Sans', sans-serif; }
 
/* Rover bubble — notch on right, inverted colors */
.wl-bubble.rover-bubble { border-radius: var(--radius) 0 var(--radius) var(--radius); background: var(--text-primary); color: var(--bg-bubble); border-color: var(--text-primary); }
.wl-bubble.rover-bubble::before { left: auto; right: -8px; border: 4px solid transparent; border-left-color: var(--text-primary); border-top-color: var(--text-primary); border-right-color: transparent; }
.wl-bubble.rover-bubble::after { left: auto; right: -6px; border: 3px solid transparent; border-left-color: var(--text-primary); border-top-color: var(--text-primary); border-right-color: transparent; }
.bubble-wrap { display: flex; align-items: center; gap: 6px; }
.bubble-edit-btn { opacity: 0; pointer-events: none; background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-muted); transition: opacity 0.15s, color 0.15s; flex-shrink: 0; line-height: 1; }
.bubble-edit-btn svg { display: block; }
.bubble-wrap:hover .bubble-edit-btn { opacity: 1; pointer-events: auto; }
.bubble-edit-btn:hover { color: var(--ed-teal); }
.bubble-edit-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 180px; max-width: 100%; }
.bubble-edit-wrap textarea { background: var(--bg-input); border: 1px solid var(--ed-border); border-radius: 8px; color: var(--text-primary); font-family: 'Lagu Sans', sans-serif; font-size: 14px; line-height: 1.5; padding: 8px 10px; resize: vertical; min-height: 60px; width: 100%; box-sizing: border-box; }
.bubble-edit-wrap textarea:focus { outline: none; border-color: var(--ed-teal); }
.bubble-edit-actions { display: flex; gap: 6px; }
.bubble-edit-actions button { font-size: 11px; padding: 3px 10px; border-radius: 6px; border: none; cursor: pointer; font-family: 'Lagu Sans', sans-serif; }
.bubble-save-btn { background: var(--ed-teal); color: #fff; }
.bubble-cancel-btn { background: rgba(255,255,255,0.07); color: var(--text-muted); border: 1px solid var(--ed-border) !important; }
 
/* System */
.wl-system { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-width: 0; }
.wl-system-line { flex: 1; height: 1px; background: var(--border-soft); }
.wl-system-text { font-size: 10px; color: var(--text-muted); letter-spacing: 1.5px; white-space: normal; word-break: break-word; text-align: center; flex-shrink: 1; min-width: 0; padding: 0 4px; }
 
/* Quest — oval toast */
.wl-quest {
  background: #f0f2f5;
  border-radius: 40px;
  padding: 0;
  max-width: 480px;
  margin: 8px auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  position: relative;
  width: 100%;
}
.wl-quest.completed { background: #eaf7f0; }
.quest-check-bg {
  position: absolute;
  right: 56px; top: 50%; transform: translateY(-50%);
  width: 70px; height: 70px;
  opacity: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  transition: opacity 0.3s;
}
.wl-quest.completed .quest-check-bg { opacity: 1; }
.quest-check-svg { width: 60px; height: 60px; }
.quest-icon-col {
  width: 52px; height: 52px; flex-shrink: 0;
  background: var(--accent-gold);
  border-radius: 50%;
  margin: 8px 0 8px 8px;
  display: flex; align-items: center; justify-content: center;
}
.quest-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 10px 12px;
  position: relative; z-index: 1;
}
.quest-status-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.quest-status-text {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--text-muted); text-transform: uppercase;
  font-family: 'Lagu Sans', sans-serif;
}
.wl-quest.completed .quest-status-text { color: #52a878; }
.quest-status-line { flex: 1; height: 1px; background: var(--border-soft); }
.quest-title-wl {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  font-family: 'Lagu Sans', sans-serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
 
.quest-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent-gold);
  display: flex; align-items: center; justify-content: center;
  margin: auto 10px auto 0;
  transition: transform 0.15s;
  position: relative; z-index: 2;
  box-shadow: 0 2px 6px rgba(200,168,75,0.3);
}
.quest-btn:hover { transform: scale(1.08); }
.quest-btn svg { width: 20px; height: 20px; fill: white; }
 
/* Reward — oval toast */
.wl-reward {
  background: #f0f2f5;
  border-radius: 40px;
  padding: 0;
  max-width: 480px;
  margin: 8px auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
  width: 100%;
}
.wl-reward.claimed { background: #eaf7f0; }
.reward-check-bg {
  position: absolute;
  right: 12px; top: 50%; transform: translateY(-50%);
  width: 70px; height: 70px;
  opacity: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  transition: opacity 0.3s;
}
.wl-reward.claimed .reward-check-bg { opacity: 1; }
.reward-item-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 8px;
  margin: 9px 0 9px 12px;
  background: #2a2e3a;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  font-size: 16px;
  position: relative; z-index: 1;
}
.reward-item-icon img { width: 100%; height: 100%; object-fit: cover; }
.reward-body {
  flex: 1; min-width: 0;
  padding: 10px 12px;
  position: relative; z-index: 1;
  display: flex; align-items: center;
}
.reward-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.reward-chip {
  font-size: 11px; color: var(--text-secondary);
  font-family: 'Lagu Sans', sans-serif;
}
.reward-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent-gold);
  display: flex; align-items: center; justify-content: center;
  margin: auto 10px auto 0;
  transition: transform 0.15s;
  position: relative; z-index: 2;
  box-shadow: 0 2px 6px rgba(200,168,75,0.3);
}
.reward-btn:hover { transform: scale(1.08); }
.reward-btn svg { width: 20px; height: 20px; fill: white; }
 
/* EDITOR STRIP */
#editor-strip { background: var(--ed-bg); border-top: 1px solid rgba(200,168,75,0.2); flex-shrink: 0; display: flex; flex-direction: column; max-height: 50vh; }
#editor-tabs { display: flex; border-bottom: 1px solid var(--ed-border); flex-shrink: 0; overflow-x: auto; }
.ed-tab { padding: 8px 18px; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--ed-muted); cursor: pointer; border: none; background: none; font-family: 'Lagu Sans', sans-serif; transition: all 0.2s; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ed-tab:hover { color: var(--ed-text); }
.ed-tab.active { color: var(--ed-teal); border-bottom-color: var(--ed-teal); }
.ed-tab.tab-contacts.active { color: var(--accent-gold); border-bottom-color: var(--accent-gold); }
#editor-body { flex: 1; overflow-y: auto; min-height: 0; }
.ed-panel { display: none; padding: 12px 18px; }
.ed-panel.active { display: block; }
.ed-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.ed-field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 110px; }
.ed-label { font-size: 9px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ed-muted); }
.ed-input, .ed-select, .ed-textarea { background: rgba(255,255,255,0.05); border: 1px solid var(--ed-border); border-radius: var(--radius-sm); color: var(--ed-text); font-family: 'Lagu Sans', sans-serif; font-size: 12px; padding: 6px 10px; outline: none; transition: border-color 0.2s; width: 100%; }
.ed-input:focus, .ed-select:focus, .ed-textarea:focus { border-color: var(--ed-teal); }
.ed-select option { background: #1a1e28; }
.ed-textarea { resize: none; height: 52px; }
.ed-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: none; border-radius: var(--radius-sm); font-family: 'Lagu Sans', sans-serif; font-weight: 700; font-size: 11px; cursor: pointer; letter-spacing: 0.5px; padding: 7px 16px; transition: all 0.2s; white-space: nowrap; }
.ed-btn-primary { background: rgba(79,124,255,0.15); border: 1px solid var(--ed-accent); color: #8ab4ff; }
.ed-btn-primary:hover { background: rgba(79,124,255,0.25); }
.ed-btn-teal { background: rgba(56,217,192,0.1); border: 1px solid var(--ed-teal); color: var(--ed-teal); }
.ed-btn-teal:hover { background: rgba(56,217,192,0.2); }
.ed-btn-gold { background: rgba(200,168,75,0.1); border: 1px solid rgba(200,168,75,0.5); color: var(--accent-gold); }
.ed-btn-gold:hover { background: rgba(200,168,75,0.2); }
.ed-btn-danger { background: rgba(224,80,80,0.1); border: 1px solid rgba(224,80,80,0.4); color: #e08080; }
.ed-btn-danger:hover { background: rgba(224,80,80,0.2); }
.ed-btn-sm { padding: 5px 10px; font-size: 10px; }
.ed-btn-gold { background: rgba(200,168,75,0.1); border: 1px solid var(--accent-gold); color: var(--accent-gold); }
.ed-btn-danger { background: rgba(220,80,80,0.1); border: 1px solid rgba(220,80,80,0.4); color: #e08080; }
.ed-btn-danger:hover { background: rgba(220,80,80,0.2); }
.ed-btn-sm { padding: 5px 12px; font-size: 10px; }
 
/* Contact editor list */
.ced-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; max-height: 110px; overflow-y: auto; }
.ced-item { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.03); border: 1px solid var(--ed-border); border-radius: var(--radius-sm); padding: 5px 10px; font-size: 12px; color: var(--ed-text); }
.ced-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ced-name { flex: 1; }
.ced-sub { font-size: 10px; color: var(--ed-muted); }
.ced-del { background: none; border: none; color: var(--ed-muted); cursor: pointer; font-size: 14px; padding: 1px 4px; border-radius: 3px; transition: color 0.15s; }
.ced-del:hover { color: #e05050; }
 
/* Msg editor list */
.med-list { display: flex; flex-direction: column; gap: 4px; max-height: 120px; overflow-y: auto; margin-bottom: 8px; }
.med-item { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.03); border: 1px solid var(--ed-border); border-radius: var(--radius-sm); padding: 5px 8px; font-size: 11px; color: var(--ed-text); }
.med-type { font-size: 9px; letter-spacing: 1px; color: var(--ed-teal); text-transform: uppercase; flex-shrink: 0; min-width: 42px; }
.med-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ed-muted); }
.mctrl { background: none; border: 1px solid var(--ed-border); border-radius: 3px; color: var(--ed-muted); cursor: pointer; font-size: 10px; padding: 1px 5px; transition: all 0.15s; }
.mctrl:hover { border-color: var(--ed-accent); color: var(--ed-text); }
.mctrl.del:hover { border-color: #e0505088; color: #e08080; }
 
/* Colors */
.color-btn { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ed-border); cursor: pointer; transition: border-color 0.2s, transform 0.15s; flex-shrink: 0; background: #fff; }
.color-btn:hover { border-color: var(--ed-teal); transform: scale(1.1); }
 
/* File input */
input[type="file"] { font-size: 11px; color: var(--ed-muted); background: rgba(255,255,255,0.03); border: 1px solid var(--ed-border); border-radius: var(--radius-sm); padding: 5px 8px; width: 100%; cursor: pointer; }
input[type="file"]::file-selector-button { background: rgba(255,255,255,0.07); border: 1px solid var(--ed-border); border-radius: 3px; color: var(--ed-muted); font-size: 10px; padding: 3px 8px; cursor: pointer; margin-right: 8px; }
 
/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.open { display: flex; }
.modal-box { background: #1e2232; border: 1px solid var(--ed-border); border-radius: var(--radius); padding: 22px; width: 340px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.modal-box h3 { font-family: 'Lagu Sans', sans-serif; font-size: 16px; letter-spacing: 3px; color: var(--accent-gold); margin-bottom: 14px; text-transform: uppercase; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }
 
/* Toast */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(16px); background: #1e2232; border: 1px solid var(--ed-teal); border-radius: 20px; padding: 7px 20px; font-size: 12px; color: var(--ed-teal); opacity: 0; transition: all 0.3s; pointer-events: none; z-index: 999; white-space: nowrap; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
 
/* ── Cropper Modal ── */
#cropper-modal .modal-box { width: 400px; max-width: 96vw; }
#cropper-stage {
  position: relative;
  width: 320px; height: 320px;
  margin: 0 auto 14px;
  overflow: hidden;
  background: #0d1020;
  border: 1px solid var(--ed-border);
  border-radius: var(--radius-sm);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
#cropper-stage:active { cursor: grabbing; }
#cropper-canvas { position: absolute; top: 0; left: 0; pointer-events: none; display: block; }
#cropper-overlay { position: absolute; inset: 0; pointer-events: none; }
#cropper-zoom-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
#cropper-zoom-row span { font-size: 10px; color: var(--ed-muted); letter-spacing: 1px; text-transform: uppercase; flex-shrink: 0; }
#cropper-zoom { flex: 1; -webkit-appearance: none; appearance: none; height: 3px; background: var(--ed-border); border-radius: 3px; outline: none; cursor: pointer; }
#cropper-zoom::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--ed-teal); cursor: pointer; border: 2px solid #1e2232; }
#cropper-hint { font-size: 10px; color: var(--ed-muted); text-align: center; margin-bottom: 10px; letter-spacing: 0.3px; }
 
/* ── Rover Setup Modal ── */
#rover-modal .modal-box { width: 380px; }
.rover-intro { font-size: 12px; color: var(--ed-muted); line-height: 1.6; margin-bottom: 16px; }
.gender-switch {
  display: flex;
  gap: 0;
  border: 1px solid var(--ed-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 4px;
}
.gender-btn {
  flex: 1;
  padding: 8px 0;
  background: rgba(255,255,255,0.03);
  border: none;
  color: var(--ed-muted);
  font-family: 'Lagu Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.gender-btn:first-child { border-right: 1px solid var(--ed-border); }
.gender-btn.active-male { background: rgba(79,124,255,0.18); color: #8ab4ff; }
.gender-btn.active-female { background: rgba(232,122,138,0.18); color: #f0a0b0; }
 
/* Rover tab style */
.ed-tab.tab-rover.active { color: #f0a0b0; border-bottom-color: #f0a0b0; }
.ed-tab.tab-rover.active.male { color: #8ab4ff; border-bottom-color: #8ab4ff; }
.ed-tab.tab-presets.active { color: var(--accent-gold); border-bottom-color: var(--accent-gold); }
 
/* Presets grid */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 2px 0;
}
.preset-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--ed-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}
.preset-card:hover { border-color: var(--accent-gold); background: rgba(200,168,75,0.06); }
.preset-card.already-added { border-color: rgba(56,217,192,0.4); opacity: 0.6; cursor: default; }
.preset-card.already-added:hover { border-color: rgba(56,217,192,0.4); background: rgba(255,255,255,0.03); }
.preset-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--ed-border);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--ed-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--ed-muted);
}
.preset-avatar img { width: 125%; height: 125%; object-fit: cover; object-position: center; margin: -10%; }
.preset-info { flex: 1; min-width: 0; }
.preset-name { font-size: 12px; font-weight: 700; color: var(--ed-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset-activity { font-size: 9px; color: var(--ed-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.3px; }
.preset-check { position: absolute; top: 5px; right: 6px; font-size: 9px; color: var(--ed-teal); font-weight: 700; letter-spacing: 0.5px; }
.preset-card.has-forms { padding-right: 32px; }
.preset-form-btn {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--accent-gold); background: rgba(200,168,75,0.12);
  color: var(--accent-gold); font-size: 12px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.preset-form-btn:hover { background: rgba(200,168,75,0.25); transform: translateY(-50%) scale(1.1); }
.preset-card.has-forms.already-added .preset-form-btn { right: 6px; top: 50%; }
.preset-card.has-forms .preset-check { top: 5px; right: 6px; }
.preset-card.has-forms.already-added { padding-right: 36px; }
 
/* Rover panel summary */
.rover-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--ed-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.rover-avatar-preview {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  flex-shrink: 0;
  border: 2px solid;
}
.rover-summary-info { flex: 1; min-width: 0; }
.rover-summary-name { font-size: 13px; font-weight: 700; color: var(--ed-text); }
.rover-summary-gender { font-size: 10px; color: var(--ed-muted); letter-spacing: 1px; margin-top: 2px; }
 
/* Override section */
.override-divider {
  height: 1px;
  background: var(--ed-border);
  margin: 10px 0 10px;
}
.override-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(200,168,75,0.1);
  border: 1px solid rgba(200,168,75,0.35);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  color: var(--accent-gold);
  font-weight: 700;
  letter-spacing: 0.5px;
}
.override-avatar-sm {
  width: 20px; height: 20px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--accent-gold);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  flex-shrink: 0;
  vertical-align: middle;
}
.override-avatar-sm img { width: 125%; height: 125%; object-fit: cover; object-position: center; margin: -10%; }
 
/* ── MOBILE (≤768px) ─────────────────────── */
@media (max-width: 768px) {

  /* Use dynamic viewport height so browser chrome (address bar) is excluded */
  body {
    overflow: hidden;
    height: 100dvh;
  }

  /* Nav: collapse subtitle, shrink buttons */
  #app-nav { padding: 0 12px; gap: 8px; }
  .nav-subtitle { display: none; }
  .nav-dot { display: none; }
  .nav-btn { padding: 5px 10px; font-size: 10px; }

  /* wavesline-window: vertical flex column, fills space between app-nav and mobile-nav */
  #wavesline-window {
    flex-direction: column;
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
  }

  /* ── CONTACTS TAB ──
     Sidebar fills the window. Editor strip and chat panel are hidden. */
  #sidebar {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-bottom: 1px solid var(--border-med);
    display: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
  #sidebar.mob-active { display: flex; }
  #sidebar::after { display: none; }

  /* ── CHAT TAB ──
     chat-panel fills the window alone. */
  #chat-panel {
    display: none;
    flex: 1;
    min-height: 0;
  }
  #chat-panel.mob-active { display: flex; }
  #chat-panel.capture-active { display: flex !important; width: 100vw; flex: 1; min-height: 0; }

  /* Editor strip: hidden by default, shown in two contexts:
     1. mob-active        → Edit tab (full height, flex:1, no chat panel)
     2. mob-chat-companion → Edit tab merged view (fixed height beneath chat-panel) */
  #editor-strip {
    display: none;
    flex-direction: column;
    overflow: hidden;
    border-top: none;
  }

  /* Edit tab: chat-panel (flex:1) rides above editor-strip (fixed height) */
  #chat-panel.mob-edit-companion {
    display: flex;
    flex: 1;
    min-height: 0;
  }

  #editor-strip.mob-active {
    display: flex;
    flex-shrink: 0;
    max-height: 46vh;
    min-height: 180px;
    border-top: 1px solid rgba(200,168,75,0.2);
  }

  #editor-body { flex: 1; overflow-y: auto; min-height: 0; }

  .ed-panel { padding: 14px 16px; }
  .ed-row { flex-wrap: wrap; }

  /* Quest/reward: full width */
  .wl-quest, .wl-reward { max-width: 100%; }

  /* Messages scroll padding */
  #messages-scroll { padding: 8px 16px 16px; }

  /* Message sizes for mobile */
  .wl-bubble { font-size: 13.5px; }
  .bubble-img { max-height: 240px; }
  .sticker-el { font-size: 52px; }
  .msg-block { gap: 12px; }
  .msg-block-avatar { width: 60px; height: 60px; font-size: 18px; }
  .msg-block-sender { font-size: 13px; }

  /* Cropper */
  #cropper-modal .modal-box { width: 96vw; }
  #cropper-stage { width: 280px; height: 280px; }
  #cropper-canvas, #cropper-overlay { width: 280px !important; height: 280px !important; }

  /* ── Bottom navigation bar ── */
  #mobile-nav {
    display: flex;
    flex-shrink: 0;
    height: calc(54px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(24,28,38,0.98);
    border-top: 1px solid rgba(200,168,75,0.2);
    z-index: 100;
  }
  .mob-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ed-muted);
    font-family: 'Lagu Sans', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: color 0.2s;
    position: relative;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-nav-btn.active { color: var(--ed-teal); }
  .mob-nav-btn.active::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 2px;
    background: var(--ed-teal);
    border-radius: 0 0 2px 2px;
  }
  .mob-nav-btn svg {
    width: 22px; height: 22px;
    stroke: currentColor; fill: none;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  }
  .mob-nav-btn.active svg { stroke: var(--ed-teal); }

  /* Toast: lift above nav bar + safe area */
  #toast { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

  /* Chat tab: mobile input layout */
  #panel-chat .chat-txt-field-desktop,
  #panel-chat .chat-img-field-desktop,
  #panel-chat .chat-time-field-desktop,
  #panel-chat .chat-add-btn-desktop { display: none !important; }
  #panel-chat .chat-row-msg  { display: block !important; }
  #panel-chat .chat-row-meta { display: flex  !important; }
  #panel-chat .chat-contact-field { max-width: none !important; flex: 1; min-width: 0; }
  #panel-chat .chat-row-top { flex-wrap: nowrap; }
  #chat-sender-radios { width: 100%; }
  #chat-sender-radios .gender-btn { font-size: 11px; padding: 6px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Sticker popout: taller picker, tighter padding */
  #chat-stk-popout { padding: 8px 6px; }
  #stk-picker { max-height: 200px; }
}
 
/* Desktop: mobile nav always hidden */
@media (min-width: 769px) {
  #mobile-nav { display: none; }
  /* Ensure all panels visible on desktop regardless of mob classes */
  #sidebar, #chat-panel, #editor-strip { display: flex !important; }
}
