:root {
  --paper: #f6f3ed;
  --panel: #fffdf9;
  --ink: #22211e;
  --muted: #77736c;
  --line: #ded9cf;
  --accent: #e85232;
  --accent-dark: #bd351c;
  --navy: #1d2e35;
  --mint: #b9d6c3;
  --yellow: #f0c66c;
  --blue: #b9cddd;
  --shadow: 0 18px 60px rgba(49, 42, 32, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

button {
  color: inherit;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 260px;
  flex-direction: column;
  padding: 30px 22px;
  color: #fff;
  background: var(--navy);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: block;
  width: 29px;
  height: 29px;
}

.brand-mark span {
  position: absolute;
  width: 16px;
  height: 19px;
  border: 2px solid #fff;
  border-radius: 2px;
  background: var(--navy);
}

.brand-mark span:nth-child(1) { left: 0; top: 7px; transform: rotate(-8deg); }
.brand-mark span:nth-child(2) { left: 6px; top: 3px; }
.brand-mark span:nth-child(3) { left: 12px; top: 0; transform: rotate(7deg); }

.main-nav {
  display: grid;
  gap: 6px;
  margin-top: 46px;
}

.nav-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 13px;
  border: 0;
  border-radius: 10px;
  color: #c7d0d0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-icon {
  font-size: 21px;
  text-align: center;
}

.nav-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #d6dddd;
  background: rgba(255, 255, 255, 0.09);
  font-size: 12px;
  text-align: center;
}

.sidebar-section {
  margin-top: 34px;
}

.section-caption,
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-caption {
  color: #879798;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.text-button {
  padding: 0;
  border: 0;
  color: var(--accent);
  background: none;
  font-size: 13px;
  cursor: pointer;
}

.section-caption .text-button {
  color: #dbe3e1;
  text-transform: none;
  letter-spacing: 0;
}

.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.sidebar-tag {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  color: #dce3e1;
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  cursor: pointer;
}

.sidebar-tag:hover {
  border-color: rgba(255, 255, 255, 0.35);
}

.muted-small {
  color: #78898a;
  font-size: 12px;
}

.storage-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.storage-art {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  color: var(--navy);
  background: var(--mint);
  font-size: 22px;
}

.storage-card strong {
  display: block;
  font-size: 12px;
}

.storage-card p {
  margin: 4px 0 0;
  color: #849596;
  font-size: 10px;
}

.content {
  min-height: 100vh;
  min-width: 0;
  margin-left: 260px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(240px, 560px) auto;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 44px;
  border-bottom: 1px solid rgba(222, 217, 207, 0.8);
  background: rgba(246, 243, 237, 0.9);
  backdrop-filter: blur(14px);
}

.search {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.search span {
  color: var(--muted);
  font-size: 22px;
}

.search input {
  min-width: 0;
  width: 100%;
  padding: 12px 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.search kbd {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #969087;
  background: #f5f1ea;
  font-size: 10px;
  white-space: nowrap;
}

.primary-button,
.secondary-button,
.danger-button,
.small-save-button,
.share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 9px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 18px rgba(232, 82, 50, 0.2);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  border-color: #c9c3ba;
  background: #c9c3ba;
  box-shadow: none;
  cursor: not-allowed;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
}

.danger-button {
  border: 1px solid #e0b3aa;
  color: #b33b26;
  background: #fff5f2;
}

.share-button {
  border: 1px solid var(--navy);
  color: #fff;
  background: var(--navy);
}

.share-button span {
  font-size: 18px;
}

.mobile-menu {
  display: none;
}

.mobile-brand,
.bottom-nav,
.mobile-fab {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 40px;
  padding: 68px 44px 46px;
  background:
    radial-gradient(circle at 85% 15%, rgba(240, 198, 108, 0.2), transparent 24%),
    linear-gradient(180deg, #faf8f4 0%, var(--paper) 100%);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 5.1vw, 72px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.hero-copy {
  max-width: 650px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.hero-add {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 14px;
  min-width: 275px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(55, 48, 38, 0.08);
  text-align: left;
  cursor: pointer;
  transition: 180ms ease;
}

.hero-add:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 35px rgba(55, 48, 38, 0.13);
}

.hero-add-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 27px;
}

.hero-add strong,
.hero-add small {
  display: block;
}

.hero-add strong {
  font-size: 14px;
}

.hero-add small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.filters {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 0 44px 22px;
  border-bottom: 1px solid var(--line);
}

.filter-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-chip,
.suggested-tags button {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #625e57;
  background: transparent;
  white-space: nowrap;
  cursor: pointer;
}

.filter-chip:hover,
.filter-chip.active {
  border-color: var(--navy);
  color: #fff;
  background: var(--navy);
}

.sort-select {
  padding: 8px 30px 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: #625e57;
  background: var(--panel);
}

.library-section {
  padding: 34px 44px 70px;
}

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

.section-heading h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 500;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 22px;
}

