:root {
  --bg: #e8e0f0;
  --panel-bg: #f2eef8;
  --titlebar: #5a4a7a;
  --titlebar-deep: #3a2a5a;
  --border: #b8a8d0;
  --text: #2a1a3a;
  --text-muted: #9a8aaa;
  --accent: #9a7abf;
  --accent2: #c4a8e8;
  --scrollbar: #c4b4d8;
  --roll-bg: #ede5f8;
  --key-white-top: #f8f4ff;
  --key-white-bot: #e8e0f0;
  --key-shadow: #c0b0d8;
  --key-black-top: #4a3a62;
  --key-black-bot: #2a1a3a;
  --msg-bg: #fff;
  --input-bg: #fff;
  --name-bg: #e8e0f0;
  --stripe1: var(--accent);
  --stripe2: var(--bg);
  --members-bg: #ede7f8;
  --members-hover: #e0d8f0;
}

[data-theme="dark"] {
  --bg: #1a1425;
  --panel-bg: #221830;
  --titlebar: #3a2a5a;
  --titlebar-deep: #1a0a3a;
  --border: #4a3a6a;
  --text: #e0d8f0;
  --text-muted: #7a6a9a;
  --accent: #9a7abf;
  --accent2: #c4a8e8;
  --scrollbar: #4a3a6a;
  --roll-bg: #1e1530;
  --key-white-top: #2e2245;
  --key-white-bot: #221833;
  --key-shadow: #4a3a6a;
  --key-black-top: #150f22;
  --key-black-bot: #0a0612;
  --msg-bg: #2a1e3d;
  --input-bg: #2a1e3d;
  --name-bg: #1e1530;
  --stripe1: #3a2a5a;
  --stripe2: #1a1425;
  --members-bg: #1e1530;
  --members-hover: #2a1e3d;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 28px 28px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
}

#topbar {
  background: linear-gradient(180deg, #6e5a90 0%, var(--titlebar) 60%, var(--titlebar-deep) 100%);
  padding: 0 16px;
  display: flex;
  align-items: center;
  height: 44px;
  flex-shrink: 0;
  border-bottom: 2px solid var(--titlebar-deep);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  gap: 10px;
}

.logo { display: flex; align-items: baseline; gap: 1px; text-decoration: none; }
.logo-bea  { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.logo-hash { font-size: 22px; font-weight: 900; color: var(--accent2); line-height: 1; }

#theme-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #e0d8f0;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 11px;
  border-radius: 2px;
  letter-spacing: 0.3px;
  transition: background 0.15s;
}
#theme-toggle:hover { background: rgba(255,255,255,0.2); }

#main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

#stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

#stripe {
  height: 6px;
  flex-shrink: 0;
  background: repeating-linear-gradient(
    90deg,
    var(--stripe1) 0px, var(--stripe1) 10px,
    var(--stripe2) 10px, var(--stripe2) 18px
  );
  opacity: 0.45;
}

#roll-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--roll-bg);
  min-height: 0;
}
#roll-canvas { position: absolute; top: 0; left: 0; }

#load-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 21, 48, 0.55);
  backdrop-filter: blur(2px);
  z-index: 5;
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
#load-overlay.hidden { opacity: 0; }
#load-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
#load-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(196,168,232,0.25);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
#load-text {
  font-size: 11px;
  letter-spacing: 0.4px;
  color: rgba(240,232,255,0.6);
}

#piano-wrap {
  flex-shrink: 0;
  border-top: 2px solid var(--border);
  background: var(--panel-bg);
  height: 110px;
  overflow: hidden;
}
#piano-canvas { display: block; }

#performer-toast {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform: translate(-50%, 50%);
  background: rgba(58, 42, 90, 0.92);
  color: #f0e8ff;
  padding: 6px 16px;
  border-radius: 3px;
  font-size: 12px;
  letter-spacing: 0.3px;
  border: 1px solid var(--border);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  z-index: 10;
}
#performer-toast.visible { opacity: 1; }

