@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── Variables ── */
:root {
  --c-bg0:    #020810;
  --c-bg1:    #060e1c;
  --c-bg2:    #0a1628;
  --c-glass:  rgba(6,14,28,0.72);
  --c-border: rgba(0,180,255,0.14);
  --c-glow:   rgba(0,180,255,0.22);
  --c-accent: #00c8f0;
  --c-teal:   #00ffcc;
  --c-gold:   #ffd700;
  --c-green:  #00e87a;
  --c-orange: #f5a623;
  --c-red:    #ff4757;
  --c-txt:    #d8eeff;
  --c-txt2:   #6899bb;
  --c-txt3:   #3a5f80;
  --radius:   14px;
  --radius-sm:8px;
  --trans:    0.2s ease;
}

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

body {
  background: var(--c-bg0);
  background-image:
    radial-gradient(ellipse 80% 50% at 15% 10%, rgba(0,80,160,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 85%, rgba(0,40,100,0.22) 0%, transparent 55%);
  color: var(--c-txt);
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 1100px; margin: 0 auto; padding: 10px 14px 50px; }

/* ── Header ── */
#hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 20px;
  background: var(--c-glass);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 4px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);
}
.hdr-brand { display: flex; align-items: center; gap: 9px; }
.brand-icon { font-size: 24px; filter: drop-shadow(0 0 8px rgba(0,180,255,0.6)); }
.brand-name {
  font-size: 19px; font-weight: 900; letter-spacing: -0.3px;
  background: linear-gradient(135deg, #48e0ff 0%, #06d6a0 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hdr-status { display: flex; gap: 8px; }
.stat-pill {
  background: rgba(0,150,200,0.12); border: 1px solid var(--c-border);
  border-radius: 20px; padding: 4px 13px; font-size: 12px; color: var(--c-txt2);
  font-weight: 700;
}
.hdr-coins {
  font-size: 22px; font-weight: 900; color: var(--c-gold);
  text-shadow: 0 0 14px rgba(255,215,0,0.5);
  display: flex; align-items: center; gap: 5px;
}

/* ── Phase tabs ── */
#phase-nav { display: flex; gap: 7px; margin-bottom: 10px; }
.phase-tab {
  flex: 1; padding: 10px 14px;
  background: rgba(6,14,28,0.6);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-txt2); font-family: inherit; font-size: 13px; font-weight: 800;
  cursor: pointer; transition: all var(--trans); white-space: nowrap;
  backdrop-filter: blur(12px);
}
.phase-tab:hover:not(:disabled) {
  border-color: var(--c-accent); color: var(--c-accent);
  box-shadow: 0 0 16px rgba(0,200,240,0.15);
}
.phase-tab.active {
  background: linear-gradient(135deg, rgba(0,100,180,0.35), rgba(0,60,120,0.45));
  border-color: rgba(0,200,240,0.45); color: #fff;
  box-shadow: 0 0 22px rgba(0,200,240,0.18), inset 0 1px 0 rgba(255,255,255,0.06);
}
.phase-tab:disabled { opacity: 0.38; cursor: not-allowed; }
.lock { font-size: 11px; }

/* ── Screens ── */
.screen { display: none; }
.screen.active { display: flex; gap: 12px; align-items: flex-start; }
.screen-left  { flex: 1.2; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.screen-right { width: 316px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; }

/* ── Tank wrap ── */
#tank-wrap {
  background: var(--c-bg1);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 6px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,200,255,0.06);
}
#tank-canvas { display: block; width: 100%; }
#tank-stats {
  padding: 7px 14px;
  border-top: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,0.25);
}
#tank-stats > div { display: flex; align-items: center; gap: 8px; flex: 1; font-size: 12px; color: var(--c-txt2); }
#tank-actions {
  display: flex; gap: 8px; padding: 9px 12px;
  border-top: 1px solid var(--c-border);
  background: rgba(0,0,0,0.2);
}
#tank-actions .btn { flex: 1; }

/* ── Panels ── */
.panel {
  background: var(--c-glass);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 13px 14px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.035);
}
.panel-title {
  font-size: 12px; font-weight: 900; color: var(--c-accent);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 11px;
}

/* ── Progress bars ── */
.bar {
  flex: 1; height: 8px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px; overflow: hidden;
}
.bar.sm { height: 6px; }
.bar.xs { height: 4px; }
.bar-fill {
  height: 100%; border-radius: 99px;
  transition: width 0.5s ease;
  box-shadow: 0 0 8px currentColor;
}
.bar-fill.accent { background: var(--c-accent); }
.bar-fill.clean  { background: var(--c-teal); box-shadow: 0 0 8px rgba(0,255,200,0.4); }

