:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg-top: #09111f;
  --bg-bottom: #111827;
  --panel: rgba(15, 23, 42, 0.82);
  --panel-strong: rgba(15, 23, 42, 0.94);
  --border: rgba(148, 163, 184, 0.18);
  --text: #e5eefc;
  --muted: #96a7bf;
  --accent: #38bdf8;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #f87171;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.15), transparent 35%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.34));
}

.app-shell {
  position: relative;
  max-width: 34rem;
  min-height: 100vh;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem calc(5rem + env(safe-area-inset-bottom));
}

.topbar {
  display: grid;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 1;
}

.subtitle,
.status-copy,
.empty-copy,
.story-summary,
.story-meta,
.story-domain,
.label,
.gesture-hint,
.app-message {
  color: var(--muted);
}

.subtitle {
  margin: 0.55rem 0 0;
  font-size: 0.98rem;
}

.card {
  border-radius: 1.35rem;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.chrome-card {
  padding: 1rem;
}

.status-panel {
  margin-bottom: 1rem;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.label {
  margin: 0 0 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.73rem;
}

.status-copy {
  margin: 0;
  line-height: 1.45;
}

.view-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tab-button,
.button {
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(148, 163, 184, 0.12);
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.tab-button:active,
.button:active {
  transform: scale(0.98);
}

.tab-button.is-active {
  background: rgba(56, 189, 248, 0.18);
  color: #eff8ff;
}

.button-secondary {
  background: rgba(56, 189, 248, 0.16);
}

.button[disabled] {
  opacity: 0.55;
}

.view-panel.hidden,
.hidden {
  display: none !important;
}

.deck-stage {
  position: relative;
  min-height: 31rem;
  margin-bottom: 1rem;
}

.deck-stack {
  position: relative;
  min-height: 31rem;
}

.story-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.1rem;
  border-radius: 1.5rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: var(--shadow);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  transform-origin: center 90%;
  transition: transform 220ms ease, opacity 220ms ease, box-shadow 220ms ease;
}

.story-card.is-draggable {
  transition: none;
}

.story-card.is-next {
  transform: translateY(0.9rem) scale(0.97);
  opacity: 0.82;
}

.story-card.is-third {
  transform: translateY(1.7rem) scale(0.94);
  opacity: 0.55;
}

.story-card::after {
  content: attr(data-badge);
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.story-card.swipe-left::before,
.story-card.swipe-right::before,
.story-card.swipe-up::before {
  position: absolute;
  top: 1rem;
  left: 1rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-card.swipe-left::before {
  content: "Skip";
  color: var(--bad);
  border: 2px solid rgba(248, 113, 113, 0.8);
}

.story-card.swipe-right::before {
  content: "Save";
  color: var(--good);
  border: 2px solid rgba(34, 197, 94, 0.85);
}

.story-card.swipe-up::before {
  content: "Open";
  color: var(--warn);
  border: 2px solid rgba(245, 158, 11, 0.85);
}

.story-topline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.88rem;
}

.story-domain {
  max-width: 100%;
  font-weight: 700;
}

.story-title {
  margin: 0;
  font-size: clamp(1.55rem, 5vw, 2rem);
  line-height: 1.08;
}

.story-summary {
  margin: 0;
  line-height: 1.55;
  font-size: 1rem;
}

.story-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: auto;
  font-size: 0.9rem;
}

.story-links {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.story-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 0.95rem;
  border-radius: 999px;
  color: #eff8ff;
  text-decoration: none;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.controls {
  position: sticky;
  bottom: max(1rem, env(safe-area-inset-bottom));
}

.gesture-hint {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.action {
  min-height: 3.35rem;
}

.action-left {
  background: rgba(248, 113, 113, 0.12);
}

.action-up {
  background: rgba(245, 158, 11, 0.13);
}

.action-right {
  background: rgba(34, 197, 94, 0.14);
}

.reading-list {
  display: grid;
  gap: 0.9rem;
}

.reading-item {
  padding: 1rem;
}

.reading-item-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.reading-item h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.reading-item p {
  margin: 0.35rem 0 0;
}

.reading-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.95rem;
}

.reading-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.button-remove {
  width: 2.5rem;
  height: 2.5rem;
  min-height: unset;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

.reading-actions .button,
.reading-actions .story-link {
  min-height: 2.5rem;
  padding-inline: 0.9rem;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 16rem;
  padding: 2rem 1.5rem;
  text-align: center;
  border-radius: 1.5rem;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.4);
}

.empty-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 800;
}

.app-message {
  min-height: 1.35rem;
  margin: 0.9rem 0 0;
  text-align: center;
  font-size: 0.92rem;
}

@media (min-width: 720px) {
  .app-shell {
    padding-inline: 1.25rem;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .story-card {
    padding: 1.35rem;
  }
}
