:root {
  color: #161819;
  background: #dfe6e1;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.78), transparent 27%),
    linear-gradient(145deg, #d6e3dd, #f1f4f0 52%, #ccd8d2);
}

.phone-frame {
  position: relative;
  width: min(100%, 430px);
  height: min(920px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid #aebbb5;
  border-radius: 34px;
  background: #f6f8f5;
  box-shadow: 0 28px 80px rgba(71, 89, 82, 0.18);
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.phone-frame::-webkit-scrollbar {
  display: none;
}

.pull-content {
  transform-origin: top center;
  transition: transform 0.42s cubic-bezier(0.18, 0.86, 0.22, 1);
  will-change: transform;
}

.pull-content.dragging {
  transition: none;
}

.pull-refresh {
  position: sticky;
  top: 8px;
  z-index: 4;
  width: max-content;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -32px auto 0;
  padding: 0 12px;
  border: 1px solid #c7d6cf;
  border-radius: 16px;
  color: #40534d;
  background: #f7fbf8;
  box-shadow: 0 8px 24px rgba(63, 84, 76, 0.12);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(var(--pull-progress, 0) * 42px)) scale(calc(0.92 + var(--pull-progress, 0) * 0.08));
  transition: opacity 0.22s ease, transform 0.42s cubic-bezier(0.18, 0.86, 0.22, 1);
}

.pull-refresh.visible {
  opacity: calc(0.2 + var(--pull-progress, 1) * 0.8);
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 20px 16px;
  color: #1f2b29;
  background: #d9e7e0;
  border-bottom: 1px solid #c5d5ce;
}

.header-actions {
  display: flex;
  gap: 7px;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: #60766f;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.weekline {
  margin: 8px 0 0;
  color: #526861;
  font-size: 13px;
}

.icon-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d4d4d0;
  border-radius: 50%;
  color: #202326;
  background: #fbfbf8;
}

.app-header .icon-button {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-color: #b9cbc3;
  color: #26302e;
  background: #edf5f1;
}

.app-header .icon-button.active {
  border-color: #52766c;
  color: #f7fbf8;
  background: #52766c;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 14px 16px 10px;
  background: #f6f8f5;
}

.stat {
  min-height: 64px;
  border: 1px solid #d6dfd9;
  border-radius: 12px;
  padding: 11px 13px;
  background: #ffffff;
  text-align: left;
  box-shadow: 0 1px 0 rgba(60, 79, 72, 0.04);
}

.stat-button {
  cursor: pointer;
}

.stat-button:active {
  background: #edf5f1;
}

.stat strong,
.stat span {
  display: block;
}

.stat strong {
  font-size: 24px;
  line-height: 1;
  color: #20302c;
}

.stat span {
  margin-top: 7px;
  color: #66766f;
  font-size: 12px;
}

.coverage-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px 12px;
  background: #f6f8f5;
}

.coverage-strip div,
.coverage-strip button {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #dbe3de;
  border-radius: 10px;
  background: #eef5f0;
  text-align: left;
}

.coverage-strip span,
.coverage-strip strong {
  display: block;
}

.coverage-strip span {
  color: #75847e;
  font-size: 11px;
}

.coverage-strip strong {
  margin-top: 4px;
  color: #2f403b;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.coverage-strip button {
  cursor: pointer;
}

.coverage-strip button:active {
  background: #e4eee8;
}

.coverage-refresh {
  position: relative;
  padding-right: 48px;
}

.coverage-refresh-icon {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px solid #c8d8d0;
  border-radius: 50%;
  color: #2f403b;
  background: #f7fbf8;
  transform: translateY(-50%);
}

.coverage-strip .coverage-refresh-icon {
  display: grid;
}

.coverage-refresh-icon svg {
  display: block;
  margin: auto;
}

.coverage-refresh:disabled {
  cursor: progress;
}

.search-box {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d4d5d2;
  border-radius: 22px;
  background: #ffffff;
  color: #6b706d;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #17191a;
  font-size: 14px;
}

.search-box input::placeholder {
  color: #8b908d;
}

.clear-button {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: #e8e8e5;
  color: #585d5a;
}

.search-sheet {
  max-height: min(600px, 76dvh);
}

.search-sheet-box {
  margin-bottom: 12px;
}

.search-results-label {
  margin: 2px 0 10px;
  color: #66766f;
  font-size: 12px;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px 12px;
  scrollbar-width: none;
}

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

.chip {
  white-space: nowrap;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #d0d1ce;
  border-radius: 17px;
  color: #444946;
  background: #f9f9f6;
  font-size: 13px;
}

.chip.active {
  color: #f7fbf8;
  border-color: #35554f;
  background: #35554f;
}

.keyword-panel {
  margin: 0 16px;
  padding: 12px;
  border: 1px solid #d4ded8;
  border-radius: 12px;
  background: #edf4ef;
}

.keyword-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.keyword-header span {
  color: #26302e;
  font-size: 13px;
  font-weight: 760;
}

.keyword-header small {
  color: #75857f;
  font-size: 11px;
}

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

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

