:root {
  --bg: #ebe8e1;
  --bg-glow: rgba(255, 255, 255, 0.9);
  --panel: #ffffff;
  --text: #111111;
  --muted: #575757;
  --stroke: rgba(17, 17, 17, 0.08);
  --shadow: 0 18px 48px rgba(28, 28, 28, 0.08);
  --radius: 34px;
  --phone-width: 430px;
  font-family: "SF Pro Display", "Avenir Next", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.1) 35%),
    radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.5), transparent 30%),
    linear-gradient(180deg, #efede8 0%, #dfdcd5 100%);
  color: var(--text);
}
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
[hidden] { display: none !important; }

.app-stage {
  min-height: 100vh;
}

.device-stage {
  min-height: 100vh;
  padding: 0;
}

.device-frame {
  width: 100%;
  min-height: 100vh;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  overflow: clip;
  border: none;
}

.device-frame__content {
  height: 100%;
  padding: 34px 24px 100px;
}

.home-indicator {
  display: none;
}

.landing, .panel--full {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.landing { position: relative; overflow: hidden; }
.landing__halo {
  position: absolute;
  inset: auto -20% 10% auto;
  width: 320px;
  height: 320px;
  background: linear-gradient(135deg, rgba(255,106,61,0.5), rgba(255,198,113,0.25));
  border-radius: 50%;
  filter: blur(20px);
}

.landing__card, .auth-card, .profile-card, .saved-card, .admin-form, .admin-item {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.landing__card, .auth-card, .profile-card { max-width: 560px; padding: 32px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-size: 12px; }
h1 { font-size: clamp(40px, 7vw, 72px); line-height: 0.96; margin: 12px 0 16px; }
h2 { margin: 0 0 12px; }
.subtitle { color: var(--muted); font-size: 18px; line-height: 1.5; }

.actions, .stack, .interest-grid { display: grid; gap: 12px; }
.button {
  border: none;
  padding: 16px 18px;
  border-radius: 0;
  text-align: center;
  cursor: pointer;
}
.button--primary { background: #111; color: white; }
.button--ghost { background: rgba(255,255,255,0.6); color: var(--text); border: 1px solid var(--stroke); }

.phone-title {
  margin: 8px auto 0;
  max-width: 260px;
  font-size: clamp(27px, 7vw, 35px);
  line-height: 1.08;
  text-align: center;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.interest-list {
  margin-top: 245px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 20px;
}

.interest-pill input { display: none; }
.interest-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 148px;
  font-size: 16px;
  padding: 10px 0;
  color: #222;
}
.interest-pill input:checked + span {
  font-weight: 700;
}

.phone-actions {
  width: 100%;
  margin-top: 42px;
  display: grid;
  gap: 22px;
  justify-items: center;
}

.phone-link {
  border: none;
  background: transparent;
  font-size: 18px;
  color: #2b2b2b;
  cursor: pointer;
}

.phone-link--primary {
  font-weight: 600;
}

.feed-shell { height: 100vh; min-height: 100vh; }

.feed {
  height: calc(100vh - 72px);
  overflow-y: auto;
  scroll-snap-type: y mandatory;
}

.reaction-toast {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  padding: 10px 14px;
  background: rgba(17, 17, 17, 0.92);
  color: #fff;
  font-size: 14px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.reaction-toast--visible {
  opacity: 1;
}

.feed-status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(236, 236, 236, 0.92);
  color: #4b4b4b;
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
  text-align: center;
  max-width: calc(100% - 48px);
}

.joke-menu {
  position: absolute;
  z-index: 30;
  width: 188px;
  display: grid;
  padding: 8px;
  gap: 4px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--stroke);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

.joke-menu__item {
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 0;
  font-size: 15px;
  color: #111;
  cursor: pointer;
}

.joke-menu__item:hover,
.joke-menu__item.is-active {
  background: #f3f3f3;
}

.joke-card {
  min-height: calc(100% - 2px);
  padding: 18px 18px 18px;
  scroll-snap-align: start;
  transition: transform 0.2s ease, opacity 0.2s ease;
  display: grid;
  touch-action: pan-y;
}
.joke-card__main {
  border-radius: 0;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 24px 20px 32px;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100%;
  background: #ffffff;
  transition: transform 0.18s ease, background 0.2s ease, box-shadow 0.2s ease, opacity 0.18s ease;
  will-change: transform;
  position: relative;
  overflow: hidden;
}
.joke-card__swipe-hint {
  position: absolute;
  top: 18px;
  padding: 8px 12px;
  font-size: 13px;
  letter-spacing: 0.12em;
  font-weight: 700;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.92);
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.14s ease, transform 0.14s ease;
  pointer-events: none;
}
.joke-card__swipe-hint--like {
  right: 18px;
  color: #1f8f4d;
}
.joke-card__swipe-hint--dislike {
  left: 18px;
  color: #c54b4b;
}
.joke-card__swipe-hint.is-visible {
  opacity: 1;
  transform: scale(1);
}
.joke-card__tags {
  font-size: 14px;
  color: #181818;
  white-space: pre-wrap;
}
.joke-card__reason {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
  text-align: left;
  opacity: 0.0;
  height: 0;
  overflow: hidden;
}
.joke-card__text {
  align-self: center;
  width: min(100%, 640px);
  margin: 0 auto;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.42;
  white-space: pre-wrap;
  letter-spacing: -0.02em;
  font-weight: 400;
  text-align: left;
  text-wrap: pretty;
}

.joke-card--positive .joke-card__main {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(62, 146, 76, 0.16);
}

.joke-card--negative .joke-card__main {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(201, 73, 73, 0.16);
}

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  transform: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  box-shadow: 0 -1px 0 rgba(17, 17, 17, 0.06);
}
.tabbar__item {
  min-width: 104px;
  padding: 12px 16px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  border-radius: 0;
}
.tabbar__item--active {
  color: #111;
  font-weight: 600;
  background: #111;
  border-color: #111;
  color: #fff;
}

.panel { padding: 24px; }
.admin-grid { display: grid; gap: 20px; grid-template-columns: 1fr; margin-top: 84px; }
.admin-form, .admin-item { padding: 20px; }
.admin-item textarea, .admin-form textarea, input, select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  padding: 14px;
  background: rgba(255,255,255,0.75);
}
.screen-heading {
  margin: 8px 0 18px;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}
.topic-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
  white-space: nowrap;
}
.topic-tag {
  font-size: 14px;
  color: #1f1f1f;
}
.mini-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 26px 0 34px;
}
.mini-preview-card {
  min-height: 220px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.12;
  font-weight: 700;
}
.settings-list {
  display: grid;
  gap: 22px;
}
.settings-list div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  font-size: 16px;
}
.settings-list dt {
  font-weight: 500;
}
.settings-list dd {
  margin: 0;
  color: var(--muted);
  text-align: right;
}
.settings-chevron {
  display: inline-block;
  margin-left: 8px;
  color: #111;
}
.logout-row {
  margin-top: 24px;
}
.saved-screen,
.profile-screen {
  overflow-y: auto;
}
.saved-list {
  display: grid;
  gap: 16px;
  padding-bottom: 18px;
}
.saved-card {
  padding: 20px;
  line-height: 1.18;
}
.saved-card small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}
.empty-copy {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

@media (min-width: 860px) {
  .admin-grid { grid-template-columns: 360px 1fr; }
}