/* ── Fish cards ── */
.fish-card {
  background: rgba(0,180,255,0.04);
  border: 1px solid rgba(0,150,200,0.18);
  border-radius: var(--radius-sm);
  padding: 10px 11px; margin-bottom: 8px;
  transition: border-color var(--trans);
}
.fish-card:hover { border-color: rgba(0,200,255,0.32); }
.fish-card-top { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.fish-icon { font-size: 24px; filter: drop-shadow(0 0 6px rgba(255,200,0,0.3)); }
.fish-name { font-weight: 800; font-size: 13px; color: var(--c-txt); }
.fish-species { font-size: 10px; color: var(--c-txt2); margin-top: 1px; }
.fish-coins { margin-left: auto; font-size: 11px; color: var(--c-teal); font-weight: 800; }

.fish-stage {
  font-size: 9px; font-weight: 800; padding: 2px 7px; border-radius: 99px;
  margin-left: 6px; vertical-align: middle; text-transform: uppercase; letter-spacing: 0.5px;
}
.stage-0 { background: rgba(40,160,60,0.25);  color: #5de87a; border: 1px solid rgba(40,160,60,0.3); }
.stage-1 { background: rgba(0,140,200,0.25);  color: #48c8f0; border: 1px solid rgba(0,140,200,0.3); }
.stage-2 { background: rgba(220,160,0,0.25);  color: #ffd700; border: 1px solid rgba(220,160,0,0.3); }
.stage-3 { background: rgba(220,60,60,0.25);  color: #ff7878; border: 1px solid rgba(220,60,60,0.3); }

.stat-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; font-size: 11px; color: var(--c-txt2); }
.stat-val { width: 34px; text-align: right; font-size: 11px; font-weight: 700; }
.grow-bar-wrap { margin-top: 6px; }
.grow-label { font-size: 10px; color: var(--c-txt3); margin-bottom: 3px; }
.elder-label { text-align: right; font-size: 11px; color: var(--c-gold); font-weight: 800; margin-top: 4px; text-shadow: 0 0 8px rgba(255,215,0,0.5); }

/* ── Buy cards ── */
.buy-card {
  display: flex; align-items: center; gap: 9px;
  background: rgba(0,180,255,0.04);
  border: 1px solid rgba(0,150,200,0.16);
  border-radius: var(--radius-sm); padding: 9px 11px; margin-bottom: 7px;
  transition: all var(--trans);
}
.buy-card:hover:not(.locked) { border-color: rgba(0,200,255,0.35); background: rgba(0,180,255,0.08); }
.buy-card.locked { opacity: 0.42; }
.buy-icon { font-size: 22px; }
.buy-info { flex: 1; min-width: 0; }
.buy-name { font-weight: 800; font-size: 12px; color: var(--c-txt); }
.buy-meta { font-size: 10px; color: var(--c-teal); margin-top: 1px; }
.unlock-day { font-size: 10px; color: var(--c-orange); margin-top: 1px; }
.badge {
  font-size: 9px; background: rgba(180,50,220,0.25); color: #d080f8;
  border: 1px solid rgba(180,50,220,0.3); padding: 1px 6px; border-radius: 99px; margin-left: 5px;
}

/* ── Upgrade cards ── */
.upg-card {
  display: flex; align-items: center; gap: 9px;
  background: rgba(0,180,255,0.04);
  border: 1px solid rgba(0,150,200,0.16);
  border-radius: var(--radius-sm); padding: 9px 11px; margin-bottom: 7px;
  transition: all var(--trans);
}
.upg-card:hover:not(.owned) { border-color: rgba(0,200,255,0.3); }
.upg-card.owned { opacity: 0.45; }
.upg-icon { font-size: 18px; width: 26px; text-align: center; flex-shrink: 0; }
.upg-info { flex: 1; min-width: 0; }
.upg-name { font-weight: 800; font-size: 12px; color: var(--c-txt); }
.upg-desc { font-size: 10px; color: var(--c-txt2); margin-top: 2px; }
.upg-req  { font-size: 10px; color: var(--c-orange); margin-top: 2px; }
.owned-badge { font-size: 11px; color: var(--c-green); white-space: nowrap; font-weight: 800; }

/* ── Progress requirements ── */
.req-item { padding: 4px 0; font-size: 12px; color: var(--c-txt2); display: flex; align-items: center; gap: 6px; }
.req-item.met { color: var(--c-green); }

/* ── Shop canvas wrap ── */
#shop-wrap {
  background: var(--c-bg1);
  border: 1px solid var(--c-border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 6px 40px rgba(0,0,0,0.5);
}
#shop-canvas { display: block; width: 100%; }
#shop-actions { display: flex; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--c-border); background: rgba(0,0,0,0.2); }
#shop-actions .btn { flex: 1; }

/* ── Stats grid ── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sg-item {
  background: rgba(0,180,255,0.06); border: 1px solid rgba(0,150,200,0.15);
  border-radius: var(--radius-sm); padding: 9px; text-align: center;
}
.sg-val   { display: block; font-size: 20px; font-weight: 900; color: var(--c-gold); text-shadow: 0 0 10px rgba(255,215,0,0.4); }
.sg-label { font-size: 10px; color: var(--c-txt2); font-weight: 600; }

/* ── Customer cards ── */
.cust-card {
  display: flex; align-items: center; gap: 9px;
  background: rgba(0,180,255,0.04);
  border: 1px solid rgba(0,150,200,0.16);
  border-radius: var(--radius-sm); padding: 9px 11px; margin-bottom: 7px;
  animation: slideIn 0.25s ease;
}
@keyframes slideIn { from { opacity:0; transform: translateX(-8px); } to { opacity:1; transform: none; } }
.cust-icon { font-size: 24px; }
.cust-info { flex: 1; min-width: 0; }
.cust-name   { font-size: 12px; font-weight: 800; color: var(--c-txt); }
.cust-offer  { font-size: 11px; color: var(--c-gold); font-weight: 700; margin-top: 2px; }

/* ── Inventory ── */
.inv-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid rgba(0,150,200,0.1); font-size: 12px;
}
.inv-item:last-child { border-bottom: none; }
.inv-stage { color: var(--c-txt2); font-size: 11px; }
.inv-qty   { color: var(--c-accent); font-weight: 800; }
.inv-price { color: var(--c-gold); font-weight: 800; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: none;
  font-family: inherit; font-size: 13px; font-weight: 800;
  cursor: pointer; transition: all var(--trans); line-height: 1.2;
  position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,0); transition: background var(--trans);
}
.btn:hover::after { background: rgba(255,255,255,0.06); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #006eb0, #004880);
  color: #fff;
  box-shadow: 0 3px 14px rgba(0,110,176,0.35);
}
.btn-primary:hover { box-shadow: 0 4px 20px rgba(0,160,220,0.45); filter: brightness(1.12); }

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--c-txt); border: 1px solid var(--c-border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: var(--c-accent); }

.btn-accent {
  background: linear-gradient(135deg, #ffd700, #ffa000);
  color: #1a1000; font-weight: 900;
  box-shadow: 0 3px 14px rgba(255,180,0,0.35);
}
.btn-accent:hover { filter: brightness(1.1); box-shadow: 0 4px 22px rgba(255,200,0,0.5); }

.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }

.btn-buy {
  background: linear-gradient(135deg, #00d49a, #00a074);
  color: #001a10; font-weight: 900;
  box-shadow: 0 2px 10px rgba(0,200,140,0.3);
}
.btn-buy:hover { filter: brightness(1.1); box-shadow: 0 3px 16px rgba(0,220,160,0.45); }

.btn-sell {
  background: linear-gradient(135deg, #ffd700, #ffa000);
  color: #1a1000; font-weight: 900;
}
.btn-sell:hover { filter: brightness(1.1); }

.btn-disabled {
  background: rgba(255,255,255,0.05); color: var(--c-txt3);
  cursor: not-allowed; pointer-events: none;
}
.btn-disabled::after { display: none; }

/* ── Notifications ── */
#notif-container {
  position: fixed; bottom: 22px; right: 18px; z-index: 1000;
  display: flex; flex-direction: column; gap: 7px; pointer-events: none;
  max-width: 290px;
}
.notif {
  padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 700;
  opacity: 0; transform: translateX(22px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease;
  backdrop-filter: blur(16px);
  border-left: 3px solid;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.notif-show { opacity: 1; transform: none; }

/* ── Misc ── */
.empty {
  color: var(--c-txt3); font-size: 12px; padding: 10px 2px; text-align: center;
  font-style: italic;
}
#fish-count { font-weight: 600; color: var(--c-txt2); font-size: 12px; }

/* ── Scrollable panels ── */
#fish-list    { max-height: 320px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(0,150,200,0.3) transparent; }
#buy-list     { max-height: 240px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(0,150,200,0.3) transparent; }
#upgrades-list{ max-height: 280px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(0,150,200,0.3) transparent; }
#customer-list{ max-height: 220px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(0,150,200,0.3) transparent; }

/* ── Pet shop ── */
#pet-list { max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(0,150,200,0.3) transparent; }
#pet-buy-list { max-height: 280px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(0,150,200,0.3) transparent; }

/* ── Rarity system ── */
.rarity-badge {
  display: inline-block; font-size: 10px; padding: 1px 5px;
  border-radius: 6px; margin-left: 5px; font-weight: 800; vertical-align: middle;
}
.rarity-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
}
.rarity-common    { color: #aaa; }
.rarity-uncommon  { color: #44ff88; text-shadow: 0 0 6px #44ff8866; }
.rarity-rare      { color: #4488ff; text-shadow: 0 0 6px #4488ff66; }
.rarity-epic      { color: #cc44ff; text-shadow: 0 0 8px #cc44ff88; }
.rarity-legendary { color: #ff9900; text-shadow: 0 0 10px #ff990088; animation: rarityPulse 2s ease-in-out infinite; }

.rarity-border-uncommon { border-left: 2px solid #44ff8866 !important; }
.rarity-border-rare     { border-left: 2px solid #4488ff66 !important; }
.rarity-border-epic     { border-left: 2px solid #cc44ff66 !important; }
.rarity-border-legendary{ border-left: 2px solid #ff990088 !important; box-shadow: 0 0 12px rgba(255,153,0,0.18) !important; }

@keyframes rarityPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* ── Streak panel ── */
.streak-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.streak-fire { font-size: 22px; }
.streak-count { font-weight: 800; font-size: 15px; color: var(--c-gold); flex: 1; }
.streak-next { font-size: 11px; color: var(--c-txt2); }
.streak-dots {
  display: flex; gap: 5px; margin-bottom: 10px; flex-wrap: wrap;
}
.streak-dot {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid rgba(255,215,0,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--c-txt3);
  background: rgba(255,215,0,0.04);
}
.streak-dot.filled {
  background: rgba(255,215,0,0.18);
  border-color: var(--c-gold);
  color: var(--c-gold);
}
.streak-dot.current {
  background: rgba(255,215,0,0.3);
  border-color: var(--c-gold);
  color: var(--c-gold);
  box-shadow: 0 0 10px rgba(255,215,0,0.4);
  animation: rarityPulse 1.5s ease-in-out infinite;
}
.streak-claim-btn { width: 100%; margin-top: 4px; }
.streak-claimed {
  text-align: center; font-size: 12px; color: var(--c-txt2);
  padding: 6px 0; font-style: italic;
}

/* ── Quest cards ── */
.quest-card {
  background: rgba(0,180,255,0.04);
  border: 1px solid rgba(0,180,255,0.10);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 7px;
}
.quest-card.quest-done {
  border-color: rgba(0,232,122,0.3);
  background: rgba(0,232,122,0.06);
}
.quest-top {
  display: flex; align-items: center; gap: 8px;
}
.quest-icon { font-size: 18px; }
.quest-info { flex: 1; }
.quest-label { font-size: 12px; font-weight: 600; color: var(--c-txt); }
.quest-progress-text { font-size: 11px; color: var(--c-txt2); margin-top: 1px; }
.quest-reward { font-size: 12px; font-weight: 700; color: var(--c-gold); white-space: nowrap; }
.quest-claim-btn { width: 100%; margin-top: 7px; }
.quest-claimed { text-align: center; font-size: 11px; color: var(--c-green); padding: 5px 0; }

/* ── Achievement popup ── */
#achievement-container {
  position: fixed; bottom: 80px; right: 16px;
  display: flex; flex-direction: column; gap: 10px; z-index: 9999;
  pointer-events: none;
}
.achievement-popup {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #1a0e00, #2a1800);
  border: 1px solid var(--c-gold);
  border-radius: 14px; padding: 14px 18px;
  min-width: 260px; max-width: 320px;
  box-shadow: 0 4px 28px rgba(255,215,0,0.22), 0 0 0 1px rgba(255,215,0,0.08);
  opacity: 0; transform: translateX(120%);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.22,1,0.36,1);
}
.achievement-popup.ach-show { opacity: 1; transform: none; }
.ach-icon { font-size: 32px; flex-shrink: 0; }
.ach-body { flex: 1; }
.ach-title { font-size: 10px; font-weight: 700; color: var(--c-gold); letter-spacing: 0.08em; text-transform: uppercase; }
.ach-name  { font-size: 14px; font-weight: 800; color: var(--c-txt); margin-top: 1px; }
.ach-desc  { font-size: 11px; color: var(--c-txt2); margin-top: 2px; }
.ach-reward{ font-size: 12px; font-weight: 700; color: var(--c-gold); margin-top: 4px; }

@keyframes achievementSlideUp {
  from { opacity: 0; transform: translateX(120%); }
  to   { opacity: 1; transform: none; }
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .screen.active { flex-direction: column; }
  .screen-right { width: 100%; }
  #phase-nav { flex-wrap: wrap; }
  .phase-tab { flex: none; font-size: 12px; padding: 8px 12px; }
  .hdr-status { display: none; }
  .brand-name { font-size: 16px; }
}