.keyword-row button {
  min-height: 32px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid #c7d2cc;
  border-radius: 16px;
  color: #43514d;
  background: #ffffff;
  font-size: 12px;
}

.keyword-row button.active {
  color: #f7fbf8;
  border-color: #52766c;
  background: #52766c;
}

.keyword-row button span {
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  color: inherit;
  background: rgba(255, 255, 255, 0.22);
  font-size: 10px;
}

.source-status {
  padding: 2px 17px 10px;
  color: #75847e;
  font-size: 11px;
  text-align: right;
}

.notice {
  margin: 0 16px 12px;
  padding: 10px 12px;
  border: 1px solid #d7d8d4;
  border-radius: 8px;
  color: #454a47;
  background: #e8e9e5;
  font-size: 12px;
  line-height: 1.45;
}

.paper-feed {
  padding: 0 12px 24px;
}

.priority-panel {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #ccd9d2;
  border-radius: 12px;
  background: #eef5f0;
}

.priority-title {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  color: #314f49;
  background: transparent;
  text-align: left;
}

.priority-title h2 {
  flex: 1;
  margin: 0;
  color: #24302e;
  font-size: 16px;
}

.priority-count {
  min-width: 26px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
  color: #f7fbf8;
  background: #52766c;
  font-size: 12px;
}

.priority-note {
  margin: -2px 0 10px;
  color: #66766f;
  font-size: 12px;
  line-height: 1.45;
}

.priority-card {
  border: 1px solid #d5ddd8;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.priority-card + .priority-card {
  margin-top: 9px;
}

.priority-main {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 12px 38px 12px 12px;
  border: 0;
  background: transparent;
  text-align: left;
}

.journal-cover {
  width: 52px;
  min-height: 70px;
  display: grid;
  align-content: space-between;
  gap: 4px;
  padding: 7px 6px;
  border: 1px solid rgba(37, 55, 50, 0.16);
  border-radius: 4px;
  color: #f7fbf8;
  background: #52766c;
  box-shadow: inset 0 -14px 0 rgba(0, 0, 0, 0.08);
}

.journal-cover span,
.journal-cover strong,
.journal-cover small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.journal-cover span {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.journal-cover strong {
  font-size: 8px;
  line-height: 1.1;
  font-weight: 700;
}

.journal-cover small {
  font-size: 9px;
  line-height: 1;
  opacity: 0.88;
}

.journal-cover.sage {
  background: #6f8a7c;
}

.journal-cover.moss {
  background: #607a55;
}

.journal-cover.mint {
  background: #4f857d;
}

.journal-cover.slate {
  background: #596b72;
}

.journal-cover.teal {
  background: #35554f;
}

.priority-card h3 {
  margin: 7px 0 7px;
  color: #17191a;
  font-size: 14px;
  line-height: 1.3;
}

.priority-card p {
  margin: 0;
  color: #55615d;
  font-size: 12px;
  line-height: 1.4;
}

.priority-expand {
  position: absolute;
  top: 18px;
  right: 12px;
  color: #71807a;
}

.priority-detail {
  padding: 0 12px 12px 76px;
  border-top: 1px solid #edf1ee;
}

.mini-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.mini-keywords span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 11px;
  color: #41534e;
  background: #ecf1ed;
  font-size: 11px;
}

.all-papers-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 10px;
}

.all-papers-title h2 {
  margin: 0;
  color: #1f2b29;
  font-size: 17px;
  letter-spacing: 0;
}

.all-papers-title span {
  min-width: 28px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  color: #f7fbf8;
  background: #52766c;
  font-size: 12px;
}

.sheet-subtitle {
  margin: 6px 0 0;
  color: #66766f;
  font-size: 12px;
}

.collection-sheet {
  max-height: min(620px, 78dvh);
}

.collection-list {
  display: grid;
  gap: 10px;
}

.collection-paper {
  border: 1px solid #d8ded9;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.collection-main {
  padding: 12px;
  text-align: left;
}

.collection-main h3 {
  margin: 7px 0;
  color: #17191a;
  font-size: 14px;
  line-height: 1.32;
}

.collection-main p {
  margin: 0;
  color: #5f6964;
  font-size: 12px;
  line-height: 1.35;
}

.collection-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.collection-keywords span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 11px;
  color: #41534e;
  background: #ecf1ed;
  font-size: 11px;
}

.history-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.history-tabs::-webkit-scrollbar {
  display: none;
}

.history-tabs button {
  min-width: 126px;
  min-height: 48px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid #d2dcd6;
  border-radius: 8px;
  color: #43514d;
  background: #ffffff;
  text-align: left;
}

.history-tabs button.active {
  color: #f7fbf8;
  border-color: #52766c;
  background: #52766c;
}

.history-tabs span,
.history-tabs small {
  display: block;
}

.history-tabs span {
  font-size: 12px;
  font-weight: 750;
}

.history-tabs small {
  font-size: 11px;
  opacity: 0.84;
}

.topic-group + .topic-group {
  margin-top: 14px;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 9px;
}