@keyframes msgIn {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.msg { animation: msgIn 0.18s ease-out; }

#sidebar {
  width: 270px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 2px solid var(--border);
  background: var(--panel-bg);
  min-height: 0;
  overflow: hidden;
}

.panel-title {
  background: var(--titlebar);
  color: #f0e8ff;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#clear-chat {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #e0d8f0;
  padding: 2px 7px;
  cursor: pointer;
  font-size: 10px;
  border-radius: 2px;
  letter-spacing: 0.3px;
  text-transform: none;
}
#clear-chat:hover { background: rgba(255,255,255,0.2); }

#members-bar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--members-bg);
  font-size: 11px;
}

#members-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.3px;
  text-align: left;
  transition: background 0.1s, color 0.1s;
}
#members-toggle:hover {
  background: var(--members-hover);
  color: var(--text);
}
#members-count { flex: 1; }

#members-chevron {
  font-size: 9px;
  opacity: 0.6;
}

#members-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
}
#members-list.open { max-height: 160px; overflow-y: auto; }

.member-entry {
  padding: 4px 10px 4px 22px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.member-entry:hover { background: var(--members-hover); color: var(--text); }
.member-entry.performer-entry {
  color: #f0c040;
  font-weight: bold;
}

#members-list::-webkit-scrollbar { width: 4px; }
#members-list::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 2px; }

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 0;
}
#chat-messages::-webkit-scrollbar { width: 5px; }
#chat-messages::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

.msg {
  background: var(--msg-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
  flex-shrink: 0;
}
.msg-body { position: relative; }
.msg .author          { font-weight: bold; color: var(--accent); margin-right: 4px; cursor: pointer; }
.msg .author:hover    { text-decoration: underline; }
.msg .author.performer { color: #f0c040; }
.msg .time            { color: var(--text-muted); font-size: 10px; float: right; margin-left: 6px; }

/* reply quote (ghosted block above message body) */
.msg-reply-quote {
  border-left: 2px solid var(--reply-color, var(--accent));
  padding: 2px 6px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 0 2px 2px 0;
  background: rgba(0,0,0,0.04);
}
[data-theme="dark"] .msg-reply-quote { background: rgba(255,255,255,0.04); }
.reply-quote-name {
  color: var(--reply-color, var(--accent));
  font-weight: bold;
  margin-right: 4px;
}

/* reply bar above input */
#reply-bar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--name-bg);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  min-height: 0;
  overflow: hidden;
}
#reply-bar.open { display: flex; }
#reply-bar-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#reply-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}
#reply-cancel:hover { color: var(--text); }

/* @mention tag */
.mention-tag {
  color: var(--mention-color, var(--accent2));
  font-weight: 600;
}

/* reply button on messages */
.reply-btn {
  float: right;
  margin-left: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  line-height: 1;
  transition: opacity 0.15s, color 0.15s;
  vertical-align: middle;
}
.msg:hover .reply-btn { opacity: 0.55; }
.reply-btn:hover       { opacity: 1 !important; color: var(--accent); }

#chat-input-row {
  display: flex;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#chat-name {
  width: 75px;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--name-bg);
  padding: 7px 8px;
  font-size: 12px;
  color: var(--text);
  outline: none;
  flex-shrink: 0;
}
#chat-msg {
  flex: 1;
  min-width: 0;
  border: none;
  background: var(--input-bg);
  padding: 7px 8px;
  font-size: 12px;
  color: var(--text);
  outline: none;
}
#chat-send {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.1s;
  flex-shrink: 0;
}
#chat-send:hover { background: var(--titlebar); }


/* ── sidebar wider ────────────────────────────────────────── */
#sidebar {
  width: 340px;
}
@media (max-width: 768px) {
  #sidebar {
    width: 100% !important;
  }
}
#piano-wrap {
  height: 80px !important;
}

