/* =============================================================================
 * AquaDynasty — base.css
 * Design tokens, reset, typography, app shell layout, ambient background.
 * ========================================================================== */

:root {
  /* palette — deep ocean */
  --bg0: #060b14;
  --bg1: #0a1322;
  --bg2: #0e1a2e;
  --bg3: #142339;

  --glass: rgba(148, 190, 255, 0.05);
  --glass-hi: rgba(148, 190, 255, 0.10);
  --line: rgba(148, 190, 255, 0.11);
  --line-hi: rgba(148, 190, 255, 0.22);

  --tx0: #eaf3ff;
  --tx1: #a8bcd8;
  --tx2: #64789a;

  --acc: #37d6ff;
  --acc2: #3a8fff;
  --gold: #ffd166;
  --green: #3ddc97;
  --red: #ff6b7a;
  --purple: #b78cff;
  --orange: #ffab5e;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 60px rgba(0, 0, 0, 0.6);

  --font: "Segoe UI", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Inter", Roboto, "Helvetica Neue", sans-serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, monospace;

  --sidebar-w: 224px;
  --topbar-h: 62px;
}

/* ---------- reset ---------- */

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg0);
  color: var(--tx0);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; color: inherit; }
img, canvas { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 190, 255, 0.15); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 190, 255, 0.3); }

.hidden { display: none !important; }

/* ---------- ambient background ---------- */

#bg-gradient {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(1200px 800px at 85% -10%, rgba(55, 130, 255, 0.13), transparent 60%),
    radial-gradient(900px 700px at -10% 110%, rgba(55, 214, 255, 0.09), transparent 60%),
    radial-gradient(600px 500px at 50% 50%, rgba(90, 60, 255, 0.05), transparent 70%),
    linear-gradient(180deg, var(--bg0), #081020 55%, #060d18);
  animation: bg-drift 40s ease-in-out infinite alternate;
  transition: filter 4s ease;
}
@keyframes bg-drift {
  from { background-position: 0 0; filter: hue-rotate(0deg); }
  to   { background-position: 60px 30px; filter: hue-rotate(-14deg); }
}
#bg-gradient.night { filter: brightness(0.55) saturate(0.8); }

#weather-fx {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none;
  width: 100vw; height: 100vh;
}

/* ---------- app shell ---------- */

.app {
  position: relative; z-index: 2;
  display: flex;
  height: 100vh;
  animation: app-in 0.6s ease;
}
@keyframes app-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- sidebar ---------- */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex; flex-direction: column;
  background: rgba(8, 15, 28, 0.72);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.brand-icon {
  font-size: 30px;
  filter: drop-shadow(0 0 12px rgba(55, 214, 255, 0.5));
  animation: brand-bob 4s ease-in-out infinite;
}
@keyframes brand-bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-4px) rotate(4deg); }
}
.brand-name {
  font-weight: 800; font-size: 17px; letter-spacing: 0.3px;
  background: linear-gradient(90deg, var(--acc), var(--acc2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub { font-size: 11.5px; color: var(--tx2); font-weight: 600; }

.nav { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: none; background: transparent;
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600;
  color: var(--tx1);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  position: relative;
  text-align: left;
}
.nav-item:hover { background: var(--glass); color: var(--tx0); }
.nav-item:active { transform: scale(0.98); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(55, 214, 255, 0.14), rgba(58, 143, 255, 0.07));
  color: var(--acc);
}
.nav-item.active::before {
  content: "";
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--acc), var(--acc2));
  box-shadow: 0 0 10px var(--acc);
}
.nav-icon { font-size: 17px; width: 22px; text-align: center; }
.nav-badge {
  margin-left: auto;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px;
  background: var(--red);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: badge-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-badge.gold { background: var(--gold); color: #4a3400; }
@keyframes badge-pop { from { transform: scale(0); } to { transform: scale(1); } }

.nav-item.locked { opacity: 0.38; cursor: default; }
.nav-item.locked:hover { background: transparent; color: var(--tx1); }

.sidebar-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.version { font-size: 10.5px; color: var(--tx2); font-family: var(--mono); }

/* ---------- main column ---------- */

.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: rgba(8, 15, 28, 0.6);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.res-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.res {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 700; font-size: 14.5px;
  position: relative;
  transition: border-color 0.2s ease;
}
.res:hover { border-color: var(--line-hi); }
.res-icon { font-size: 15px; }
.res-money .res-val { color: var(--gold); font-family: var(--mono); font-size: 15px; }
.res-val { font-variant-numeric: tabular-nums; }

.res-delta {
  position: absolute; right: 8px; top: -14px;
  font-size: 12px; font-weight: 800;
  pointer-events: none; opacity: 0;
}
.res-delta.show-gain { color: var(--green); animation: delta-rise 1.1s ease forwards; }
.res-delta.show-loss { color: var(--red); animation: delta-rise 1.1s ease forwards; }
@keyframes delta-rise {
  0% { opacity: 0; transform: translateY(6px); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.chip {
  padding: 6px 12px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  color: var(--tx1);
  white-space: nowrap;
}

.icon-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--glass); border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 15px; cursor: pointer;
  transition: all 0.15s ease;
}
.icon-btn:hover { background: var(--glass-hi); transform: scale(1.08); }
.icon-btn:active { transform: scale(0.95); }

/* ---------- view container ---------- */

.view {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 60px;
  scroll-behavior: smooth;
}
.view > * { animation: view-in 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-head {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 18px;
}
.view-title { font-size: 22px; font-weight: 800; letter-spacing: 0.2px; }
.view-title small { font-size: 13px; color: var(--tx2); font-weight: 600; margin-left: 10px; }
.view-sub { color: var(--tx1); font-size: 13.5px; max-width: 70ch; }

.section-title {
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--tx2);
  margin: 26px 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- boot splash ---------- */

.boot {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg0);
  transition: opacity 0.6s ease;
}
.boot.done { opacity: 0; pointer-events: none; }
.boot-fish { font-size: 64px; animation: boot-swim 2s ease-in-out infinite; filter: drop-shadow(0 0 30px rgba(55, 214, 255, 0.6)); }
@keyframes boot-swim {
  0%, 100% { transform: translateX(-18px) scaleX(1); }
  49% { transform: translateX(18px) scaleX(1); }
  50% { transform: translateX(18px) scaleX(-1); }
  99% { transform: translateX(-18px) scaleX(-1); }
}
.boot-title {
  margin-top: 18px; font-size: 30px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(90deg, var(--acc), var(--acc2), var(--purple));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.boot-sub { color: var(--tx2); margin-top: 6px; font-size: 13px; }
.boot-bar {
  width: 220px; height: 5px; margin-top: 22px;
  background: var(--glass); border-radius: 4px; overflow: hidden;
}
.boot-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--acc), var(--acc2));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  :root { --sidebar-w: 64px; }
  .brand-text, .nav-label, .version { display: none; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .nav-icon { width: auto; }
  .nav-badge { position: absolute; top: 4px; right: 6px; }
  .sidebar-foot { justify-content: center; }
  #btn-settings { font-size: 0; padding: 8px; }
  #btn-settings::first-letter { font-size: 15px; }
}
@media (max-width: 640px) {
  .view { padding: 14px 12px 60px; }
  .chip { display: none; }
  .topbar { padding: 0 10px; }
}
