:root {
  color-scheme: light;
  --blue: #5297b2;
  --blue-dark: #39778f;
  --blue-soft: #eaf4f7;
  --orange: #ff914d;
  --orange-soft: #fff0e7;
  --ink: #17313b;
  --muted: #667b84;
  --line: #dbe7eb;
  --surface: #f4f8f9;
  --white: #ffffff;
  --danger: #bd3e3e;
  --shadow: 0 14px 38px rgba(23, 49, 59, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--surface);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 145, 77, 0.11), transparent 24rem),
    linear-gradient(180deg, #fbfdfe 0%, var(--surface) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

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

a {
  color: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 14px;
  filter: drop-shadow(0 8px 15px rgba(82, 151, 178, 0.16));
}

.brand-copy {
  min-width: 0;
}

.brand-name,
.brand-sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-name {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.75rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--blue-dark);
  background: rgba(255, 255, 255, 0.86);
}

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.page-title {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 1.04;
  letter-spacing: -0.05em;
}

.page-intro {
  max-width: 590px;
  margin: 10px 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

.welcome {
  margin: 0 0 8px;
  color: var(--blue-dark);
  font-size: 0.85rem;
  font-weight: 700;
}

.hero-card,
.card,
.login-card {
  border: 1px solid rgba(82, 151, 178, 0.16);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.hero-card {
  position: relative;
  min-height: 215px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 24px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(57, 119, 143, 0.97), rgba(82, 151, 178, 0.92));
  color: var(--white);
}

.hero-card::after {
  position: absolute;
  top: -58px;
  right: -48px;
  width: 190px;
  height: 190px;
  border: 32px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  content: "";
}

.hero-badge {
  position: relative;
  z-index: 1;
  margin-bottom: auto;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.17);
  font-size: 0.75rem;
  font-weight: 700;
}

.hero-title {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 18px 0 7px;
  font-size: clamp(1.65rem, 7vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 540px;
  margin: 0 0 17px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.45;
}

.button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 17px;
  border: 0;
  border-radius: 14px;
  font-weight: 800;
  text-decoration: none;
}

.button-primary {
  color: var(--white);
  background: var(--blue-dark);
}

.hero-card .button-primary {
  position: relative;
  z-index: 1;
  color: var(--blue-dark);
  background: var(--white);
}