/* ── emote tray ───────────────────────────────────────────── */
#emote-tray {
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 0;
  background: var(--panel-bg);
  border-top: 1px solid var(--border);
  transition: max-height 0.2s ease;
}
#emote-tray.open {
  display: flex;
  max-height: 160px;
}
#emote-tray::-webkit-scrollbar { width: 4px; }
#emote-tray::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 2px; }

.emote-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.1s;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.emote-item:hover { background: var(--members-hover); }
.emote-item span { color: var(--text-muted); font-size: 11px; }

#emote-btn {
  background: rgba(255,255,255,0.0);
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 16px;
  padding: 0 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}
#emote-btn:hover, #emote-btn.active {
  color: var(--accent2);
  background: var(--members-hover);
}

/* ── emote images (inline in messages) ───────────────────── */
img.emote {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  position: relative;
  top: -1px;
  image-rendering: pixelated;
  border-radius: 2px;
}
/* ── emote input preview strip ──────────────────────────── */
#emote-input-preview,
#mention-input-preview {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--name-bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 0;
}
#emote-input-preview.open,
#mention-input-preview.open { display: flex; }
.emote-input-chip,
.mention-input-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--msg-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 11px;
  color: var(--text-muted);
}
.emote-input-chip img {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  image-rendering: pixelated;
}

/* ── color picker ─────────────────────────────────────────── */
#color-swatch-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
}

#color-swatch {
  width: 28px;
  height: 100%;
  border: none;
  cursor: pointer;
  border-radius: 0;
  transition: filter 0.15s;
  outline: none;
}
#color-swatch:hover { filter: brightness(1.15); }

#color-picker-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  z-index: 100;
  width: 108px;
}
#color-picker-popup.open { display: grid; }

.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, border-color 0.1s;
}
.color-dot:hover { transform: scale(1.15); }
.color-dot.selected {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.3);
}

/* ── shared draw window ───────────────────────────────────── */
#draw-win {
  position: fixed;
  z-index: 200;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  user-select: none;
}

#draw-titlebar {
  background: var(--titlebar);
  color: #f0e8ff;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  border-radius: 4px 4px 0 0;
}
#draw-titlebar:active { cursor: grabbing; }

#draw-close {
  background: none;
  border: none;
  color: rgba(240,232,255,0.6);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
#draw-close:hover { color: #f0e8ff; }

#draw-body {
  position: relative;
  line-height: 0;
}

#draw-canvas {
  display: block;
  cursor: crosshair;
  image-rendering: pixelated;
}

#draw-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.draw-cursor-label {
  position: absolute;
  background: rgba(42,26,58,0.85);
  color: #e0d8f0;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid rgba(196,168,232,0.3);
  transform: translateX(-50%);
}

#draw-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-top: 1px solid var(--border);
  background: var(--name-bg);
  border-radius: 0 0 4px 4px;
}

#draw-swatches {
  display: flex;
  gap: 4px;
}

.draw-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, border-color 0.1s;
  outline: 1px solid rgba(0,0,0,0.2);
}
.draw-swatch:hover { transform: scale(1.15); }
.draw-swatch.selected {
  border-color: var(--accent2);
  outline: 1px solid rgba(196,168,232,0.5);
}

#draw-size {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.1s;
}
#draw-size:hover { background: var(--members-hover); color: var(--text); }

#draw-clear {
  margin-left: auto;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.1s;
}
#draw-clear:hover { background: rgba(191,122,122,0.2); color: #e8a8a8; }

#draw-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #e0d8f0;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 2px;
  transition: background 0.15s;
}
#draw-toggle:hover { background: rgba(255,255,255,0.2); }

.member-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ── Fishing minigame ──────────────────────────────────────────────── */

/* ── Cast + Dex HUD ─────────────────────────────────────────────── */
#fish-hud {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  gap: 5px;
  align-items: center;
}
#fish-cast-btn,
#fish-dex-btn {
  background: linear-gradient(180deg, rgba(110,90,144,0.92) 0%, rgba(58,42,90,0.96) 100%);
  border: 1px solid rgba(196,168,232,0.4);
  border-bottom-color: rgba(30,15,50,0.6);
  color: #e8e0f8;
  font-size: 12px;
  padding: 5px 13px;
  cursor: pointer;
  letter-spacing: 0.3px;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
