:root {
  --navy: #0f1f2e;
  --navy-deep: #0a1520;
  --navy-card: #16283a;
  --olive: #5a6b3f;
  --olive-light: #7a8f56;
  --silver: #c9d1d9;
  --silver-bright: #eef2f5;
  --orange: #d97a3f;
  --orange-bright: #e88a4c;
  --danger: #c0453a;
  --radius: 14px;
  --gap: 16px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--navy);
  color: var(--silver-bright);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

img { max-width: 100%; display: block; }

button {
  font-family: inherit;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===================== Splash ===================== */

.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--navy);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cast-line {
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: castLine 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.1s;
  opacity: 0;
}

@keyframes castLine {
  0% { stroke-dashoffset: 420; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

.hook {
  offset-path: path('M 380 40 Q 260 120 200 470');
  offset-distance: 0%;
  animation: hookTravel 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.1s;
  opacity: 0;
}

@keyframes hookTravel {
  0% { offset-distance: 0%; opacity: 0; }
  5% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 1; }
}

.ripples { opacity: 0; }

.ripple {
  fill: none;
  stroke: var(--silver);
  stroke-width: 2;
  transform-origin: center;
}

.ripple1 { animation: rippleGrow 1.4s ease-out forwards; animation-delay: 0.95s; }
.ripple2 { animation: rippleGrow 1.4s ease-out forwards; animation-delay: 1.1s; }
.ripple3 { animation: rippleGrow 1.4s ease-out forwards; animation-delay: 1.25s; }

.ripples { animation: rippleShow 0.01s forwards; animation-delay: 0.95s; }

@keyframes rippleShow {
  to { opacity: 1; }
}

@keyframes rippleGrow {
  0% { r: 4; stroke-opacity: 0.9; transform: scale(1); }
  100% { r: 4; stroke-opacity: 0; transform: scale(20); }
}

.splash-logo-wrap {
  position: relative;
  z-index: 2;
  opacity: 0;
  transform: scale(0.85) translateY(10px);
  animation: logoReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 1.15s;
  padding: 0 20%;
}

.splash-logo {
  width: 100%;
  max-width: 260px;
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
}

@keyframes logoReveal {
  0% { opacity: 0; transform: scale(0.85) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.splash-hint {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  color: var(--silver);
  opacity: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: hintFade 0.6s ease forwards;
  animation-delay: 1.6s;
}

@keyframes hintFade {
  to { opacity: 0.55; }
}

.splash.hide {
  animation: splashOut 0.45s ease forwards;
  pointer-events: none;
}

@keyframes splashOut {
  to { opacity: 0; }
}

/* ===================== Layout ===================== */

.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid rgba(201, 209, 217, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  color: var(--silver-bright);
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--silver);
  opacity: 0.75;
}

.main {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.app-footer {
  text-align: center;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  color: var(--silver);
  opacity: 0.5;
  font-size: 0.8rem;
}

/* ===================== Cards ===================== */

.card {
  background: var(--navy-card);
  border: 1px solid rgba(201, 209, 217, 0.1);
  border-radius: var(--radius);
  padding: 18px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--olive-light);
}

.muted {
  color: var(--silver);
  opacity: 0.7;
  font-size: 0.9rem;
}

/* ===================== Weather ===================== */

.weather-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.weather-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.weather-icon {
  font-size: 2.6rem;
  line-height: 1;
}

.weather-temp {
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--silver-bright);
}

.weather-condition {
  color: var(--silver);
  font-size: 0.95rem;
}

.weather-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.weather-stat {
  background: rgba(201, 209, 217, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
}

.weather-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--silver);
  opacity: 0.65;
  margin: 0 0 4px;
}

.weather-stat-value {
  font-size: 1.05rem;
  color: var(--silver-bright);
  font-weight: 500;
}

.fishing-rating {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  width: fit-content;
}

.fishing-rating.good {
  background: rgba(90, 107, 63, 0.35);
  color: #a9c07f;
  border: 1px solid rgba(169, 192, 127, 0.4);
}

.fishing-rating.fair {
  background: rgba(217, 122, 63, 0.2);
  color: var(--orange-bright);
  border: 1px solid rgba(217, 122, 63, 0.4);
}

.fishing-rating.poor {
  background: rgba(192, 69, 58, 0.2);
  color: #e08379;
  border: 1px solid rgba(192, 69, 58, 0.4);
}

/* ===================== Gallery ===================== */

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.gallery-header h2 { margin: 0; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(201, 209, 217, 0.06);
  border: none;
  padding: 0;
  min-height: 44px;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 480px) {
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 700px) {
  .gallery-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ===================== Buttons ===================== */

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--olive);
  color: var(--silver-bright);
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-accent {
  background: var(--orange);
  color: #fff;
}
.btn-accent:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(201, 209, 217, 0.3);
  color: var(--silver-bright);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

/* ===================== Upload form ===================== */

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  background: rgba(201, 209, 217, 0.05);
  border-radius: 10px;
}

.upload-form input[type="text"],
.upload-form input[type="file"] {
  background: var(--navy);
  border: 1px solid rgba(201, 209, 217, 0.25);
  color: var(--silver-bright);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  min-height: 44px;
}