.image-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  transition: 180ms ease;
}

.image-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 13px 35px rgba(50, 43, 34, 0.12);
}

.card-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #e5e0d7;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 220ms ease;
}

.image-card:hover .card-image img {
  transform: scale(1.025);
}

.card-type,
.card-favorite {
  position: absolute;
  top: 10px;
  z-index: 2;
  border: 0;
  border-radius: 999px;
  background: rgba(27, 37, 40, 0.78);
  backdrop-filter: blur(6px);
}

.card-type {
  left: 10px;
  padding: 5px 9px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card-favorite {
  right: 10px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.card-favorite.active {
  color: #ffdb71;
}

.card-body {
  padding: 13px 14px 15px;
}

.card-name {
  overflow: hidden;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-tags,
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag-pill {
  padding: 4px 7px;
  border-radius: 5px;
  color: #4b5a58;
  background: #e4eee8;
  font-size: 10px;
}

.tag-pill:nth-child(3n + 2) {
  color: #685832;
  background: #f4e8c8;
}

.tag-pill:nth-child(3n) {
  color: #455765;
  background: #e3ebf1;
}

.empty-state {
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  padding: 35px;
  border: 1px dashed #cfc8bb;
  border-radius: 15px;
  text-align: center;
}

.empty-state.hidden {
  display: none;
}

.empty-cards {
  position: relative;
  width: 100px;
  height: 76px;
  margin-bottom: 18px;
}

.empty-cards span {
  position: absolute;
  inset: 8px 19px;
  border: 2px solid var(--navy);
  border-radius: 5px;
  background: var(--paper);
}

.empty-cards span:nth-child(1) { transform: rotate(-12deg); }
.empty-cards span:nth-child(2) { transform: rotate(0deg); }
.empty-cards span:nth-child(3) { transform: rotate(12deg); }

.empty-state h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 500;
}

.empty-state p {
  max-width: 440px;
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(20, 28, 30, 0.68);
  backdrop-filter: blur(5px);
}

.hidden {
  display: none !important;
}

.modal {
  overflow: hidden;
  width: min(690px, 100%);
  max-height: calc(100vh - 44px);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 25px 28px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 29px;
  font-weight: 500;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #6f6960;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}

.modal-body {
  overflow-y: auto;
  max-height: calc(100vh - 210px);
  padding: 24px 28px;
}

.dropzone {
  display: grid;
  min-height: 145px;
  place-items: center;
  align-content: center;
  border: 1px dashed #bdb5a8;
  border-radius: 12px;
  background: #faf7f1;
  cursor: pointer;
  transition: 160ms ease;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--accent);
  background: #fff6f2;
}

.dropzone-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 8px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--navy);
  font-size: 21px;
}

.dropzone strong {
  font-size: 14px;
}

.dropzone small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.selected-files {
  margin-top: 20px;
}