#fish-cast-btn:hover:not(:disabled),
#fish-dex-btn:hover {
  background: linear-gradient(180deg, rgba(140,110,190,0.95) 0%, rgba(80,55,120,0.98) 100%);
  box-shadow: 0 3px 10px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.18);
}
#fish-cast-btn:disabled { opacity: 0.42; cursor: default; box-shadow: none; }

/* ── Status text ─────────────────────────────────────────────────── */
#fish-status {
  display: none;    /* hidden until a state class is applied */
  position: absolute;
  bottom: 42px;
  right: 10px;
  z-index: 10;
  font-size: 11px;
  background: rgba(26,14,45,0.82);
  border: 1px solid rgba(196,168,232,0.22);
  border-radius: 3px;
  padding: 3px 9px;
  pointer-events: none;
  max-width: 220px;
  text-align: right;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: color 0.3s;
}
#fish-status.catch   { display: block; color: var(--accent2); font-weight: 600; }
#fish-status.miss    { display: block; color: #e88080; }
#fish-status.cooldown { display: block; color: var(--text-muted); }
#fish-status.cooldown .fish-combo-dots { color: #ffd700; letter-spacing: 1px; }

/* ── Chat announce ───────────────────────────────────────────────── */
.msg.fish-announce {
  background: linear-gradient(135deg, rgba(90,55,140,0.10) 0%, var(--msg-bg) 65%);
  border-color: rgba(180,140,255,0.38);
  font-size: 12px;
}
.fish-ann-icon  { margin-right: 3px; }
.fish-perfect   { font-style: italic; font-size: 11px; opacity: 0.85; }
.fish-ann-weight { opacity: 0.65; font-size: 11px; }

/* ── Hover stats tooltip ─────────────────────────────────────────── */
#fish-stats-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(34,20,52,0.96);
  border: 1px solid rgba(196,168,232,0.35);
  border-radius: 4px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.5);
  min-width: 140px;
  pointer-events: auto;
  overflow: hidden;
  font-size: 12px;
}
.fish-tt-header {
  background: linear-gradient(180deg, rgba(110,90,144,0.9) 0%, rgba(58,42,90,0.95) 100%);
  color: #f0e8ff;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 5px 10px;
  border-bottom: 1px solid rgba(196,168,232,0.2);
}
.fish-tt-body { padding: 6px 10px; display: flex; flex-direction: column; gap: 3px; }
.fish-tt-row  { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.fish-tt-label { color: var(--text-muted); font-size: 11px; }
.fish-tt-val   { color: #e0d8f0; font-weight: 600; font-size: 12px; }

/* ── Modal overlay ───────────────────────────────────────────────── */
#fish-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,4,18,0.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
#fish-modal-overlay.open { display: flex; }

#fish-modal {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: min(560px, 96vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 36px rgba(0,0,0,0.55), 0 0 0 1px rgba(196,168,232,0.08);
}

/* titlebar matches topbar / draw-titlebar style */
#fish-modal-titlebar {
  background: linear-gradient(180deg, #6e5a90 0%, var(--titlebar) 60%, var(--titlebar-deep) 100%);
  color: #f0e8ff;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 0 10px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--titlebar-deep);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset;
  flex-shrink: 0;
}
#fish-modal-close {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(240,232,255,0.7);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 1px 6px 2px;
  border-radius: 2px;
  transition: background 0.15s, color 0.15s;
}
#fish-modal-close:hover { background: rgba(255,255,255,0.2); color: #f0e8ff; }

/* tabs — styled like panel-title / members-toggle */
#fish-modal-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--members-bg);
}
.fish-tab {
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 7px 16px;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}
.fish-tab:hover  { background: var(--members-hover); color: var(--text); }
.fish-tab.active {
  background: var(--panel-bg);
  color: var(--accent2);
  border-bottom: 2px solid var(--accent2);
  margin-bottom: -1px;
}

