@import url("https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,700&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap");

:root {
  --brand: #145C56;
  --brand-deep: #0B3D3A;
  --accent: #F4C95F;
  --accent-hot: #E8A838;
  --ink: #1A2423;
  --muted: #5E6F6C;
  --line: #D7E3E0;
  --bg: #F3F7F6;
  --white: #ffffff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --appbar-h: calc(54px + var(--safe-top));
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #0a1615;
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(11,61,58,.08);
}

.appbar {
  height: var(--appbar-h);
  padding: var(--safe-top) 8px 0;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  z-index: 20;
  flex: 0 0 auto;
}

.logo {
  text-align: center;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--brand-deep);
  line-height: 1;
}
.logo span {
  color: var(--accent-hot);
  position: relative;
}
.logo span::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  opacity: .85;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--brand);
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 50%;
}
.icon-btn:active { background: rgba(20,92,86,.08); }

.edition-banner {
  background: linear-gradient(90deg, #0B3D3A, #145C56 60%, #1F7A70);
  color: #E8F3F1;
  padding: 9px 16px;
  font-size: 0.74rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 0 0 auto;
}
.edition-banner strong { color: #fff; font-weight: 600; }
.edition-banner .pill-top {
  color: var(--brand-deep);
  background: var(--accent);
  font-weight: 700;
  letter-spacing: .05em;
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 999px;
}

.deck {
  flex: 1 1 auto;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  background: #102a28;
}

.card {
  height: 100%;
  min-height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  background: var(--white);
  position: relative;
}

.hero {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  background: var(--brand-deep);
}
.hero-fallback {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background:
    radial-gradient(520px 220px at 95% 0%, rgba(244,201,95,.3), transparent 55%),
    linear-gradient(135deg, rgba(11,61,58,.18), rgba(11,61,58,.55)),
    var(--cover, linear-gradient(135deg, #145C56, #0B3D3A));
}
.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.hero-fallback .tag {
  color: #fff;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  opacity: .95;
  text-shadow: 0 1px 8px rgba(0,0,0,.35);
}
.hero-fallback .rank-lg {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.hero-about {
  margin: 0;
  color: #F4FBF9;
  font-size: 0.88rem;
  line-height: 1.35;
  font-weight: 500;
  text-shadow: 0 1px 8px rgba(0,0,0,.35);
  max-width: 44ch;
}

.body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 0;
  background: var(--white);
  min-height: 0;
}

.kicker {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.cat {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.rank {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
  letter-spacing: 0;
  vertical-align: 1px;
}
.time {
  font-size: 0.72rem;
  color: #8A9B97;
}

.headline {
  margin: 0 0 8px;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.28rem;
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}


.summary {
  margin: 0 0 10px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #3D4C49;
}
.detail {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #526662;
  flex: 1 1 auto;
}


.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0 10px;
  border-top: 1px solid #EAF1EF;
  margin-top: 14px;
}
.short-by {
  font-size: 0.75rem;
  color: #8A9B97;
}
.short-by strong {
  color: var(--brand);
  font-weight: 600;
}
.actions {
  display: flex;
  gap: 4px;
}
.actions a, .actions button {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--brand);
  display: grid;
  place-items: center;
  text-decoration: none;
  cursor: pointer;
  border-radius: 50%;
}
.actions a:active, .actions button:active { background: rgba(20,92,86,.08); }

.swipe-bar {
  flex: 0 0 auto;
  background: #F7FBFA;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  letter-spacing: .02em;
}
.swipe-bar b { color: var(--brand); font-weight: 600; }
.swipe-bar .arrow {
  display: inline-block;
  color: var(--accent-hot);
  animation: bob 1.4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.loading, .empty {
  height: 100%;
  min-height: 60vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
  background: var(--white);
  scroll-snap-align: start;
}
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid #E0ECEA;
  border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(11,61,58,.48);
}
.drawer[hidden] { display: none !important; }
.drawer-panel {
  width: min(84vw, 330px);
  height: 100%;
  background: #fff;
  padding: calc(16px + var(--safe-top)) 18px 24px;
  box-shadow: 8px 0 28px rgba(11,61,58,.2);
  display: flex;
  flex-direction: column;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.drawer-meta {
  font-size: 0.85rem;
  color: #5E6F6C;
  line-height: 1.45;
  margin: 0 0 10px;
}
.drawer-note {
  font-size: 0.85rem;
  color: #8A9B97;
  line-height: 1.5;
  margin: 0 0 18px;
}
.drawer-brand {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.drawer-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-block;
  margin-bottom: 6px;
}
.builder {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.builder strong {
  color: var(--ink);
  font-weight: 600;
}

@media (min-width: 481px) {
  body { border-left: 1px solid #cfe0dc; border-right: 1px solid #cfe0dc; }
}
