:root {
  --bg: #061c27;
  --panel: rgba(9, 42, 57, 0.78);
  --panel-strong: rgba(13, 62, 83, 0.94);
  --text: #f3fbff;
  --muted: #a9c6d4;
  --line: rgba(255, 255, 255, 0.11);
  --accent: #56e1ff;
  --accent-2: #70ffb8;
  --danger: #ff7272;
  --gold: #ffd978;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 4%, rgba(86, 225, 255, 0.24), transparent 26rem),
    radial-gradient(circle at 92% 12%, rgba(112, 255, 184, 0.16), transparent 28rem),
    linear-gradient(135deg, #04121a 0%, #062334 46%, #031018 100%);
  overflow-x: hidden;
}

button {
  font: inherit;
  border: 0;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

button:hover:not(:disabled) { transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
button:disabled { cursor: not-allowed; opacity: 0.42; }

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), rgba(0,0,0,0.12));
}

.app-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 22px;
  padding: 28px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  right: -100px;
  bottom: -170px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: rgba(86, 225, 255, 0.12);
}

.eyebrow, .tiny-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.5rem, 7vw, 5.6rem);
  line-height: 0.9;
  letter-spacing: -0.08em;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.1rem;
}

.subtitle {
  max-width: 820px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.hero-actions, .controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.primary, .danger, .ghost, .small-btn {
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 800;
}

.primary {
  background: linear-gradient(135deg, #18bedb, #28dfa5);
  color: #03151d;
}

.danger {
  background: linear-gradient(135deg, #ff7777, #ffd27d);
  color: #25100c;
}

.ghost, .small-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.small-btn {
  padding: 10px 13px;
  font-size: 0.88rem;
}

.bob-card {
  z-index: 1;
  align-self: stretch;
  display: grid;
  grid-template-columns: 118px 1fr;
  align-items: center;
  gap: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 22px;
}

.bob-card span {
  display: block;
  color: var(--muted);
  line-height: 1.35;
  margin-bottom: 8px;
}

.bob-card strong {
  display: block;
  font-size: 2.4rem;
  letter-spacing: -0.07em;
}

.photo-frame {
  width: 118px;
  height: 118px;
  border-radius: 28px;
  padding: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--gold));
}

.photo-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 24px;
  background: #0c2938;
}

.top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  margin-top: 18px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.stat-strip > div {
  min-height: 95px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.035);
  display: flex;
  justify-content: center;
  flex-direction: column;
}

.stat-strip span,
.meter-head span,
.collection-progress span {
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 1.45rem;
}

.weather-card {
  padding: 18px;
}

.weather-card h2 { font-size: 1.8rem; margin-bottom: 4px; }
.weather-card p { color: var(--muted); margin-bottom: 14px; }

.game-grid {
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr) 330px;
  gap: 18px;
  margin-top: 18px;
}

.sidebar {
  padding: 18px;
  align-self: start;
}

.location-list, .bait-list, .fish-book, .log-list {
  display: grid;
  gap: 10px;
}

.location-card, .bait-card, .fish-card, .log-entry, .last-catch {
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px;
}

.location-card, .bait-card {
  text-align: left;
  width: 100%;
}

.location-card.active, .bait-card.active {
  border-color: rgba(86, 225, 255, 0.95);
  background: rgba(86, 225, 255, 0.13);
}

.location-card strong, .bait-card strong, .fish-card strong {
  display: block;
  margin-bottom: 5px;
}

