:root {
  --bg: #0b141a;
  --header: #202c33;
  --panel: #111b21;
  --panel-2: #182229;
  --border: rgba(134, 150, 160, 0.15);
  --text: #e9edef;
  --muted: #8696a0;
  --accent: #00a884;
  --accent-2: #008069;
  --bubble-in: #202c33;
  --bubble-out: #005c4b;
  --green: #25d366;
  --red: #f15c6d;
  --gold: #fbbf24;
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Roboto, Arial, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

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

/* ================= Layout ================= */
.app {
  display: flex;
  height: 100%;
  height: 100dvh;
  height: var(--app-h, 100dvh);
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

/* ================= Sidebar ================= */
.sidebar {
  width: 360px;
  min-width: 280px;
  max-width: 40vw;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(134, 150, 160, 0.08);
}

.sidebar-header {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--header);
  flex-shrink: 0;
}
.logo {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.sb-title { min-width: 0; flex: 1; }
.sb-title h1 { font-size: 17px; font-weight: 600; line-height: 1.1; }
.sb-title .sub { font-size: 11px; color: var(--muted); }
.sb-actions { display: flex; gap: 6px; }

.icon-btn {
  background: transparent;
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 19px;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(134, 150, 160, 0.12); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.badge {
  position: absolute;
  top: 2px; right: 0;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  background: var(--accent);
  color: #041a15;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
}
.chat-group {
  display: flex;
  align-items: center;
  padding: 10px 14px 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(134, 150, 160, 0.07);
  text-align: left;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.chat-item:hover { background: rgba(134, 150, 160, 0.06); }
.chat-item.active { background: var(--header); }
.chat-item.active:hover { background: var(--header); }
.cavatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 21px;
  flex-shrink: 0;
}
.chat-item.active .cavatar { background: rgba(0, 168, 132, 0.15); border-color: transparent; }
.cinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cname { font-size: 15px; font-weight: 500; line-height: 1.2; }
.cpreview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.cmeta { display: flex; align-items: center; align-self: flex-start; padding-top: 4px; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: #555; flex-shrink: 0; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 1.6s ease-in-out infinite; }
.dot.off { background: var(--red); box-shadow: 0 0 8px var(--red); }
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 10px 14px;
  background: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.sidebar-footer .status { display: flex; align-items: center; gap: 7px; white-space: nowrap; }

/* ================= Pane principal ================= */
.pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.pane-header {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--header);
  flex-shrink: 0;
}
.pane-header .avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 19px;
  flex-shrink: 0;
}
.pane-info { min-width: 0; }
.pane-title { font-size: 16px; font-weight: 600; line-height: 1.2; }
.pane-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.pane-sub.talking { color: var(--green); }
.menu-btn { display: none; }

.pane-body {
  flex: 1;
  min-height: 0;
  position: relative;
}

.view { position: absolute; inset: 0; display: none; flex-direction: column; }

body[data-view="chat"] .view-chat,
body[data-view="race"] .view-race,
body[data-view="word"] .view-word,
body[data-view="quiz"] .view-quiz,
body[data-view="chain"] .view-chain,
body[data-view="hide"] .view-hide { display: flex; }

/* ================= Chat (burbujas estilo WhatsApp) ================= */
.chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  -webkit-overflow-scrolling: touch;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cg fill='none' stroke='rgba(255,255,255,0.05)' stroke-width='1'%3E%3Ccircle cx='40' cy='40' r='11'/%3E%3Ccircle cx='64' cy='56' r='6'/%3E%3Crect x='108' y='28' width='14' height='14' rx='4'/%3E%3Cpath d='M152 34l12 14-16 6z'/%3E%3Cpath d='M196 36a10 10 0 0 1 16 0'/%3E%3Cpath d='M28 110c9-9 18-9 27 0s18 9 27 0'/%3E%3Cpath d='M110 118c11 6 22 6 33 0s22-6 33 0'/%3E%3Ccircle cx='196' cy='128' r='8'/%3E%3Crect x='28' y='180' width='16' height='16'/%3E%3Cpath d='M96 190l14 14-14 14M116 190l14 14-14 14'/%3E%3Crect x='172' y='176' width='16' height='16' rx='3'/%3E%3Ccircle cx='200' cy='196' r='7'/%3E%3C/g%3E%3C/svg%3E");
}
.chat .empty { color: var(--muted); text-align: center; margin-top: 80px; font-size: 14px; }

.msg { display: flex; margin: 2px 0; animation: msgIn 0.22s ease; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg.out { justify-content: flex-end; }
.bubble {
  max-width: 72%;
  padding: 6px 9px 8px;
  border-radius: 7.5px;
  background: var(--bubble-in);
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.35);
  font-size: 14.2px;
  line-height: 19px;
  word-break: break-word;
  position: relative;
}
.msg.out .bubble { background: var(--bubble-out); }
.bubble .bname {
  display: block;
  color: #5ac7a5;
  font-size: 12.8px;
  font-weight: 600;
  margin-bottom: 1px;
}
.bubble .btime {
  float: right;
  color: rgba(233, 237, 239, 0.55);
  font-size: 11px;
  margin: 10px 0 -2px 8px;
  line-height: 15px;
  user-select: none;
}
.msg.out .bubble .btime { color: rgba(233, 237, 239, 0.5); }

/* Burbuja de mensaje de voz */
.bubble.voice { display: flex; align-items: center; gap: 8px; min-width: 190px; max-width: 280px; padding: 8px 10px 8px 8px; }
.vplay {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  border: none;
  color: var(--text);
  font-size: 12px;
  display: grid; place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s;
}
.vplay:active { transform: scale(0.9); }
.msg.out .bubble.voice .vplay { background: rgba(0, 0, 0, 0.18); }
.vwave {
  position: relative;
  flex: 1;
  min-width: 60px;
  height: 24px;
  overflow: hidden;
  background-image: repeating-linear-gradient(90deg, rgba(233, 237, 239, 0.35) 0 2px, transparent 2px 5px);
}
.msg.out .bubble.voice .vwave { background-image: repeating-linear-gradient(90deg, rgba(233, 237, 239, 0.4) 0 2px, transparent 2px 5px); }
.vfill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background-image: repeating-linear-gradient(90deg, var(--accent) 0 2px, transparent 2px 5px);
}
.vdur { font-size: 11px; color: rgba(233, 237, 239, 0.75); flex-shrink: 0; min-width: 32px; text-align: center; }
.bubble.voice .btime { margin-top: 0; align-self: flex-end; margin-left: 2px; }

