/* ─── Reset & base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sky0:   #0d1b2a;
  --sky1:   #1b2d42;
  --water0: #0a4b6e;
  --water1: #012334;
  --surf:   #1a7090;

  --common:    #90A4AE;
  --uncommon:  #66BB6A;
  --rare:      #42A5F5;
  --epic:      #CE93D8;
  --legendary: #FFD54F;

  --text:    #E0F4FF;
  --text-dim: #7EB8D4;
  --card-bg:  rgba(255,255,255,0.06);
  --border:   rgba(255,255,255,0.10);

  --nav-h: 60px;
  --hdr-h: 52px;
}

html, body {
  height: 100%;
  background: var(--sky0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ─── Header ──────────────────────────────────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--hdr-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.header-left  { display: flex; align-items: center; gap: 8px; }
.avatar       { font-size: 22px; }
.username     { font-size: 14px; font-weight: 600; max-width: 140px;
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-right { display: flex; gap: 14px; }
.stat         { display: flex; align-items: center; gap: 4px;
                font-size: 13px; font-weight: 600; }
.stat-icon    { font-size: 15px; }

/* ─── Tabs ────────────────────────────────────────────────────────── */
.tab {
  position: fixed;
  top: var(--hdr-h); left: 0; right: 0;
  bottom: var(--nav-h);
  display: none;
  flex-direction: column;
}
.tab.active { display: flex; }

/* ─── Scene canvas ────────────────────────────────────────────────── */
.scene-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.scene {
  width: 100%; height: 100%;
  display: block;
}

/* ─── Overlay (status + buttons) ─────────────────────────────────── */
.overlay {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 20px 14px;
  gap: 8px;
  background: rgba(0,0,0,0.35);
  border-top: 1px solid var(--border);
}

.status-wrap { text-align: center; }
.status-text {
  font-size: 15px;
  color: var(--text-dim);
  min-height: 22px;
  transition: color 0.3s;
}
.status-text.alert { color: #FFD54F; font-weight: 700; }

/* ─── Buttons ─────────────────────────────────────────────────────── */
.btn {
  border: none; border-radius: 14px;
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  padding: 13px 32px;
  transition: transform 0.15s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.95); }

.btn-cast {
  background: linear-gradient(135deg, #1976D2, #0D47A1);
  color: #fff;
  box-shadow: 0 4px 18px rgba(25,118,210,0.45);
  min-width: 220px;
}
.btn-cast.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Hook button */
.hook-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%;
}
.hook-wrap.hidden { display: none; }

.hook-timer-bar {
  width: 220px; height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  overflow: hidden;
}
.hook-timer-fill {
  height: 100%;
  width: 100%;
  background: #F44336;
  border-radius: 4px;
  transform-origin: left;
  animation: timerShrink 1.5s linear forwards;
}
@keyframes timerShrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