.location-card span, .bait-card span, .fish-card span, .log-entry, .last-catch p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.shop-box {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.shop-box p {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.88rem;
}

.shop-box button {
  width: 100%;
  margin-top: 8px;
}

.play-panel {
  padding: 18px;
  min-width: 0;
}

.screen-topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.screen-topbar h2 { margin-bottom: 0; font-size: 1.7rem; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(112, 255, 184, 0.12);
  border: 1px solid rgba(112, 255, 184, 0.28);
  color: var(--accent-2);
  font-weight: 800;
  white-space: nowrap;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: #082534;
}

canvas {
  display: block;
  width: 100%;
  max-height: 520px;
  aspect-ratio: 2 / 1;
}

.floating-text {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(2, 12, 17, 0.84);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-weight: 900;
  text-align: center;
  pointer-events: none;
}

.hidden { display: none; }

.meter-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

.meter-card {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-weight: 900;
}

.meter {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.32);
}

.meter > div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--gold));
  transition: width 0.15s ease;
}

#tensionFill.danger-zone {
  background: linear-gradient(90deg, #ffbd72, #ff7272);
}

#tensionFill.safe-zone {
  background: linear-gradient(90deg, #43d5ff, #6effb5);
}

.controls {
  justify-content: center;
  margin-bottom: 12px;
}

.controls button { min-width: 150px; }

.status-box {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  line-height: 1.55;
}

.rightbar {
  max-height: 850px;
  overflow: auto;
}

.last-catch.empty { color: var(--muted); }

.last-catch h3 {
  margin-bottom: 5px;
  font-size: 1.25rem;
}

.last-catch .score {
  color: var(--gold);
  font-weight: 900;
}

.collection-progress { margin-bottom: 12px; }
.collection-progress span { display: block; margin-bottom: 8px; }
.mini { height: 9px; }

.fish-card.locked {
  opacity: 0.62;
  filter: grayscale(0.7);
}

.fish-card .tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tag {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(86, 225, 255, 0.12);
  border: 1px solid rgba(86, 225, 255, 0.2);
  color: #c9f7ff;
  font-size: 0.74rem;
  font-weight: 800;
}

.tag.protected {
  background: rgba(255, 114, 114, 0.12);
  border-color: rgba(255, 114, 114, 0.22);
  color: #ffd1d1;
}

.log-panel {
  margin-top: 18px;
  padding: 18px;
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.log-head h2 { margin-bottom: 0; }

.log-list {
  max-height: 260px;
  overflow: auto;
}

.log-entry strong { color: var(--text); }

.how-dialog {
  width: min(680px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  color: var(--text);
  background: #082433;
  box-shadow: var(--shadow);
}

.how-dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
.how-dialog p { color: var(--muted); line-height: 1.6; }
.kbd { padding: 12px; border-radius: 14px; background: rgba(255,255,255,0.06); }

@media (max-width: 1180px) {
  .hero, .top-grid, .game-grid { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .rightbar { max-height: none; }
}

@media (max-width: 640px) {
  .app-shell { width: min(100% - 18px, 1500px); margin-top: 9px; }
  .hero, .play-panel, .sidebar, .log-panel { padding: 14px; border-radius: 18px; }
  .bob-card { grid-template-columns: 86px 1fr; }
  .photo-frame { width: 86px; height: 86px; border-radius: 20px; }
  .photo-frame img { border-radius: 16px; }
  .stat-strip { grid-template-columns: 1fr; }
  .meter-area { grid-template-columns: 1fr; }
  .screen-topbar { align-items: flex-start; flex-direction: column; }
  .controls button { width: 100%; }
}

/* Update rarity + pop-up hasil tangkapan */
.tag.biasa {
  background: rgba(86, 225, 255, 0.12);
  border-color: rgba(86, 225, 255, 0.24);
  color: #c9f7ff;
}

.tag.langka {
  background: rgba(126, 227, 255, 0.14);
  border-color: rgba(79, 139, 255, 0.36);
  color: #daf4ff;
}

.tag.epic {
  background: rgba(188, 140, 255, 0.16);
  border-color: rgba(255, 139, 232, 0.38);
  color: #ffe2ff;
}

.tag.legend {
  background: rgba(255, 217, 120, 0.17);
  border-color: rgba(255, 147, 86, 0.42);
  color: #fff0bd;
}

.tag.secret {
  background: linear-gradient(135deg, rgba(255,255,255,0.16), rgba(157,255,242,0.18), rgba(255,226,122,0.16));
  border-color: rgba(255, 255, 255, 0.46);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(157, 255, 242, 0.18);
}

.fish-thumb,
.last-catch-img {
  width: 100%;
  display: block;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.18);
  margin-bottom: 10px;
}

.fish-thumb {
  height: 96px;
  object-fit: cover;
}

.last-catch-img {
  height: 124px;
  object-fit: cover;
}

.fish-card.locked .fish-thumb {
  opacity: 0.38;
  filter: grayscale(1) blur(0.5px);
}

.catch-popup {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
}

.catch-popup.hidden { display: none; }

.catch-popup-card {
  position: relative;
  width: min(500px, 100%);
  overflow: hidden;
  text-align: center;
  padding: 24px;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.16);
  background:
    radial-gradient(circle at 50% 20%, rgba(255,255,255,0.16), transparent 16rem),
    rgba(8, 36, 51, 0.96);
  box-shadow: 0 30px 100px rgba(0,0,0,0.56);
  animation: popupEnter 0.35s ease both;
}

.catch-popup.biasa .catch-popup-card { box-shadow: 0 30px 100px rgba(86, 225, 255, 0.20); }
.catch-popup.langka .catch-popup-card { box-shadow: 0 30px 100px rgba(79, 139, 255, 0.25); }
.catch-popup.epic .catch-popup-card { box-shadow: 0 30px 100px rgba(255, 139, 232, 0.30); }
.catch-popup.legend .catch-popup-card { box-shadow: 0 30px 100px rgba(255, 217, 120, 0.34); }
.catch-popup.secret .catch-popup-card { box-shadow: 0 30px 120px rgba(157, 255, 242, 0.45); }

.catch-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.14);
  font-size: 1.45rem;
  line-height: 1;
}