.sys {
  align-self: center;
  margin: 8px 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 7.5px;
  padding: 5px 12px;
  max-width: 90%;
}

/* ================= Composer ================= */
.composer {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--header);
  flex-shrink: 0;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
body[data-view="chat"] .composer { display: flex; }
.composer .ptt, .composer .send { display: grid; }
.composer:not(.has-text) .send { display: none; }
.composer.has-text .ptt { display: none; }

.field { display: flex; gap: 8px; flex: 1; min-width: 0; align-items: center; }
input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: 24px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 16px; /* >=16px evita el zoom automático en iOS */
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus { border-color: var(--accent); }
input[type="text"]::placeholder { color: var(--muted); }

.ptt.round {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #041a15;
  font-size: 21px;
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.06s, background 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.ptt.round:active, .ptt.round.pressed { transform: scale(0.92); }
.ptt.round.talking { background: var(--red); color: #fff; animation: pulse 1.2s infinite; }
.ptt.round.denied { background: var(--red); color: #fff; }
.ptt.round[disabled] { background: #2a3942; color: var(--muted); cursor: not-allowed; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(241, 92, 109, 0.5); }
  70%  { box-shadow: 0 0 0 14px rgba(241, 92, 109, 0); }
  100% { box-shadow: 0 0 0 0 rgba(241, 92, 109, 0); }
}

.send.round {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #041a15;
  font-size: 18px;
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  box-shadow: none;
}
.send.round:hover { filter: brightness(1.08); }
.send.round:disabled { opacity: 0.5; cursor: not-allowed; }

/* ================= Paneles de juego ================= */
.game-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.race-status {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex-shrink: 0;
}
.race-status.racing { color: var(--green); border-color: rgba(37, 211, 102, 0.35); }
.race-status.won { color: var(--accent); border-color: rgba(0, 168, 132, 0.35); }

.race {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.race-empty {
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  padding: 30px 10px;
}
.lane {
  position: relative;
  height: 38px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  overflow: hidden;
}
.lane .track {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(90deg, transparent 0 18%, rgba(255,255,255,0.05) 18% 19%);
}
.lane .horse {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  transition: left 0.12s cubic-bezier(0.2, 0.9, 0.3, 1);
  white-space: nowrap;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.lane .horse.moving { animation: gallop 0.25s linear infinite; }
@keyframes gallop {
  0% { transform: translateY(-50%) scaleY(1); }
  50% { transform: translateY(-58%) scaleY(1.08); }
  100% { transform: translateY(-50%) scaleY(1); }
}
.lane .lname {
  position: absolute;
  right: 8px;
  top: 2px;
  font-size: 10px;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.lane .lname.me { color: var(--green); font-weight: 700; }
.lane .finish {
  position: absolute;
  right: 0;
  top: 0; bottom: 0;
  width: 4px;
  background: repeating-linear-gradient(180deg, #fff 0 6px, #111 6px 12px);
  animation: finishShine 1.2s linear infinite;
}
@keyframes finishShine {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 0.4; }
}

.race-actions { display: flex; gap: 8px; flex-shrink: 0; }
.race-actions .send { flex: 1; padding: 12px 0; }

.send {
  background: var(--accent);
  border: none;
  border-radius: 24px;
  color: #041a15;
  font-weight: 600;
  font-size: 15px;
  padding: 10px 18px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: filter 0.15s, transform 0.1s;
}
.send:hover { filter: brightness(1.08); }
.send:active { transform: scale(0.96); }
.send:disabled { opacity: 0.45; cursor: not-allowed; }
.send.secondary {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.ptt.mini {
  width: 100%;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ptt.mini small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.ptt.mini svg, .utalk svg { vertical-align: -3px; }
.ptt.mini.talking, .ptt.mini.pressed {
  background: rgba(37, 211, 102, 0.12);
  border-color: var(--green);
  color: var(--green);
}
.ptt.mini.talking small { color: var(--green); }
.ptt.mini[disabled] { opacity: 0.5; cursor: not-allowed; }

.game-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 14px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  text-align: center;
  flex-shrink: 0;
}
.game-box .empty { color: var(--muted); font-size: 13px; }

.word-display {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.1;
  word-break: break-word;
  max-width: 100%;
  color: var(--text);
}
.word-display.guess { color: var(--accent); font-size: 28px; }
.word-progress { font-size: 12px; color: var(--muted); }
.game-box .race-actions { width: 100%; }

.quiz-q { font-size: 16px; font-weight: 700; line-height: 1.35; }
.quiz-meta { font-size: 12px; color: var(--muted); }
.quiz-opts {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.quiz-opt {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); }
.quiz-opt:active:not(:disabled) { transform: scale(0.96); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.correct { background: rgba(37, 211, 102, 0.15); border-color: var(--green); }
.quiz-opt.wrong { background: rgba(241, 92, 109, 0.15); border-color: var(--red); }
.quiz-opt.pick { outline: 2px solid var(--accent); }

.chain-word {
  font-size: 34px; font-weight: 800; letter-spacing: 1px; word-break: break-word; max-width: 100%;
  color: var(--text);
}
.chain-hint { font-size: 12px; color: var(--muted); }

/* ================= El escondite ================= */
.hide-board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  aspect-ratio: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  flex-shrink: 0;
}
.hide-cell {
  aspect-ratio: 1;
  border: none;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 15px;
  display: grid;
  place-items: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, transform 0.08s;
}
.hide-cell.empty { background: rgba(255, 255, 255, 0.05); color: var(--muted); font-size: 13px; }
.hide-cell.doll {
  background: linear-gradient(135deg, rgba(0, 168, 132, 0.5), rgba(0, 128, 105, 0.5));
  font-size: 18px;
  animation: hidePop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.hide-cell.doll.me { outline: 2px solid var(--green); }
.hide-cell.pickable { cursor: pointer; }
.hide-cell.pickable:hover:not(:disabled) { background: rgba(0, 168, 132, 0.25); }
.hide-cell.pickable:active:not(:disabled) { transform: scale(0.9); }
.hide-cell:disabled { cursor: default; }
.hide-hint { font-size: 12px; color: var(--muted); text-align: center; flex-shrink: 0; }
@keyframes hidePop {
  0% { transform: scale(0.3); }
  70% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.rank { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  animation: msgIn 0.25s ease;
}
.rank-row:first-child { border-color: rgba(251, 191, 36, 0.5); }
.rank-row .medal { font-size: 16px; flex-shrink: 0; }
.rank-row .rname { font-weight: 600; }
.rank-row .rscore { margin-left: auto; font-weight: 700; color: var(--accent); }

/* ================= Modal ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.modal label { font-size: 12px; color: var(--muted); }
.modal .modal-close { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); padding: 12px 0; }
.modal input { font-size: 16px; }

.user-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.user-row .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #041a15;
  flex-shrink: 0;
}
.user-row .uname { font-size: 14px; font-weight: 600; }
.user-row .ume { margin-left: auto; font-size: 11px; color: var(--accent); }
.user-row .utalk { margin-left: auto; font-size: 11px; color: var(--green); font-weight: 600; animation: blink 0.9s ease-in-out infinite; display: inline-flex; align-items: center; gap: 4px; }
.user-list .empty { color: var(--muted); text-align: center; padding: 20px; font-size: 13px; }

/* ================= Toast ================= */
.toast-wrap {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 420px);
}
.toast {
  background: rgba(23, 26, 33, 0.92);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  animation: toastIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast.out { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-14px); }
}

/* ================= Scrollbar ================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(134, 150, 160, 0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(134, 150, 160, 0.4); }

/* ================= Responsive ================= */
@media (max-width: 899px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 50;
    max-width: 85vw;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: grid; }
  .backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
  }
  .backdrop[hidden] { display: none; }
  .bubble { max-width: 82%; }
}