.button-secondary {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.button-orange {
  color: #8e3b0a;
  background: var(--orange-soft);
}

.button-danger {
  color: var(--white);
  background: var(--danger);
}

.button-block {
  width: 100%;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin: 18px 0 28px;
}

.quick-card {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 17px;
  border: 1px solid rgba(82, 151, 178, 0.16);
  border-radius: 19px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(23, 49, 59, 0.07);
  text-align: left;
  text-decoration: none;
}

.quick-icon {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.quick-card:nth-child(2) .quick-icon,
.quick-card:nth-child(4) .quick-icon {
  color: #aa4b14;
  background: var(--orange-soft);
}

.quick-label {
  font-weight: 800;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 2px 12px;
}

.section-title {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.section-link {
  padding: 0;
  border: 0;
  color: var(--blue-dark);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.list {
  display: grid;
  gap: 11px;
}

.card {
  padding: 16px;
}

.smart-post {
  padding: 12px;
}

.post-card-main {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 15px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.post-image {
  width: 92px;
  height: 84px;
  border-radius: 15px;
  background: var(--blue-soft);
  object-fit: cover;
}

.post-image-placeholder {
  display: grid;
  place-items: center;
  color: var(--blue-dark);
}

.post-title {
  margin: 0 0 5px;
  font-size: 1rem;
  line-height: 1.3;
}

.post-meta,
.post-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.new-label {
  color: var(--orange);
  font-weight: 800;
}

.post-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.post-action {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 800;
}

.post-action .icon {
  width: 17px;
  height: 17px;
}

.post-action.active {
  color: #aa4b14;
  background: var(--orange-soft);
}

.topic-section,
.profile-section {
  margin: 26px 0;
}

.topic-row {
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.topic-row::-webkit-scrollbar {
  display: none;
}

.topic-chip {
  min-height: 39px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.84);
  font-size: 0.78rem;
  font-weight: 800;
}

.topic-chip.active {
  border-color: var(--blue-dark);
  color: var(--white);
  background: var(--blue-dark);
}

.smart-hint {
  color: var(--muted);
  font-size: 0.72rem;
}

.unread-badge {
  display: inline-grid;
  min-width: 16px;
  height: 16px;
  place-items: center;
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 999px;
  color: #713000;
  background: var(--orange);
  font-size: 0.58rem;
  font-weight: 900;
}

.unread-badge[hidden] {
  display: none;
}

.event-card {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
}

.date-tile {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 15px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}

.event-content {
  min-width: 0;
  flex: 1;
}

.event-title {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.event-link {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.chevron {
  color: var(--blue-dark);
}

.bottom-nav {
  position: fixed;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 12px;
  z-index: 50;
  width: min(calc(100% - 24px), 650px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 0 auto;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 23px;
  background: rgba(57, 119, 143, 0.97);
  box-shadow: 0 18px 45px rgba(23, 49, 59, 0.26);
  backdrop-filter: blur(18px);
}

.nav-item {
  min-height: 51px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px;
  border: 0;
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  font-size: 0.69rem;
  font-weight: 700;
  text-decoration: none;
}

.nav-item.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.15);
}

.loading,
.empty,
.error {
  padding: 34px 20px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
}

.error {
  color: var(--danger);
}

.search-form,
.login-form {
  display: grid;
  gap: 12px;
}

.search-form {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 22px;
}

.field {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.95);
}

.field:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(82, 151, 178, 0.15);
}

.login-card {
  width: min(100%, 480px);
  margin: 36px auto 0;
  padding: 24px;
}

.login-card .brand-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
}

.login-title {
  margin: 0;
  text-align: center;
}

.login-copy {
  margin: 8px 0 22px;
  color: var(--muted);
  line-height: 1.55;
  text-align: center;
}

.form-message {
  margin: 4px 0 0;
  color: var(--orange);
  font-size: 0.85rem;
  text-align: center;
}

.profile-card {
  display: grid;
  gap: 12px;
}

.profile-name {
  margin: 0;
  font-size: 1.3rem;
}

.profile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 20px;
  color: var(--blue-dark);
  font-weight: 800;
  text-decoration: none;
}

@media (hover: hover) {
  .quick-card,
  .smart-post,
  .event-card,
  .button,
  .icon-button,
  .nav-item {
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
  }

  .quick-card:hover,
  .smart-post:hover,
  .event-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 38px rgba(23, 49, 59, 0.12);
  }

  .button:hover,
  .icon-button:hover {
    transform: translateY(-1px);
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding-right: 14px;
    padding-left: 14px;
  }

  .brand-sub {
    max-width: 190px;
  }

  .hero-card {
    min-height: 230px;
    padding: 20px;
  }

  .post-card-main {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .post-image {
    width: 78px;
    height: 76px;
  }

  .search-form {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 680px) {
  .quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.network-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 13px;
  border-radius: 13px;
  color: #8e3b0a;
  background: var(--orange-soft);
  font-size: 0.78rem;
  font-weight: 750;
}

.network-status[hidden] {
  display: none;
}

.button-link {
  padding: 0;
  border: 0;
  background: transparent;
}

.article-reader {
  max-width: 680px;
  margin: 0 auto;
}

.article-cover {
  width: 100%;
  max-height: 410px;
  margin-bottom: 24px;
  border-radius: 24px;
  box-shadow: var(--shadow);
  object-fit: cover;
}

.article-kicker {
  margin: 0 0 8px;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.article-title {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.055em;
}

.article-toolbar {
  display: flex;
  gap: 8px;
  margin: 18px 0 25px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
}

.article-body {
  font-size: 1.04rem;
  line-height: 1.76;
}

.article-body h2,
.article-body h3 {
  margin: 1.65em 0 0.55em;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.article-body p,
.article-body ul,
.article-body ol {
  margin: 0 0 1.15em;
}

.article-body img,
.article-body figure {
  max-width: 100%;
  height: auto;
  margin: 1.5em auto;
  border-radius: 18px;
}

.article-body a {
  color: var(--blue-dark);
  font-weight: 750;
}

.article-body blockquote {
  margin: 1.5em 0;
  padding: 4px 0 4px 18px;
  border-left: 4px solid var(--orange);
  color: var(--muted);
}

.article-cta {
  margin-top: 28px;
}

.account-prompt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.account-prompt .button {
  grid-column: 1 / -1;
}

.account-prompt p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.5;
}

.settings-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 0 10px 28px rgba(23, 49, 59, 0.05);
}

.setting-row {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 12px 15px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  text-align: left;
  text-decoration: none;
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row > .icon:first-child {
  color: var(--blue-dark);
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row small {
  margin-top: 3px;
  color: var(--muted);
}

.switch {
  width: 42px;
  height: 24px;
  padding: 3px;
  border-radius: 999px;
  background: var(--line);
}

.switch::after {
  width: 18px;
  height: 18px;
  display: block;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16);
  content: "";
  transition: transform 180ms ease;
}

.setting-row.active .switch {
  background: var(--blue);
}

.setting-row.active .switch::after {
  transform: translateX(18px);
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf6f8;
  --muted: #9eb2ba;
  --line: #29434d;
  --surface: #10242b;
  --white: #19313a;
  --blue-soft: #213f49;
  --orange-soft: #4a3022;
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.24);
  background: var(--surface);
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 145, 77, 0.08), transparent 24rem),
    linear-gradient(180deg, #142b33 0%, var(--surface) 100%);
}

[data-theme="dark"] .hero-card {
  background: linear-gradient(135deg, #285b6f, #39778f);
}

[data-theme="dark"] .quick-card,
[data-theme="dark"] .card,
[data-theme="dark"] .login-card,
[data-theme="dark"] .icon-button,
[data-theme="dark"] .topic-chip,
[data-theme="dark"] .field {
  background-color: rgba(25, 49, 58, 0.96);
}
