:root {
  --wine: #ab1a2d;
  --wine-dark: #8f1425;
  --cream: #f8f2e3;
  --cream-deep: #e2d5b8;
  --ink: #4a423b;
  --shadow: 0 14px 26px rgba(91, 49, 24, 0.12);
  --radius-lg: 22px;
  --radius-md: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  background: var(--wine);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
}

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

.shell {
  min-height: 100vh;
  background: var(--cream);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: calc(env(safe-area-inset-top) + 10px) 10px 10px;
  background: var(--wine);
  color: #fff;
}

.nav-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
}

.nav-button[hidden] {
  visibility: hidden;
}

.nav-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.title-block {
  min-width: 0;
  text-align: center;
}

.title-block h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer {
  width: 42px;
  height: 42px;
}

.screen {
  min-height: calc(100vh - 62px);
  padding: 16px 14px 28px;
  background: var(--cream);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
  max-width: 760px;
  margin: 0 auto;
}

.catalog-grid-root {
  align-items: start;
}

.catalog-card {
  display: grid;
  gap: 10px;
}

.catalog-media {
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbf4e6, #eadbbe);
  box-shadow: var(--shadow);
}

.catalog-media-button {
  width: 100%;
  padding: 0;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.catalog-media-button:active,
.catalog-label-button:active,
.nav-button:active {
  transform: scale(0.985);
}

.catalog-media img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.catalog-media--contain {
  display: grid;
  place-items: center;
  background: #f6efdf;
}

.catalog-media--contain img {
  object-fit: contain;
  padding: 8px;
}

.catalog-label {
  border-radius: 12px;
  background: linear-gradient(180deg, #e9dcc3, #dfd1b5);
  color: var(--ink);
  padding: 12px 10px;
  text-align: center;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  font-weight: 700;
  box-shadow: 0 10px 18px rgba(91, 49, 24, 0.08);
}

.catalog-label-button {
  width: 100%;
  cursor: pointer;
}

.detail-view-image-only {
  max-width: 920px;
  margin: 0 auto;
}

.detail-full-image {
  width: 100%;
  height: auto;
  border-radius: 0;
  box-shadow: 0 18px 34px rgba(91, 49, 24, 0.15);
}

.detail-actions {
  display: flex;
  justify-content: center;
  padding: 16px 0 4px;
}

.detail-link-button {
  min-width: 150px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  background: var(--wine);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.state-panel {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
  gap: 16px;
  text-align: center;
  color: var(--ink);
}

.state-panel p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}

.state-panel.is-error p {
  color: var(--wine-dark);
}

.retry-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  background: var(--wine-dark);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.toast-root {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 18px;
  z-index: 40;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.view-enter {
  animation: fade-in 0.18s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

@media (max-width: 360px) {
  .screen {
    padding-left: 12px;
    padding-right: 12px;
  }

  .catalog-grid {
    gap: 14px 12px;
  }
}