.preview-strip {
  display: flex;
  gap: 9px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.preview-item {
  position: relative;
  flex: 0 0 84px;
  overflow: hidden;
  width: 84px;
  height: 72px;
  border-radius: 8px;
  background: #ddd;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item button {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  width: 20px;
  height: 20px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 22px;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.form-grid .field {
  margin-top: 0;
}

.field > span,
.field > label,
.field-label-row > label,
.field-title {
  color: #514d47;
  font-size: 12px;
  font-weight: 800;
}

.field small {
  color: #9a958e;
  font-weight: 400;
}

.field select,
.field textarea,
.field input,
.detail-block textarea,
.detail-meta select,
.detail-tag-editor input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  color: var(--ink);
  background: #fff;
}

.field textarea,
.detail-block textarea {
  resize: vertical;
}

.field select:focus,
.field textarea:focus,
.field input:focus,
.detail-block textarea:focus,
.detail-tag-editor input:focus {
  border-color: #9d968a;
  box-shadow: 0 0 0 3px rgba(157, 150, 138, 0.1);
}

.tag-editor {
  display: flex;
  min-height: 45px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.tag-editor input {
  min-width: 180px;
  flex: 1;
  padding: 5px;
  border: 0;
  outline: 0;
}

.selected-tags {
  display: contents;
}

.editable-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 5px;
  color: #40534d;
  background: #e3eee7;
  font-size: 11px;
}

.editable-tag button {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.suggested-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.suggested-tags button {
  padding: 5px 9px;
  font-size: 11px;
}

.suggested-tags button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.danger {
  color: #b83d28;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 28px;
  border-top: 1px solid var(--line);
}

.modal-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.modal-actions {
  display: flex;
  gap: 9px;
}

.detail-modal {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(310px, 0.65fr);
  width: min(1080px, 100%);
  height: min(720px, calc(100vh - 44px));
}

.detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  background: rgba(255, 255, 255, 0.9);
}

.detail-home {
  display: none;
}

.detail-image-wrap {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(45deg, #2b3436 25%, transparent 25%),
    linear-gradient(-45deg, #2b3436 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2b3436 75%),
    linear-gradient(-45deg, transparent 75%, #2b3436 75%),
    #273032;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.detail-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.detail-panel {
  overflow-y: auto;
  padding: 34px 28px 28px;
}

.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.type-badge {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 5px;
  color: #344b45;
  background: #dceae1;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-heading h2 {
  overflow-wrap: anywhere;
  margin: 12px 0 5px;
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 500;
}

.detail-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.favorite-button {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  font-size: 23px;
  cursor: pointer;
}

.favorite-button.active {
  border-color: #e5bd50;
  color: #be8b00;
  background: #fff8df;
}

.detail-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.detail-tag-editor {
  margin-top: 10px;
}

.detail-tags .tag-pill {
  position: relative;
  padding: 6px 9px;
  font-size: 11px;
}

.detail-tags.editing .tag-pill {
  padding-right: 24px;
  cursor: pointer;
}

.detail-tags.editing .tag-pill::after {
  position: absolute;
  right: 8px;
  content: "×";
  font-weight: 800;
}

.detail-block textarea {
  margin-top: 10px;
}

.small-save-button {
  min-height: 34px;
  margin-top: 8px;
  padding: 6px 10px;
  border: 0;
  color: #fff;
  background: var(--navy);
  font-size: 11px;
}

.detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-meta div {
  display: grid;
  gap: 8px;
}

.detail-meta span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-meta strong {
  padding: 11px 0;
  font-size: 12px;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: 28px;
}

.tags-modal {
  width: min(620px, 100%);
}

.tags-search {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 20px 28px 0;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f5f2ec;
}

.tags-search span {
  color: var(--muted);
  font-size: 20px;
}

.tags-search input {
  min-width: 0;
  width: 100%;
  padding: 12px 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.all-tags-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 24px 28px 28px;
}

.all-tag-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.all-tag-button span {
  color: var(--muted);
  font-size: 10px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  max-width: 350px;
  padding: 13px 16px;
  border-radius: 9px;
  color: #fff;
  background: var(--navy);
  box-shadow: var(--shadow);
  font-size: 13px;
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .content {
    margin-left: 0;
  }

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

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .hero,
  .filters,
  .library-section {
    padding-right: 24px;
    padding-left: 24px;
  }

  .detail-modal {
    grid-template-columns: 1fr;
    overflow-y: auto;
    height: auto;
  }

  .detail-image-wrap {
    min-height: 42vh;
  }
}

@media (max-width: 650px) {
  :root {
    --paper: #f8f7f3;
  }

  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
    background: var(--paper);
  }

  .topbar {
    position: sticky;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 10px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    border-bottom: 0;
    background: rgba(248, 247, 243, 0.96);
    overflow: hidden;
  }

  .topbar > .primary-button {
    grid-column: 2;
    grid-row: 1;
    width: 46px;
    min-height: 46px;
    padding: 0;
    border-radius: 15px;
    font-size: 0;
    box-shadow: none;
  }

  .topbar > .primary-button span {
    font-size: 24px;
  }

  .mobile-brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .mobile-brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    background: var(--navy);
    font-family: Georgia, serif;
    font-size: 22px;
    font-weight: 700;
  }

  .mobile-brand strong,
  .mobile-brand small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-brand strong {
    font-family: Georgia, serif;
    font-size: 20px;
    line-height: 1;
  }

  .mobile-brand small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
  }

  .search {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 46px;
    border: 0;
    border-radius: 14px;
    background: #ece9e2;
  }

  .search input {
    font-size: 14px;
  }

  .search kbd {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px 16px 20px;
    background: transparent;
  }

  .hero .eyebrow {
    display: none;
  }

  .hero h1 {
    max-width: 330px;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 30px;
    font-weight: 780;
    line-height: 1.06;
    letter-spacing: -0.045em;
  }

  .hero-copy {
    margin-top: 11px;
    font-size: 13px;
    line-height: 1.48;
  }

  .hero-add {
    grid-template-columns: 44px 1fr;
    width: 100%;
    min-width: 0;
    padding: 13px;
    border: 0;
    border-radius: 16px;
    background: var(--navy);
    box-shadow: none;
    color: #fff;
  }

  .hero-add > span:last-child {
    min-width: 0;
  }

  .hero-add strong,
  .hero-add small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-add-icon {
    width: 44px;
    height: 44px;
    background: var(--accent);
  }

  .hero-add small {
    color: #aebabb;
  }

  .filters {
    align-items: flex-start;
    padding: 0 16px 16px;
    border-bottom: 0;
  }

  .filter-scroll {
    min-width: 0;
    margin-right: -58px;
    padding-right: 58px;
  }

  .filter-chip {
    min-height: 38px;
    padding: 8px 14px;
    background: #fff;
  }

  .sort-select {
    display: none;
  }

  .library-section {
    padding: 10px 16px 28px;
  }

  .section-heading {
    margin-bottom: 15px;
  }

  .section-heading h2 {
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 21px;
    font-weight: 760;
    letter-spacing: -0.025em;
  }

  .image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .image-card {
    border: 0;
    border-radius: 15px;
    box-shadow: 0 3px 14px rgba(45, 39, 31, 0.07);
  }

  .card-image {
    aspect-ratio: 1 / 1.08;
  }

  .card-type {
    top: 8px;
    left: 8px;
  }

  .card-favorite {
    top: 7px;
    right: 7px;
  }

  .card-body {
    padding: 10px 10px 12px;
  }

  .card-name {
    font-size: 12px;
  }

  .card-tags {
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .empty-state {
    min-height: 320px;
    padding: 25px 20px;
    border-radius: 18px;
    background: #fff;
  }

  .empty-state h3 {
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 22px;
    font-weight: 760;
    letter-spacing: -0.025em;
  }

  .modal-backdrop {
    bottom: calc(68px + env(safe-area-inset-bottom));
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: calc(100dvh - 68px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-right: 18px;
    padding-left: 18px;
  }

  .modal-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-footer p {
    text-align: center;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

  .field select,
  .field textarea,
  .field input,
  .detail-block textarea,
  .detail-meta select,
  .detail-tag-editor input,
  .tags-search input,
  .search input {
    font-size: 16px;
  }

  .modal-body {
    max-height: calc(100dvh - 275px - env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }

  .detail-modal {
    display: block;
    width: 100%;
    height: calc(100dvh - 68px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    max-height: none;
    border-radius: 24px 24px 0 0;
  }

  .detail-image-wrap {
    height: 43dvh;
    min-height: 0;
  }

  .detail-panel {
    overflow: visible;
    padding: 22px 18px calc(32px + env(safe-area-inset-bottom));
  }

  .detail-heading h2 {
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-weight: 760;
    letter-spacing: -0.025em;
  }

  .detail-close {
    top: 12px;
    right: 12px;
  }

  .detail-home {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    display: grid;
    background: rgba(255, 255, 255, 0.92);
  }

  .detail-actions {
    padding-bottom: 8px;
  }

  .tags-modal {
    height: min(76dvh, 680px);
  }

  .tags-search {
    margin: 14px 18px 0;
  }

  .all-tags-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: calc(76dvh - 155px);
    padding: 16px 18px 28px;
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 130;
    display: grid;
    grid-template-columns: 1fr 1fr 58px 1fr 1fr;
    height: calc(68px + env(safe-area-inset-bottom));
    padding: 7px 8px env(safe-area-inset-bottom);
    border-top: 1px solid rgba(222, 217, 207, 0.9);
    background: rgba(255, 253, 249, 0.96);
    box-shadow: 0 -8px 30px rgba(39, 34, 28, 0.08);
    backdrop-filter: blur(18px);
  }

  .bottom-nav-item {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    border: 0;
    color: #8b877f;
    background: transparent;
    cursor: pointer;
  }

  .bottom-nav-item span {
    font-size: 21px;
    line-height: 1;
  }

  .bottom-nav-item small {
    font-size: 9px;
  }

  .bottom-nav-item.active {
    color: var(--accent);
  }

  .mobile-fab {
    position: fixed;
    bottom: calc(39px + env(safe-area-inset-bottom));
    left: 50%;
    z-index: 90;
    display: grid;
    width: 58px;
    height: 58px;
    padding: 0;
    place-items: center;
    transform: translate(-50%, 50%);
    border: 5px solid var(--panel);
    border-radius: 20px;
    color: #fff;
    background: var(--accent);
    box-shadow: 0 7px 22px rgba(232, 82, 50, 0.35);
    font-size: 28px;
    cursor: pointer;
  }

  body:has(.modal-backdrop:not(.hidden)) .mobile-fab {
    display: none;
  }

  body.keyboard-open .bottom-nav,
  body.keyboard-open .mobile-fab {
    display: none;
  }

  body.keyboard-open .modal-backdrop {
    bottom: 0;
  }
}
