* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0b1a2e;
  --panel: #12263f;
  --panel2: #1a3352;
  --line: #24466e;
  --text: #eaf2fb;
  --muted: #8ba3bf;
  --accent: #35c9ff;
  --accent2: #7de0ff;
  --gold: #ffb020;
  --green: #4cd97b;
  --red: #ff6b6b;
  --on-accent: #062033;
  --radius: 16px;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(120% 100% at 50% 0%, #143c66 0%, var(--bg) 60%);
  color: var(--text);
  overflow: hidden;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(90px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

/* ===== Шапка хаба ===== */
.hub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(6px + env(safe-area-inset-top)) 2px 14px;
}
.brand { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.brand span { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hub-stats { display: flex; gap: 8px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat .ico { font-size: 14px; }

.sec-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin: 18px 2px 10px;
}

/* ===== Карточки ===== */
.card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.card-list { display: flex; flex-direction: column; }

.loc-emoji { font-size: 34px; }
.loc-body { flex: 1; min-width: 0; }
.loc-name { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.loc-desc { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.loc-trophy { font-size: 12px; color: var(--gold); margin-top: 6px; }
.loc-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.loc-card.locked { opacity: .75; }

.tag {
  font-size: 11px;
  font-weight: 700;
  background: rgba(53, 201, 255, .15);
  color: var(--accent2);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.locked-tag { background: rgba(139, 163, 191, .12); border-color: var(--line); color: var(--muted); }

.btn-go, .btn-unlock, .btn-buy {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .08s ease;
}
.btn-go:active, .btn-unlock:active, .btn-buy:active { transform: scale(.96); }
.btn-go { background: linear-gradient(90deg, var(--accent), var(--accent2)); color: var(--on-accent); }
.btn-unlock { background: var(--gold); color: #3a2500; }
.btn-buy { background: var(--green); color: #07331a; }

/* ===== Магазин ===== */
.shop-h { font-size: 14px; margin: 14px 2px 8px; color: var(--text); }
.shop-emoji { font-size: 26px; }
.shop-body { flex: 1; min-width: 0; }
.shop-name { font-weight: 800; font-size: 14px; }
.shop-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.shop-card.owned { opacity: .6; }
.shop-card.next { border-color: var(--green); }

/* ===== Коллекция ===== */
.empty { color: var(--muted); text-align: center; padding: 20px; font-size: 14px; }
.bag-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.bag-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.bag-emoji { font-size: 22px; }
.bag-name { flex: 1; font-size: 14px; font-weight: 700; }
.bag-name small { color: var(--muted); font-weight: 500; }
.bag-value { color: var(--gold); font-weight: 800; font-size: 14px; }
.sell-all { width: 100%; }

/* ===== Кнопки ===== */
.big-btn {
  border: none;
  border-radius: 16px;
  padding: 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: var(--on-accent);
  box-shadow: 0 8px 24px rgba(53, 201, 255, .25);
  width: 100%;
  transition: transform .08s ease;
}
.big-btn:active { transform: scale(.98); }
.big-btn:disabled { opacity: .55; box-shadow: none; }
.big-btn.reel { background: linear-gradient(90deg, var(--gold), #ffcf6b); color: #3a2500; box-shadow: 0 8px 24px rgba(255, 176, 32, .3); }

.icon-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  width: 42px;
  height: 42px;
  font-size: 20px;
  cursor: pointer;
}

/* ===== Шапка рыбалки ===== */
.fish-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(4px + env(safe-area-inset-top)) 2px 12px;
}
.loc-title { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 8px; }

/* ===== Трофей-бар ===== */
.trophy-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  transition: border-color .3s, box-shadow .3s;
}
.trophy-bar.active { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 176, 32, .35); }
.trophy-info { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.trophy-timer {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold);
  background: rgba(255, 176, 32, .12);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* ===== Вода ===== */
.water {
  position: relative;
  height: 34vh;
  min-height: 200px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #0d3a63 0%, #0a2c4e 45%, #071f3a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.water::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(50% 40% at 30% 20%, rgba(53, 201, 255, .25), transparent),
    radial-gradient(60% 50% at 75% 70%, rgba(53, 201, 255, .15), transparent);
  animation: ripple 6s ease-in-out infinite;
}
@keyframes ripple {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.03); }
}

.bobber {
  position: absolute;
  top: 30%;
  left: 50%;
  font-size: 30px;
  animation: bob 1.2s ease-in-out infinite;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.4));
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -8px); }
}

.msg {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(4, 18, 33, .85);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Мини-игра ===== */
.reel-ui {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.reel-label { font-size: 12px; color: var(--muted); margin: 6px 0 4px; font-weight: 700; }
.bar {
  height: 14px;
  background: #0a1c31;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar-fill { height: 100%; border-radius: 999px; transition: width .05s linear; }
.bar-fill.progress { background: linear-gradient(90deg, var(--green), #7dffab); }
.bar-fill.tension { background: linear-gradient(90deg, var(--red), #ff9d6b); }
.reel-hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }

/* ===== Зона действий ===== */
.action-area { margin-top: 14px; }

/* ===== Модалка ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 20, .7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 24px 20px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  animation: pop .25s ease;
}
@keyframes pop {
  0% { transform: scale(.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.modal-emoji { font-size: 64px; line-height: 1; margin-bottom: 10px; }
.modal-title { font-size: 22px; font-weight: 800; }
.modal-sub { color: var(--muted); margin-top: 6px; font-size: 14px; }
.modal-value { font-size: 20px; font-weight: 800; color: var(--gold); margin: 14px 0 18px; }

.modal-img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: #0a1c31;
}

/* ===== Адаптация к светлой теме Telegram ===== */
body.tg-light {
  background: radial-gradient(120% 100% at 50% 0%, var(--panel2) 0%, var(--bg) 60%);
}
body.tg-light .water {
  background: linear-gradient(180deg, #aee2ff 0%, #7cc4f0 45%, #4fa9e0 100%);
}
body.tg-light .water::before {
  background:
    radial-gradient(50% 40% at 30% 20%, rgba(255, 255, 255, .6), transparent),
    radial-gradient(60% 50% at 75% 70%, rgba(255, 255, 255, .4), transparent);
}
body.tg-light .bar { background: rgba(0, 0, 0, .08); }
body.tg-light .msg { background: rgba(255, 255, 255, .92); }

@media (min-width: 600px) {
  .screen { max-width: 480px; margin: 0 auto; width: 100%; }
}
