:root {
  --text: #222;
  --muted: #666;
  --line: #d9d9d9;
  --bg: #fff;
  --th: #f4f4f4;
  --stripe: #fafafa;
  --accent: #6b1d2a;
  --chip-red: #6b1d2a;
  --chip-white: #8a6d1f;
}
body { font-family: sans-serif; margin: 0; color: var(--text); }
main#main { padding: 16px 16px 40px; max-width: 1280px; margin: 0 auto; }
h1 { font-size: clamp(1.2rem, 2.4vw, 1.6rem); margin: 8px 0 12px; }
th { font-weight: 500; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin: 8px 0 16px;
}
.toolbar label { font-size: 0.95rem; }
.toolbar select,
.toolbar button {
  font: inherit;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.toolbar button { cursor: pointer; }
.toolbar button:hover { background: #f3f3f3; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: #b00020; }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grape-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 980px;
  background: var(--bg);
}
table.grape-table th,
table.grape-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
  font-size: 0.92rem;
}
table.grape-table th { background: var(--th); text-align: left; white-space: nowrap; }
table.grape-table tbody tr:nth-child(even) { background: var(--stripe); }
table.grape-table tbody tr.is-focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: #f7f0f1;
}
.card.is-focus { outline: 2px solid var(--accent); outline-offset: 2px; }
table.grape-table tbody tr.row-main { cursor: pointer; }
table.grape-table tbody tr.row-main:hover { background: #f7f0f1; }
.wine-detail { background: #fbf8f6; font-size: 0.88rem; }
.wine-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 4px 0; list-style: none; }
.wine-links a {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  background: #fff;
  border: 1px solid #ece6e2;
}
.wine-links a:hover {
  background: #f7f0f1;
  box-shadow: inset 0 0 0 2px #6b1d2a;
}
.card .wine-links { margin-top: 10px; }
table.grape-table .col-no { width: 3rem; white-space: nowrap; }
table.grape-table .col-img { width: 72px; }
table.grape-table img.thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: #eee;
  display: block;
}
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #fff;
  white-space: nowrap;
  margin-bottom: 0.5em;
}
.chip.red { background: var(--chip-red); }
.chip.white { background: var(--chip-white); }
.bars { display: flex; flex-direction: column; gap: 4px; min-width: 92px; }
.bar-row { display: grid; grid-template-columns: 3.2em 1fr auto; gap: 6px; align-items: center; font-size: 0.75rem; color: var(--muted); }
.bar { height: 6px; background: #ececec; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.card-list { display: none; }

@media (max-width: 860px) {
  main#main { padding: 12px 12px 32px; }
  .table-wrap { display: none; }
  .card-list { display: grid; gap: 12px; }
  .card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
  }
  .card-head {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 12px;
    align-items: start;
  }
  .card img.thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    background: #eee;
  }
  .card h2 {
    font-size: 1.05rem;
    margin: 0 0 6px;
    line-height: 1.3;
  }
  .card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
  .card .place { font-size: 0.85rem; color: var(--muted); }
  .card .feature { margin: 8px 0; font-size: 0.92rem; line-height: 1.5; }
  .card dl {
    display: grid;
    grid-template-columns: 6.2em 1fr;
    gap: 4px 8px;
    margin: 8px 0 0;
    font-size: 0.88rem;
  }
  .card dt { color: var(--muted); }
  .card dd { margin: 0; }
  .hint { display: none; }
}