.btn-hook {
  background: linear-gradient(135deg, #E53935, #B71C1C);
  color: #fff;
  min-width: 220px;
  box-shadow: 0 4px 20px rgba(229,57,53,0.55);
  animation: hookPulse 0.4s ease-in-out infinite alternate;
}
@keyframes hookPulse {
  from { transform: scale(1);    box-shadow: 0 4px 20px rgba(229,57,53,0.55); }
  to   { transform: scale(1.04); box-shadow: 0 6px 28px rgba(229,57,53,0.80); }
}

/* OK button */
.btn-ok {
  background: linear-gradient(135deg, #2E7D32, #1B5E20);
  color: #fff;
  padding: 11px 30px;
  font-size: 15px;
  box-shadow: 0 4px 14px rgba(46,125,50,0.4);
  margin-top: 6px;
}

/* ─── Cooldown ────────────────────────────────────────────────────── */
.cooldown-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100%;
}
.cooldown-wrap.hidden { display: none; }
.cooldown-bar {
  width: 220px; height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 4px; overflow: hidden;
}
.cooldown-fill {
  height: 100%;
  background: linear-gradient(90deg, #26C6DA, #0097A7);
  border-radius: 4px;
  transition: width 1s linear;
}
.cooldown-label {
  font-size: 13px;
  color: var(--text-dim);
}

/* ─── Fish card (overlay) ─────────────────────────────────────────── */
.fish-card {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: fadeIn 0.25s ease;
}
.fish-card.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

.fish-card-inner {
  background: linear-gradient(160deg, #12283d, #0a1d2e);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 32px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  animation: cardPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  max-width: 280px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
@keyframes cardPop {
  from { transform: scale(0.6) translateY(30px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

#fc-canvas {
  display: block;
  width: 100%;
  max-width: 240px;
  border-radius: 10px;
  background: rgba(0,30,60,0.4);
}
.fish-rarity-badge {
  font-size: 12px; font-weight: 700;
  padding: 3px 12px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.fish-name  { font-size: 22px; font-weight: 700; }
.fish-meta  { font-size: 14px; color: var(--text-dim); display: flex; gap: 8px; }
.meta-sep   { opacity: 0.4; }

/* Rarity badge colors */
.fish-card-inner[data-rarity="common"]    .fish-rarity-badge { background: rgba(144,164,174,0.2); color: var(--common); }
.fish-card-inner[data-rarity="uncommon"]  .fish-rarity-badge { background: rgba(102,187,106,0.2); color: var(--uncommon); }
.fish-card-inner[data-rarity="rare"]      .fish-rarity-badge { background: rgba(66,165,245,0.2);  color: var(--rare); }
.fish-card-inner[data-rarity="epic"]      .fish-rarity-badge { background: rgba(206,147,216,0.2); color: var(--epic); }
.fish-card-inner[data-rarity="legendary"] .fish-rarity-badge { background: rgba(255,213,79,0.2);  color: var(--legendary); }

/* Rarity glow on card */
.fish-card-inner[data-rarity="uncommon"]  { border-color: rgba(102,187,106,0.4); }
.fish-card-inner[data-rarity="rare"]      { border-color: rgba(66,165,245,0.4); }
.fish-card-inner[data-rarity="epic"]      { border-color: rgba(206,147,216,0.5); box-shadow: 0 0 40px rgba(206,147,216,0.15), 0 20px 60px rgba(0,0,0,0.6); }
.fish-card-inner[data-rarity="legendary"] { border-color: rgba(255,213,79,0.6); box-shadow: 0 0 60px rgba(255,213,79,0.25), 0 20px 60px rgba(0,0,0,0.6); animation: cardPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), legendaryGlow 1.5s ease-in-out 0.35s infinite alternate; }
@keyframes legendaryGlow {
  from { box-shadow: 0 0 40px rgba(255,213,79,0.2), 0 20px 60px rgba(0,0,0,0.6); }
  to   { box-shadow: 0 0 80px rgba(255,213,79,0.45), 0 20px 60px rgba(0,0,0,0.6); }
}

/* ─── Inventory / Leaderboard tabs ────────────────────────────────── */
.tab-header {
  flex-shrink: 0;
  padding: 14px 16px 8px;
  font-size: 16px; font-weight: 700;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid var(--border);
}

.item-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}

.empty, .loading {
  text-align: center; padding: 40px 0;
  color: var(--text-dim); font-size: 14px;
}

/* Inventory item */
.inv-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
}
.inv-fish-canvas { width: 64px; height: 40px; flex-shrink: 0; border-radius: 6px; background: rgba(0,30,60,0.4); }
.inv-item-info  { flex: 1; }
.inv-item-name  { font-size: 14px; font-weight: 600; }
.inv-item-meta  { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.inv-item-pts   { font-size: 13px; font-weight: 700; color: #FFD54F; }
.rarity-dot     { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Leaderboard item */
.lb-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.lb-rank { font-size: 18px; font-weight: 700; width: 30px; text-align: center; flex-shrink: 0; }
.lb-info { flex: 1; }
.lb-name { font-size: 14px; font-weight: 600; }
.lb-fish { font-size: 12px; color: var(--text-dim); }
.lb-score { font-size: 15px; font-weight: 700; color: #FFD54F; }

.lb-item:nth-child(1) { border-color: rgba(255,215,0,0.5); background: rgba(255,215,0,0.05); }
.lb-item:nth-child(2) { border-color: rgba(192,192,192,0.4); }
.lb-item:nth-child(3) { border-color: rgba(205,127,50,0.4); }

/* ─── Bottom nav ──────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  background: rgba(5,15,25,0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  z-index: 100;
}
.nav-btn {
  flex: 1;
  border: none; background: transparent;
  color: var(--text-dim);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 20px;
  cursor: pointer; transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn span { font-size: 10px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.nav-btn.active { color: #42A5F5; }
