:root {
  --paper: #faf8f4;
  --ink: #16161a;
  --muted: #6f6c66;
  --faint: #a19d95;
  --rule: #e6e1d8;
  --accent: #b3122e;
  --skeleton: #ece8e0;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121214;
    --ink: #f1efea;
    --muted: #a5a29b;
    --faint: #6f6c66;
    --rule: #26262a;
    --accent: #ff5c74;
    --skeleton: #1d1d20;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- top of the page ---------- */
.masthead {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 20px 8px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.date {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 {
  margin: 2px 0 0;
  font: 600 32px/1.1 var(--serif);
  letter-spacing: -0.015em;
}
.actions { flex: none; display: flex; align-items: center; gap: 6px; }
.refresh {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.refresh:active { background: var(--skeleton); }
.avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: 16px;
}

/* ---------- topic tabs ---------- */
.topics {
  position: sticky;
  top: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--rule);
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 max(20px, calc((100vw - 720px) / 2 + 20px));
}
.topics::-webkit-scrollbar { display: none; }
.topics button {
  flex: none;
  padding: 14px 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.topics button.on { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- the feed ---------- */
.feed { max-width: 720px; margin: 0 auto; padding: 4px 20px 60px; }

.section-title {
  margin: 28px 0 0;
  padding-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--ink);
}

.story {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
}
.story:active { opacity: 0.6; }
@media (hover: hover) { .story:hover h2 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; } }

.kicker { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 6px; }
.kicker .topic { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; font-size: 11px; line-height: 18px; }
.kicker .dot { color: var(--faint); }

.story h2 {
  margin: 4px 0 0;
  font: 600 19px/1.25 var(--serif);
  letter-spacing: -0.005em;
}
.story p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* "+2 more sources": tap to open the list of other sites */
.also {
  display: inline-block;
  margin-top: 4px;
  padding: 8px 0;
  font-size: 12px;
  color: var(--muted);
}
.also::after { content: " ▾"; }
.also.open::after { content: " ▴"; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.sources[hidden] { display: none; }
.source-link {
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink);
}

/* Stories already tapped: softer headline */
.story.read h2 { color: var(--muted); font-weight: 500; }
.story.muted { opacity: 0.6; }

/* Line between new stories and ones from before the last visit */
.seen-divider {
  margin: 24px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.seen-divider::before, .seen-divider::after { content: ""; flex: 1; height: 1px; background: var(--accent); opacity: 0.4; }

/* End of the feed */
.caught-up {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 36px 0 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.caught-up strong { color: var(--ink); font: 600 19px/1.25 var(--serif); }
.caught-up .tick {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  color: var(--paper);
  background: var(--accent);
  font-size: 18px;
}
.show-hidden { margin-top: 10px; padding: 12px; font-size: 13px; color: var(--muted); text-decoration: underline; }
.caught-up .story { width: 100%; text-align: left; }

.thumb {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--skeleton);
}

/* The lead story: big picture on top, bigger headline */
.story.lead { grid-template-columns: 1fr; padding-top: 20px; }
.story.lead .thumb { order: -1; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 10px; }
.story.lead h2 { font-size: 27px; line-height: 1.15; }
.story.lead p { font-size: 15px; -webkit-line-clamp: 4; }

@media (min-width: 600px) {
  .thumb { width: 140px; height: 105px; }
  .story h2 { font-size: 21px; }
  .story.lead h2 { font-size: 34px; }
}

.empty { color: var(--muted); text-align: center; padding: 60px 0; }

/* Grey placeholder rows while stories load */
.skeleton { height: 96px; margin: 18px 0; border-radius: 8px; background: var(--skeleton); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ---------- panels above the news (Slavia, exchange rates) ---------- */
.panel {
  margin: 16px 0 4px;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  font-size: 14px;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.panel-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.panel-sub { font: 600 15px/1.2 var(--serif); }
.panel .meta { font-size: 12px; color: var(--faint); }

.match { padding: 12px 0 10px; border-bottom: 1px solid var(--rule); }
.match .label { font-size: 12px; color: var(--muted); }
.match .label strong { color: var(--ink); font-weight: 600; }
.teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 6px 0 4px;
  font: 600 16px/1.25 var(--serif);
}
.team { display: flex; align-items: center; gap: 6px; min-width: 0; }
.team.away { justify-content: flex-end; text-align: right; }
.vs { color: var(--faint); font: 500 13px var(--sans); }
.score { font: 600 17px var(--sans); font-variant-numeric: tabular-nums; }
.badge { width: 22px; height: 22px; object-fit: contain; flex: none; }

.result {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font: 600 11px var(--sans);
  color: #fff;
  background: var(--faint);
}
.match .label .result { width: 18px; height: 18px; font-size: 10px; margin-left: 4px; vertical-align: 1px; }
.result.W { background: #1f8a4c; }
.result.L { background: var(--accent); }

.mini-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
.mini-table td { padding: 7px 0; border-bottom: 1px solid var(--rule); }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table .rank { width: 24px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mini-table .club { display: flex; align-items: center; gap: 6px; }
.mini-table .club .badge { width: 18px; height: 18px; }
.mini-table .num { text-align: right; color: var(--muted); white-space: nowrap; padding-left: 10px; font-variant-numeric: tabular-nums; }
.mini-table .pts { color: var(--ink); font-weight: 600; }
.mini-table tr.us td { font-weight: 600; }
.mini-table tr.us .club { color: var(--accent); }

.form { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.form .label { font-size: 12px; color: var(--muted); margin-right: 6px; }

.panel.rates { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.rate-list { display: flex; gap: 14px; flex-wrap: wrap; }
.rate { font-variant-numeric: tabular-nums; font-weight: 500; }
.rate .cur { color: var(--muted); font-weight: 400; }
.panel.rates .meta { margin-left: auto; }

/* ---------- the menu behind the avatar circle ---------- */
.actions { position: relative; }
.menu {
  position: absolute;
  top: 52px;
  right: 0;
  z-index: 5;
  min-width: 160px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
}
.menu[hidden] { display: none; }
.menu button { width: 100%; min-height: 44px; padding: 0 12px; text-align: left; border-radius: 8px; font-weight: 500; }
.menu button:active { background: var(--skeleton); }

/* Shown when the news comes from the phone's saved copy */
.offline {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--skeleton);
  color: var(--muted);
  font-size: 13px;
}
button.empty { width: 100%; }

/* ---------- login page ---------- */
.login {
  max-width: 360px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 64px) 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.login-logo { border-radius: 14px; }
.login h1 { margin-top: 16px; }
.login-ask { color: var(--muted); margin: 8px 0 24px; }
.people { display: flex; gap: 12px; width: 100%; }
.people button {
  flex: 1;
  min-height: 52px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  font: 600 18px var(--serif);
}
.people button.on { border-color: var(--accent); color: var(--accent); }
.login-form { width: 100%; margin-top: 24px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.login-form[hidden] { display: none; }
.login-form label { font-size: 13px; font-weight: 500; color: var(--muted); }
.login-form input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: 16px var(--sans);   /* 16px stops the iPhone zooming in when you tap the box */
}
.login-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-form button[type=submit] {
  min-height: 48px;
  margin-top: 4px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}
.login-error { min-height: 20px; margin: 0; color: var(--accent); font-size: 14px; }

/* Videos: a play badge over the picture */
.thumb-wrap { position: relative; display: block; }
.story.lead .thumb-wrap { order: -1; }
.thumb-wrap .thumb { display: block; }
.play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding-left: 3px;
  background: rgb(0 0 0 / 0.6);
  color: #fff;
  font-size: 15px;
}
.story.lead .play { width: 60px; height: 60px; font-size: 22px; }