.upload-actions {
  display: flex;
  gap: 10px;
}

/* ===================== Lightbox ===================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6, 12, 18, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.lightbox-img {
  max-width: 92vw;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  line-height: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.8rem;
  line-height: 1;
}

.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

.lightbox-footer {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  max-width: 92vw;
  text-align: center;
}

.lightbox-caption {
  color: var(--silver-bright);
  margin: 0;
  font-size: 0.95rem;
}

/* ===================== Secret page ===================== */

.pin-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  text-align: center;
}

.pin-screen h1 {
  color: var(--silver-bright);
  font-size: 1.2rem;
  margin: 0;
}

.pin-input {
  font-size: 1.8rem;
  letter-spacing: 0.4em;
  text-align: center;
  width: 200px;
  background: var(--navy-card);
  border: 1px solid rgba(201, 209, 217, 0.3);
  color: var(--silver-bright);
  border-radius: 10px;
  padding: 12px;
  min-height: 44px;
}

.pin-error {
  color: #e08379;
  min-height: 20px;
  font-size: 0.9rem;
}

.secret-app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.secret-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 4px;
}

.secret-header h1 {
  font-size: 1.1rem;
  color: var(--silver-bright);
  margin: 0;
}

/* Presence */

.online-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 28px;
}

.online-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(90, 107, 63, 0.25);
  border: 1px solid rgba(169, 192, 127, 0.35);
  color: var(--silver-bright);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 500;
}

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7ed17e;
  box-shadow: 0 0 5px #7ed17e;
  flex-shrink: 0;
}

/* Chat - WhatsApp/Telegram-style bubbles */

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 4px 8px;
  margin-bottom: 12px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  -webkit-user-select: none;
  user-select: none;
}

.chat-msg.theirs {
  align-items: flex-start;
  align-self: flex-start;
}

.chat-msg.mine {
  align-items: flex-end;
  align-self: flex-end;
}

.chat-bubble {
  border-radius: 16px;
  padding: 7px 11px 6px;
  position: relative;
  transition: filter 0.1s ease;
}

.chat-msg.theirs .chat-bubble {
  background: var(--navy-card);
  border-bottom-left-radius: 4px;
}

.chat-msg.mine .chat-bubble {
  background: var(--olive);
  border-bottom-right-radius: 4px;
}

.chat-msg.deleting .chat-bubble {
  filter: brightness(0.6);
}

.chat-msg-meta {
  font-size: 0.72rem;
  color: var(--orange-bright);
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-msg-body {
  color: var(--silver-bright);
  font-size: 0.92rem;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-img-btn {
  display: block;
  border: none;
  background: none;
  padding: 0;
  margin: 0 0 4px;
  cursor: pointer;
  width: 220px;
  max-width: 100%;
}

.chat-img-btn img {
  display: block;
  width: 100%;
  height: 180px;
  max-height: 260px;
  object-fit: cover;
  border-radius: 12px;
}

.chat-msg-text {
  margin-top: 2px;
}

.chat-msg-time {
  display: block;
  font-size: 0.65rem;
  color: rgba(238, 242, 245, 0.55);
  text-align: right;
  margin-top: 2px;
}

.chat-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.chat-reactions:empty {
  display: none;
  margin-top: 0;
}

.reaction-pill {
  background: rgba(201, 209, 217, 0.1);
  border: 1px solid rgba(201, 209, 217, 0.2);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.78rem;
  line-height: 1.5;
  cursor: pointer;
  color: var(--silver-bright);
}

.reaction-pill.mine-reaction {
  background: rgba(217, 122, 63, 0.25);
  border-color: var(--orange);
}

/* Long-press action sheet */

.msg-action-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.msg-action-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  background: var(--navy-card);
  border-radius: 18px 18px 0 0;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.4);
}

.msg-quick-reactions {
  display: flex;
  justify-content: space-between;
  padding: 4px 4px 14px;
}

.msg-quick-reactions button {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  padding: 6px;
  border-radius: 50%;
  cursor: pointer;
}

.msg-quick-reactions button:hover,
.msg-quick-reactions button.active {
  background: rgba(201, 209, 217, 0.15);
}

.msg-action-delete {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-top: 1px solid rgba(201, 209, 217, 0.15);
  color: var(--danger);
  font-size: 0.98rem;
  font-weight: 600;
  padding: 12px 4px 2px;
  cursor: pointer;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-form-row {
  display: flex;
  gap: 8px;
}

.chat-form input[type="text"] {
  flex: 1;
  background: var(--navy);
  border: 1px solid rgba(201, 209, 217, 0.25);
  color: var(--silver-bright);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  min-height: 44px;
}

.name-input {
  max-width: 140px;
  flex: none !important;
}

.emoji-toggle {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(201, 209, 217, 0.25);
  background: var(--navy);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.emoji-toggle:hover {
  background: var(--navy-card);
}

.emoji-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
  padding: 10px;
  background: var(--navy);
  border: 1px solid rgba(201, 209, 217, 0.25);
  border-radius: 10px;
}

.emoji-option {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  padding: 6px 0;
  border-radius: 6px;
  cursor: pointer;
}

.emoji-option:hover {
  background: var(--navy-card);
}
