:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --panel: #ffffff;
  --panel-soft: #f0f0eb;
  --text: #202624;
  --muted: #69716d;
  --line: #d8d8d2;
  --line-strong: #bdbdb4;
  --accent: #2f6f63;
  --accent-soft: #e0ece8;
  --shadow: 0 18px 48px rgba(32, 38, 36, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 34px clamp(18px, 4vw, 56px) 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.eyebrow,
.hint,
.meta-line,
.count,
.header-note {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 5px 0 0;
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 0.96;
}

.header-note {
  max-width: 360px;
  text-align: right;
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(230px, 292px) minmax(0, 1fr);
  min-height: calc(100vh - 122px);
}

.sidebar {
  position: sticky;
  top: 0;
  height: calc(100vh - 122px);
  overflow: auto;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.control-block + .control-block {
  margin-top: 23px;
}

label,
.filter-heading {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.text-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
}

.chip {
  min-height: 31px;
  padding: 0 11px;
  font-size: 0.86rem;
}

.chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.content {
  min-width: 0;
  padding: 26px clamp(18px, 4vw, 56px) 56px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.count {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 800;
}

.hint {
  margin-top: 4px;
  font-size: 0.92rem;
}

.text-button {
  min-height: 38px;
  padding: 0 15px;
  color: var(--text);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 18px;
}

.paper-card {
  position: relative;
  display: grid;
  min-height: 406px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.paper-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.paper-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
}

.status {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 1px solid rgba(32, 38, 36, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  padding: 5px 10px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px;
}

.meta-line {
  font-size: 0.8rem;
}

.paper-card strong {
  font-size: 1.02rem;
  line-height: 1.28;
}

.description {
  color: var(--muted);
  line-height: 1.55;
}

.mini-tags,
.detail-tags,
.detail-links,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-tags span,
.detail-tags span,
.detail-links a,
.card-link,
.card-detail-button {
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 6px 9px;
  font-size: 0.74rem;
  text-decoration: none;
}

.card-actions {
  margin-top: auto;
}

.card-link,
.card-detail-button {
  border: 1px solid var(--line);
  background: transparent;
  font-weight: 800;
}

.card-link {
  color: var(--accent);
}

.card-detail-button {
  cursor: pointer;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  padding: 48px;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.paper-dialog {
  width: min(980px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow);
}

.paper-dialog::backdrop {
  background: rgba(32, 38, 36, 0.28);
}

.paper-detail {
  position: relative;
  padding: clamp(18px, 4vw, 32px);
}

.close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  font-size: 1.45rem;
  line-height: 1;
}

.detail-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.detail-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.paper-detail h2 {
  margin: 8px 48px 8px 0;
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.08;
}

.authors,
.abstract,
.notes li {
  line-height: 1.68;
}

.authors {
  margin: 0 0 18px;
  color: var(--accent);
  font-weight: 700;
}

.abstract {
  margin: 0 0 18px;
}

.detail-links {
  margin-top: 16px;
}

.detail-links a {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

.notes {
  margin-top: 30px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.notes h3 {
  margin: 0 0 10px;
}

.notes ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

@media (max-width: 820px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-note {
    text-align: left;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-header {
    padding-top: 22px;
  }

  .content,
  .sidebar {
    padding-inline: 14px;
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .paper-card {
    min-height: 0;
  }
}