.fish-tab-panel           { display: none; overflow-y: auto; padding: 12px; flex: 1; }
.fish-tab-panel.active    { display: block; }
.fish-tab-panel::-webkit-scrollbar       { width: 5px; }
.fish-tab-panel::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

/* ── Fish dex ────────────────────────────────────────────────────── */
.fish-dex-stats {
  display: flex;
  gap: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 12px;
  background: var(--members-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.fish-dex-stats span {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  border-right: 1px solid var(--border);
}
.fish-dex-stats span:last-child { border-right: none; }

.fish-tier        { margin-bottom: 16px; }
.fish-tier-label  {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 7px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.fish-tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 7px;
}
.fish-card {
  background: var(--msg-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 6px 6px;
  text-align: center;
  font-size: 11px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.fish-card.caught {
  border-color: rgba(180,140,255,0.45);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15), 0 0 0 1px rgba(180,140,255,0.12);
}
.fish-card.uncaught { opacity: 0.45; filter: grayscale(0.3); }
.fish-card-art {
  width: 64px;
  height: 64px;
  border-radius: 3px;
  margin: 0 auto 5px;
  border: 2px solid rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.fish-card-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
[data-theme="dark"] .fish-card-art { border-color: rgba(255,255,255,0.06); }

/* pickup float tip */
.fish-pickup-tip {
  position: fixed;
  pointer-events: none;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 1px 5px rgba(0,0,0,0.95), 0 0 10px rgba(0,0,0,0.6);
  white-space: nowrap;
  transform: translateX(-50%);
  z-index: 9999;
  animation: fish-float-up 2s ease-out forwards;
  letter-spacing: 0.03em;
}
.fish-pickup-perfect {
  font-size: 17px;
  color: #ffd700 !important;
  text-shadow: 0 0 8px #ffe066, 0 0 20px #ffb700, 0 1px 5px rgba(0,0,0,0.95);
  animation: fish-float-up-perfect 2.4s ease-out forwards;
}
@keyframes fish-float-up {
  0%   { opacity: 1;   transform: translateX(-50%) translateY(0);     }
  15%  { opacity: 1;   transform: translateX(-50%) translateY(-10px);  }
  100% { opacity: 0;   transform: translateX(-50%) translateY(-80px);  }
}
@keyframes fish-float-up-perfect {
  0%   { opacity: 1;   transform: translateX(-50%) translateY(0)    scale(1);    }
  10%  { opacity: 1;   transform: translateX(-50%) translateY(-8px)  scale(1.18); }
  100% { opacity: 0;   transform: translateX(-50%) translateY(-100px) scale(0.9); }
}
/* glitter particles */
.fish-glitter-particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  animation: fish-glitter-burst 0.75s ease-out forwards;
}
@keyframes fish-glitter-burst {
  0%   { opacity: 1; transform: translate(-50%,-50%) translate(0,0)     scale(1);   }
  60%  { opacity: 1; transform: translate(-50%,-50%) translate(var(--tx),var(--ty)) scale(0.8); }
  100% { opacity: 0; transform: translate(-50%,-50%) translate(var(--tx),var(--ty)) scale(0);   }
}
.fish-card-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fish-card-meta { color: var(--text-muted); font-size: 10px; }

/* ── Leaderboard ─────────────────────────────────────────────────── */
.fish-lb-empty,
.fish-lb-loading { color: var(--text-muted); text-align: center; padding: 28px 0; font-size: 12px; }
.fish-lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.fish-lb-table thead tr {
  background: var(--members-bg);
  border-bottom: 2px solid var(--border);
}
.fish-lb-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 7px 10px;
}
.fish-lb-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(180,140,255,0.08);
  color: var(--text);
}
.fish-lb-table tr:last-child td { border-bottom: none; }
.fish-lb-rank { color: var(--text-muted); font-size: 11px; }
.fish-lb-me td { color: var(--accent2); font-weight: 600; }
.fish-lb-me td:first-child { color: var(--accent2); }