.popup-eyebrow {
  margin: 2px 42px 12px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.88rem;
  font-weight: 1000;
}

.popup-fish-stage {
  position: relative;
  width: min(340px, 86%);
  margin: 0 auto 14px;
  aspect-ratio: 1.35 / 1;
  display: grid;
  place-items: center;
}

.popup-glow {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.75;
  background: var(--accent);
  animation: glowPulse 1.8s ease-in-out infinite;
}

.popup-glow.biasa { background: #56e1ff; }
.popup-glow.langka { background: #4f8bff; }
.popup-glow.epic { background: #ff8be8; }
.popup-glow.legend { background: #ffd978; }
.popup-glow.secret { background: conic-gradient(from 90deg, #fff, #9dfff2, #ffe27a, #fff); }

#popupFishImage {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: fishPop 0.7s cubic-bezier(.2,1.4,.4,1) both;
}

#popupFishName {
  font-size: clamp(1.5rem, 6vw, 2.35rem);
  letter-spacing: -0.06em;
  margin-bottom: 8px;
}

#popupFishInfo {
  color: var(--text);
  font-weight: 800;
  line-height: 1.5;
}

.popup-fact {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.07);
  color: var(--muted);
  line-height: 1.55;
}

@keyframes popupEnter {
  from { opacity: 0; transform: translateY(20px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fishPop {
  0% { opacity: 0; transform: translateY(22px) rotate(-5deg) scale(0.72); }
  70% { opacity: 1; transform: translateY(-4px) rotate(2deg) scale(1.06); }
  100% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
}

@keyframes glowPulse {
  0%, 100% { transform: scale(0.92); opacity: 0.62; }
  50% { transform: scale(1.08); opacity: 0.9; }
}

@media (max-width: 640px) {
  .catch-popup-card { padding: 18px; border-radius: 24px; }
  .popup-eyebrow { margin-left: 32px; margin-right: 32px; font-size: 0.78rem; }
  .last-catch-img { height: 104px; }
}