.group-header h2 {
  margin: 0;
  color: #25292b;
  font-size: 16px;
  letter-spacing: 0;
}

.group-header span {
  min-width: 26px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
  color: #f4f4f2;
  background: #676d69;
  font-size: 12px;
}

.paper-card {
  border: 1px solid #d5d6d2;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.paper-card + .paper-card {
  margin-top: 10px;
}

.paper-main {
  position: relative;
  width: 100%;
  padding: 14px 42px 14px 14px;
  border: 0;
  text-align: left;
  background: transparent;
}

.paper-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #717672;
  font-size: 11px;
}

.paper-main h3 {
  margin: 8px 0 8px;
  color: #17191a;
  font-size: 16px;
  line-height: 1.28;
  letter-spacing: 0;
}

.authors {
  margin: 0;
  color: #585d5a;
  font-size: 13px;
  line-height: 1.35;
}

.tagline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.tagline span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border-radius: 12px;
  color: #3e4441;
  background: #ecedea;
  font-size: 11px;
}

.expand-icon {
  position: absolute;
  right: 14px;
  top: 44px;
  color: #858a87;
}

.paper-detail {
  padding: 0 14px 14px;
  border-top: 1px solid #ececea;
}

.graphical-abstract {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin: 14px 0;
  border-radius: 8px;
  background: #e3e4e0;
}

.image-placeholder {
  min-height: 96px;
  display: grid;
  place-items: center;
  gap: 8px;
  margin: 14px 0;
  border: 1px dashed #c8cac6;
  border-radius: 8px;
  color: #777c78;
  background: #f1f1ee;
  font-size: 12px;
}

.detail-block + .detail-block {
  margin-top: 13px;
}

.detail-block h4 {
  margin: 0 0 6px;
  color: #272b2d;
  font-size: 12px;
}

.detail-block p {
  margin: 0;
  color: #444946;
  font-size: 13px;
  line-height: 1.5;
}

.detail-actions {
  display: flex;
  margin-top: 14px;
}

.detail-actions a {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #1d2021;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: #747975;
  text-align: center;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: end center;
  padding: 0 18px max(10px, env(safe-area-inset-bottom));
  background: rgba(17, 19, 21, 0.42);
  overflow: hidden;
}

.settings-sheet {
  width: min(430px, 100%);
  max-height: min(640px, 78dvh);
  overflow: auto;
  padding: 0 18px 18px;
  border: 1px solid #c9cac7;
  border-radius: 24px 24px 0 0;
  background: #f7f7f4;
  box-shadow: 0 -12px 60px rgba(17, 19, 21, 0.24);
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  animation: sheet-in 0.24s cubic-bezier(0.18, 0.86, 0.22, 1);
}

.settings-sheet::-webkit-scrollbar {
  display: none;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sheet-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 0 -18px 16px;
  padding: 18px 18px 12px;
  background: rgba(247, 247, 244, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(207, 215, 210, 0.72);
}

.sheet-header .icon-button {
  position: sticky;
  top: 16px;
  flex: 0 0 42px;
}

.sheet-header > div {
  min-width: 0;
}

.sheet-header .sheet-subtitle {
  max-width: 280px;
}

.sheet-header {
  margin-bottom: 16px;
}

.sheet-header h2 {
  margin: 0;
  color: #17191a;
  font-size: 22px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field span {
  color: #4d524f;
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select {
  min-height: 42px;
  width: 100%;
  border: 1px solid #d0d1ce;
  border-radius: 8px;
  padding: 0 12px;
  outline: 0;
  color: #17191a;
  background: #ffffff;
}

.journal-list {
  margin: 16px 0;
  border-top: 1px solid #d9dad7;
  padding-top: 14px;
}

.journal-list h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.journal-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: #3f4441;
  font-size: 12px;
}

.journal-item small {
  color: #737874;
}

.managed-journal-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.managed-journal {
  display: grid;
  grid-template-columns: 1fr 36px;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border: 1px solid #d4d8d3;
  border-radius: 8px;
  background: #ffffff;
}

.managed-journal strong,
.managed-journal span {
  display: block;
}

.managed-journal strong {
  color: #202826;
  font-size: 13px;
  line-height: 1.35;
}

.managed-journal span {
  margin-top: 3px;
  color: #6b746f;
  font-size: 12px;
}

.journal-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.journal-metrics span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 11px;
  color: #40534d;
  background: #edf4ef;
  font-size: 11px;
}

.managed-journal button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d7ddd8;
  border-radius: 50%;
  color: #5f6c66;
  background: #f5f8f5;
}

.journal-form {
  padding-top: 14px;
  border-top: 1px solid #d9dad7;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-button {
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 23px;
  color: #f7f7f4;
  background: #141617;
  font-weight: 720;
}

.spin {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 0;
    background: #f4f4f2;
  }

  .phone-frame {
    width: 100%;
    height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .sheet-backdrop {
    padding: 0;
  }

  .settings-sheet {
    width: 100%;
    max-height: 84dvh;
    border-radius: 24px 24px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
}
