:root {
  --paper: #f6f2e8;
  --ink: #1d1c19;
  --muted: #5d574d;
  --line: #d6cdbd;
  --line2: #e8dfcf;
  --soft: #fffaf0;
  --selected: #ead8b8;
  --red: #a43822;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  max-width: 1600px;
  margin: 0 auto;
}

.top {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px;
}

.brand h1 {
  font-size: 18px;
  line-height: 1;
  margin: 0 0 3px;
}

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

.search {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fffdf7;
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 13px;
}

.search:disabled {
  opacity: 0.55;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0 4px;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.tab {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: #fffaf0;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.tab.active {
  background: #1d1c19;
  color: #fff;
  border-color: #1d1c19;
}

.sort {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  font-size: 11px;
}

.main {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(640px, 1fr) 330px;
  gap: 8px;
  padding-top: 8px;
  overflow: hidden;
}

.feed {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fffdf7;
  display: flex;
  flex-direction: column;
}

.vertical {
  display: none;
  min-height: 0;
  flex: 1;
}

.vertical.active {
  display: flex;
  flex-direction: column;
}

.table {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.row {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  grid-template-columns: 76px minmax(300px, 1.35fr) 92px 80px 84px repeat(5, 82px);
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line2);
  background: transparent;
  text-align: left;
  color: var(--ink);
  font: inherit;
  line-height: 1.22;
  cursor: pointer;
  outline: none;
}

.row > div,
.head > button {
  padding: 5px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.head {
  background: #eee7da;
  border-bottom: 1px solid var(--line);
  color: #6f675b;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 850;
  cursor: default;
}

.head > button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: default;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
}

.deal:hover {
  background: #fff3d7;
}

.deal.selected {
  background: var(--selected);
  box-shadow: inset 4px 0 0 var(--red);
}

.product {
  font-weight: 720;
}

.price {
  font-weight: 850;
}

.mobile-detail {
  display: none;
}

.detail {
  border: 1px solid var(--line);
  background: #fffaf0;
  padding: 10px;
  min-height: 0;
  overflow: auto;
  align-self: stretch;
}

.empty {
  color: var(--muted);
  padding: 18px;
}

.card-img {
  height: 146px;
  border: 1px solid var(--line);
  background: #f1eadc;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kicker {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

h1 {
  font-size: 16px;
  line-height: 1.16;
  margin: 0 0 5px;
}

.hero {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 6px 0;
}

.hero strong {
  font-size: 26px;
}

.hero span {
  color: var(--red);
  font-weight: 750;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 8px 0;
}

.btn {
  border: 1px solid #1d1c19;
  background: #1d1c19;
  color: #fff;
  text-align: center;
  text-decoration: none;
  padding: 6px;
  border-radius: 6px;
  font-weight: 750;
  font-size: 12px;
}

.btn.secondary {
  background: transparent;
  color: #1d1c19;
}

.section {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 9px;
}

.section h2 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 6px;
}

.kv {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 4px;
  font-size: 12px;
  margin: 0;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  font-weight: 650;
}


.demo-mark {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  padding-top: 6px;
  text-align: right;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

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

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

  .main {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .feed,
  .table {
    overflow: visible;
  }

  .detail {
    display: block;
  }

  .sort {
    display: none;
  }
}

@media (max-width: 720px) {
  html,
  body {
    min-height: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 14px;
  }

  .app {
    width: 100%;
    max-width: none;
    min-height: 100svh;
    overflow-x: hidden;
    padding: 8px;
  }

  .top {
    min-width: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 8px;
    background: var(--paper);
    padding: 6px 0 8px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .brand p {
    font-size: 12px;
    line-height: 1.25;
    max-width: 32em;
  }

  .search {
    min-height: 42px;
    padding: 9px 11px;
    font-size: 16px;
  }

  .bar {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 7px 0;
    overflow: hidden;
  }

  .tabs {
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 1px;
    scrollbar-width: thin;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
  }

  .main {
    display: block;
    width: 100%;
    min-width: 0;
    padding-top: 8px;
  }

  .demo-mark {
    padding: 10px 2px 2px;
    text-align: center;
  }

  .feed {
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
  }

  .vertical.active {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .head {
    display: none;
  }

  .row.deal {
    display: grid;
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
    width: 100%;
    margin: 0 0 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
    box-shadow: none;
  }

  .row.deal.selected {
    background: #fff7e6;
    box-shadow: inset 3px 0 0 var(--red);
  }

  .row.deal > div {
    min-width: 0;
    padding: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .row.deal > div::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
  }

  .row.deal > div:nth-child(1) {
    grid-column: 1 / 2;
    grid-row: 2;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
  }

  .row.deal > div:nth-child(1)::before {
    content: "Deal";
  }

  .row.deal > div:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 1;
    font-size: 15px;
    line-height: 1.25;
    font-weight: 800;
  }

  .row.deal > div:nth-child(2)::before {
    content: none;
  }

  .row.deal > div:nth-child(3) {
    grid-column: 1 / 2;
    grid-row: 3;
    color: var(--muted);
    font-size: 12px;
  }

  .row.deal > div:nth-child(3)::before {
    content: "Store";
  }

  .row.deal > div:nth-child(4) {
    grid-column: 2 / 3;
    grid-row: 2 / 4;
    align-self: center;
    text-align: right;
    font-size: 18px;
    font-weight: 850;
  }

  .row.deal > div:nth-child(4)::before {
    content: "Price";
  }

  .row.deal > div:nth-child(5) {
    grid-column: 1 / -1;
    grid-row: 4;
    color: var(--red);
    font-size: 13px;
    font-weight: 750;
  }

  .row.deal > div:nth-child(5)::before {
    content: "Value";
  }

  .row.deal > div:nth-child(n+6) {
    display: none;
  }

  .detail {
    display: none;
  }

  .mobile-detail {
    display: block;
    width: 100%;
    margin: -2px 0 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
  }

  .mobile-detail h1 {
    font-size: 16px;
  }

  .mobile-detail .hero strong {
    font-size: 24px;
  }

  .mobile-detail .actions {
    display: none;
  }

  .card-img {
    height: 118px;
  }

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

  .kv {
    grid-template-columns: 92px 1fr;
  }
}

@media (max-width: 360px) {
  .app {
    padding: 6px;
  }

  .row.deal {
    grid-template-columns: minmax(0, 1fr);
  }

  .row.deal > div:nth-child(4) {
    grid-column: 1 / -1;
    grid-row: 4;
    text-align: left;
  }

  .row.deal > div:nth-child(5) {
    grid-row: 5;
  }
}
