:root {
  --paper: #f7f3e9;
  --surface: #fffdf8;
  --ink: #1f2520;
  --muted: #6f766b;
  --line: #d9d6c9;
  --green: #526d54;
  --green-soft: #e9eee4;
  --blue: #58707a;
  --rose: #b75a4a;
  --gold: #c49a45;
  --clay: #bd7654;
  --shadow: 0 18px 40px rgba(31, 37, 32, 0.12);
  --motion-fast: 160ms;
  --motion-medium: 240ms;
  --motion-slow: 360ms;
  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-press: cubic-bezier(0.2, 0, 0, 1);
}



* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: #21040a;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(31, 37, 32, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 37, 32, 0.018) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
}

.server-warning {
  background: var(--rose);
  color: var(--surface);
  padding: 11px 18px;
  text-align: center;
  font-size: 14px;
}

.server-warning a {
  color: var(--surface);
  font-weight: 800;
}

.scan-toast {
  position: fixed;
  top: calc(18px + env(safe-area-inset-top, 0px));
  right: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  background: linear-gradient(145deg, #ffd98b, #c98635);
  color: #fffdf8;
  border: 1px solid rgba(255, 226, 172, 0.62);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 214, 132, 0.14), transparent 26%),
    linear-gradient(145deg, #3a0711, #12040a 68%);
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid rgba(255, 224, 168, 0.24);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.08);
  color: #fffdf8;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(18px);
}

.auth-logo {
  width: min(320px, 78vw);
  display: block;
  border-radius: 12px;
  justify-self: center;
}

.auth-card h1 {
  color: #fffdf8;
  font-size: 34px;
}

.auth-card label {
  display: grid;
  gap: 7px;
  color: rgba(255, 253, 248, 0.78);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-card input {
  width: 100%;
  border: 1px solid rgba(255, 224, 168, 0.28);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.1);
  color: #fffdf8;
  padding: 13px 14px;
  outline: none;
}

.auth-card input:focus {
  border-color: rgba(255, 214, 132, 0.76);
  box-shadow: 0 0 0 3px rgba(255, 214, 132, 0.12);
}

.auth-copy,
.auth-status {
  color: rgba(255, 253, 248, 0.72);
  line-height: 1.55;
}

.auth-copy {
  margin-top: 8px;
  color: rgba(255, 253, 248, 0.84);
  font-size: 17px;
  text-align: center;
}

.auth-status {
  min-height: 20px;
  font-size: 13px;
}

.eyebrow {
  color: #ffd684;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100svh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.7);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.brand-logo-wrap {
  width: 100%;
  max-width: 260px;
  overflow: visible;
  display: grid;
  place-items: start;
  flex: 0 0 auto;
}

.brand-logo {
  width: 100%;
  max-width: 260px;
  display: block;
  mix-blend-mode: multiply;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 400;
  line-height: 0.95;
}

h2 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand p,
.wine-meta,
.wine-notes,
.review-date,
.message-meta {
  color: var(--muted);
}

.cellar-shelf {
  width: 100%;
  min-height: 260px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 16% 42%, rgba(82, 109, 84, 0.16), transparent 18%),
    radial-gradient(circle at 48% 34%, rgba(88, 112, 122, 0.14), transparent 18%),
    radial-gradient(circle at 74% 58%, rgba(196, 154, 69, 0.16), transparent 20%),
    linear-gradient(180deg, rgba(255, 253, 248, 0.92), rgba(233, 238, 228, 0.62)),
    var(--surface);
  padding: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  overflow: hidden;
}

.map-count {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
}

.map-count-actions {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.map-account-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 132, 0.45);
  background: rgba(255, 253, 248, 0.12);
  color: #ffd684;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.map-account-button:hover {
  background: rgba(255, 214, 132, 0.18);
}

.map-count strong,
.empty-map strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  font-weight: 400;
}

.map-count span {
  color: var(--muted);
  font-size: 13px;
}

.map-count-lines {
  display: grid;
  gap: 2px;
  justify-items: end;
  text-align: right;
  line-height: 1.2;
}

.map-count-lines span {
  white-space: nowrap;
}

.empty-map {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  height: 100%;
  color: var(--muted);
  text-align: center;
}

.origin-map-grid {
  position: relative;
  min-height: 180px;
  overflow: hidden;
}

.cellar-shelf.map-transition-out > * {
  animation: map-level-exit 260ms var(--ease-standard) both;
}

.cellar-shelf.map-transition-in > * {
  animation: map-level-enter 520ms var(--ease-standard) both;
}

.origin-svg {
  width: 100%;
  height: 100%;
  min-height: 180px;
  display: block;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.origin-feature {
  cursor: pointer;
}

.origin-outline {
  fill: rgba(255, 253, 248, 0.34);
  stroke: var(--ink);
  stroke-width: 1.45;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 7px 8px rgba(31, 37, 32, 0.08));
}

.origin-feature:focus {
  outline: 0;
}

.origin-feature:hover .origin-outline,
.origin-feature:focus .origin-outline {
  fill: rgba(233, 238, 228, 0.42);
  stroke: var(--green);
  stroke-width: 2.05;
}

.origin-feature.state .origin-outline,
.origin-feature.province .origin-outline {
  stroke: var(--blue);
}

.origin-feature.continent .origin-outline {
  stroke-width: 1.25;
}

.origin-qty-dot {
  fill: rgba(255, 253, 248, 0.9);
  stroke: var(--green);
  stroke-width: 0.35;
  pointer-events: none;
}

.origin-qty {
  fill: var(--green);
  font-size: 3.3px;
  font-weight: 800;
  text-anchor: middle;
  pointer-events: none;
}

.continent-qty {
  font-size: 7px;
}

.origin-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.map-place-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: right;
}

.origin-label-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
  overflow: auto;
}

.origin-wine-tile {
  position: relative;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  padding: 0;
  overflow: hidden;
}

.origin-wine-tile img {
  width: 100%;
  height: 100%;
  min-height: 92px;
  object-fit: cover;
  display: block;
}

.origin-wine-tile span {
  min-height: 92px;
  display: grid;
  place-items: center;
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
}

.origin-wine-tile strong {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-width: 28px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 16px;
}

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

.chip {
  border: 1px solid var(--line);
  background: rgba(210, 169, 104, 0.14);
  color: var(--ink);
  border-radius: 2px;
  padding: 6px 9px;
  font-size: 12px;
}

.descriptor-chip {
  appearance: none;
  cursor: pointer;
  transition: transform var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard);
}

.descriptor-chip:hover,
.descriptor-chip:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 216, 139, 0.72);
  background: rgba(240, 191, 114, 0.2);
}

.descriptor-popover {
  position: fixed;
  z-index: 1000;
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 226, 178, 0.36);
  border-radius: 16px;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 216, 139, 0.16), transparent 7rem),
    rgba(50, 5, 16, 0.96);
  color: #fff8ef;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(6px) scale(0.97);
  transition: opacity var(--motion-medium) var(--ease-standard), transform var(--motion-medium) var(--ease-standard);
}

.descriptor-popover.is-ready {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.descriptor-popover strong {
  color: #ffd98b;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.descriptor-popover p {
  margin: 0;
  color: rgba(255, 248, 239, 0.84);
  font-size: 13px;
  line-height: 1.45;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 76px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 243, 233, 0.82);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sign-out-button {
  white-space: nowrap;
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(10, 2, 5, 0.42);
  opacity: 0;
  transition: opacity var(--motion-medium) var(--ease-standard);
}

.drawer-scrim.open {
  opacity: 1;
}

.account-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 56;
  width: min(360px, 92vw);
  height: 100vh;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 24px;
  border-left: 1px solid rgba(255, 214, 132, 0.18);
  background:
    radial-gradient(circle at 70% 12%, rgba(255, 214, 132, 0.13), transparent 30%),
    linear-gradient(160deg, #54111c, #17050b 72%);
  color: #fffdf8;
  box-shadow: -24px 0 80px rgba(0, 0, 0, 0.36);
  transform: translateX(102%);
  transition: transform var(--motion-slow) var(--ease-standard);
}

.account-drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 214, 132, 0.2);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.08);
}

.profile-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(145deg, #ffe0a0, #c8953b);
  color: #3a0711;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.profile-card strong {
  display: block;
  max-width: 220px;
  overflow-wrap: anywhere;
}

.profile-card p {
  color: rgba(255, 253, 248, 0.64);
  margin-top: 3px;
  font-size: 12px;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.drawer-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 214, 132, 0.18);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.07);
}

.drawer-panel[hidden] {
  display: none;
}

.drawer-panel h3 {
  margin: 0;
  color: #fff8ef;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drawer-panel label {
  display: grid;
  gap: 6px;
  color: rgba(255, 253, 248, 0.72);
  font-size: 12px;
}

.drawer-panel input {
  width: 100%;
  border: 1px solid rgba(255, 214, 132, 0.22);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.1);
  color: #fffdf8;
  padding: 11px 12px;
}

.drawer-status {
  min-height: 1.2em;
  margin: 0;
  color: rgba(255, 253, 248, 0.68);
  font-size: 12px;
  line-height: 1.35;
}

.drawer-note {
  margin: 0;
  color: rgba(255, 253, 248, 0.7);
  font-size: 12px;
  line-height: 1.4;
}

.access-list {
  display: grid;
  gap: 8px;
}

.access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 214, 132, 0.14);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.06);
}

.access-row strong,
.access-row span {
  display: block;
  overflow-wrap: anywhere;
}

.access-row strong {
  color: #fff8ef;
  font-size: 13px;
}

.access-row span {
  color: rgba(255, 253, 248, 0.62);
  font-size: 11px;
}

.access-row button {
  padding: 8px 10px;
  border-color: rgba(255, 214, 132, 0.2);
  background: rgba(255, 253, 248, 0.08);
  color: #ffd684;
  font-size: 11px;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab,
.text-button,
.secondary-button,
.primary-button,
.chat-composer button {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tab.active {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--ink);
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--surface);
  font-size: 24px;
  line-height: 1;
}

.icon-button.ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.view {
  display: none;
  padding: 28px;
}

.active-view {
  display: block;
  animation: view-enter var(--motion-medium) var(--ease-standard) both;
}

.toolbar {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 22px;
}

.search-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0 12px;
}

.toolbar select {
  flex: 0 0 116px;
  width: 116px;
  min-width: 116px;
  appearance: none;
  -webkit-appearance: none;
  color: var(--ink);
  padding-right: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 248, 239, 0.95) 50%),
    linear-gradient(135deg, rgba(255, 248, 239, 0.95) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.search-wrap input,
.chat-composer textarea {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  padding: 13px 0;
}

.chat-composer textarea,
.bottle-pairing-form textarea {
  min-height: 44px;
  max-height: 180px;
  overflow-y: auto;
  resize: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.chat-composer textarea::placeholder,
.bottle-pairing-form textarea::placeholder {
  white-space: normal;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

.wine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 16px;
}

.origin-filter-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(214, 174, 102, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.origin-filter-banner span {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wine-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(118px, 34%) minmax(0, 1fr);
  min-height: 260px;
  cursor: pointer;
}

.wine-image-wrap {
  background: var(--green-soft);
  display: grid;
  place-items: center;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  cursor: pointer;
}

.wine-photo {
  width: 100%;
  height: 236px;
  background: transparent;
  display: grid;
  place-items: center;
  padding: 14px;
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
}

.wine-card img.wine-photo {
  width: 100%;
  height: 236px;
  object-fit: cover;
  display: block;
  padding: 0;
  border-radius: 0;
}

.wine-body {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.wine-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

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

.detail-upload-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.detail-repair-status {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(214, 174, 102, 0.32);
  border-radius: 12px;
  background: rgba(214, 174, 102, 0.12);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}

.wine-name-button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: var(--ink);
  display: grid;
  gap: 2px;
}

.wine-name-button span {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.wine-name-button strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
}

.qty {
  min-width: 36px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--gold);
  border: 1px solid rgba(79, 109, 63, 0.24);
  border-radius: 2px;
  font-weight: 700;
}

.wine-meta,
.wine-notes {
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
}

.wine-actions {
  display: none;
  grid-template-columns: 1fr 0.62fr 0.62fr 0.9fr;
  gap: 8px;
  align-items: center;
}

.wine-actions button,
.recommend-card button {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  padding: 9px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wine-actions button:first-child,
.primary-button,
.chat-composer button,
.recommend-card button {
  background: var(--green);
  color: var(--surface);
  border-color: var(--green);
}

.wine-actions .danger-button {
  color: var(--rose);
  border-color: rgba(166, 83, 88, 0.35);
}

.wine-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wine-detail-card {
  width: min(920px, calc(100vw - 28px));
}

.wine-detail-content {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
}

.wine-detail-media {
  display: grid;
  align-content: start;
}

.wine-detail-photo {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
}

.wine-detail-copy {
  display: grid;
  gap: 18px;
}

.detail-topline,
.detail-edit-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.detail-manage-actions {
  display: grid;
  grid-template-columns: 0.7fr 0.7fr 1fr;
  gap: 10px;
}

.detail-manage-actions button {
  min-height: 42px;
}

.detail-open-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-manage-actions .danger-button {
  border: 1px solid rgba(226, 123, 119, 0.42);
  border-radius: 2px;
  background: rgba(226, 123, 119, 0.08);
  color: var(--rose);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.wine-edit-form {
  display: grid;
  gap: 12px;
}

.detail-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
}

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

.detail-list dd {
  margin: 0;
}

.bottle-pairing-panel {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: grid;
  gap: 10px;
}

.bottle-pairing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bottle-pairing-head h2 {
  margin: 0;
}

.bottle-pairing-thread {
  display: grid;
  gap: 8px;
  overflow: visible;
}

.pairing-bubble {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 10px 12px;
  line-height: 1.45;
  background: var(--surface);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pairing-bubble.user {
  background: var(--ink);
  color: var(--surface);
  justify-self: end;
  max-width: 86%;
}

.bottle-pairing-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.bottle-pairing-form button {
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--surface);
  padding: 10px 14px;
}

.bottle-pairing-form textarea {
  width: 100%;
  min-height: 58px;
}

.secondary-button {
  background: var(--green-soft);
  border-color: var(--green-soft);
}

.chat-layout {
  max-width: 920px;
  min-height: calc(100vh - 132px);
  display: grid;
  grid-template-rows: auto auto;
  gap: 16px;
  align-content: start;
}

.chat-tools {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
}

.chat-thread {
  max-height: calc(100vh - 220px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
}

.message {
  max-width: 78%;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 14px;
  background: var(--surface);
  line-height: 1.5;
  animation: message-enter var(--motion-medium) var(--ease-standard) both;
}

.message.user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.message-meta {
  font-size: 12px;
  margin-bottom: 6px;
}

.recommendations,
.recommendation-actions {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.assistant-answer {
  display: grid;
  gap: 12px;
}

.message.assistant.answer-reveal .assistant-answer {
  animation: answer-reveal 420ms var(--ease-standard) both;
}

.message.assistant.answer-reveal .recommendation-actions {
  animation: answer-reveal 520ms var(--ease-standard) 120ms both;
}

.pairing-bubble.answer-reveal {
  animation: answer-reveal 420ms var(--ease-standard) both;
}

.assistant-answer.is-typing::after,
[data-assistant-text="true"].is-typing::after,
.pairing-bubble.is-typing::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 2px;
  border-right: 2px solid currentColor;
  transform: translateY(0.12em);
  animation: caret-blink 900ms steps(1, end) infinite;
}

.assistant-answer p {
  line-height: 1.55;
}

.assistant-answer .assistant-text-heading {
  color: var(--gold);
  font-weight: 800;
  margin-top: 1.1em;
  margin-bottom: 0.35em;
}

.assistant-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.message.is-pending [data-assistant-text="true"] {
  color: var(--muted);
}

.message.is-pending [data-assistant-text="true"]::after,
.pairing-bubble.is-pending::after {
  content: "";
  display: inline-block;
  width: 1.25em;
  height: 0.45em;
  margin-left: 0.35em;
  background: radial-gradient(circle, currentColor 25%, transparent 28%) 0 50% / 0.42em 0.42em repeat-x;
  opacity: 0.82;
  animation: status-pulse 1.2s var(--ease-standard) infinite;
}

.recommend-action {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.recommend-wine-card {
  min-height: 210px;
  animation: card-enter var(--motion-medium) var(--ease-standard) both;
}

.recommend-wine-card .wine-photo,
.recommend-wine-card img.wine-photo {
  height: 188px;
}

.recommend-action div:first-child {
  display: grid;
  gap: 2px;
}

.recommend-main {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.recommend-label {
  width: 64px;
  height: 84px;
  border: 1px solid rgba(240, 191, 114, 0.28);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.045);
}

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

.recommend-bottle-text {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 2px;
  padding: 0;
  text-align: left;
}

.recommend-action span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.recommend-action small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
}

.recommend-copy {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.recipe-list {
  display: grid;
  gap: 8px;
}

.recipe-link {
  border-left: 2px solid var(--green);
  padding-left: 10px;
  display: grid;
  gap: 2px;
}

.recipe-link a,
.recipe-link strong {
  color: var(--ink);
  font-size: 14px;
}

.recipe-link span {
  color: var(--muted);
  font-size: 13px;
}

.chat-composer {
  display: flex;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px;
}

.review-list {
  display: grid;
  gap: 12px;
  max-width: 900px;
}

.review-item {
  min-height: 168px;
}

.review-item-highlight {
  border-color: rgba(248, 209, 134, 0.58);
  box-shadow:
    0 0 0 1px rgba(248, 209, 134, 0.28),
    0 18px 42px rgba(248, 209, 134, 0.12);
}

.review-topline,
.review-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.review-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  justify-content: stretch;
  gap: 10px;
}

.review-actions button {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: 100%;
}

.review-actions .danger-button {
  color: var(--rose);
  border-color: rgba(183, 90, 74, 0.35);
}

.review-score {
  color: var(--rose);
  font-weight: 800;
}

.review-score.preference-icon {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  flex: 0 0 auto;
}

.review-score.preference-icon svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.review-score.preference-icon.love,
.review-score.preference-icon.up {
  color: var(--green);
}

.review-score.preference-icon.sideways {
  color: var(--gold);
}

.review-score.preference-icon.down {
  color: var(--rose);
}

.review-note {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.review-bottle-placeholder {
  color: var(--gold);
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 221, 151, 0.18), transparent 42%),
    linear-gradient(145deg, rgba(255, 248, 239, 0.08), rgba(255, 248, 239, 0.02));
  border: 1px solid rgba(239, 188, 112, 0.18);
}

.review-bottle-placeholder svg {
  width: 70%;
  height: 70%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.preference-picker {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.preference-picker legend {
  color: var(--muted);
  font-size: 13px;
  padding: 0 4px;
}

.preference-picker label {
  min-height: 122px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  display: grid;
  place-items: center;
  gap: 4px;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  padding: 10px 8px;
}

.preference-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.preference-picker svg {
  width: 88px;
  height: 88px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.rating-thumb-icon path {
  vector-effect: non-scaling-stroke;
}

.rating-thumb-icon circle {
  fill: currentColor;
  stroke: none;
}

.preference-picker span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.preference-picker label:has(input:checked) {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
}

.dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.dialog::backdrop {
  background: rgba(31, 37, 32, 0.32);
}

.dialog-card {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 16px;
}

.dialog-card.compact {
  width: min(480px, calc(100vw - 28px));
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-head h2,
#wineDetailTitle {
  color: var(--ink);
  font-family: Inter, "Avenir Next", "Helvetica Neue", Arial, ui-sans-serif, system-ui, sans-serif;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: none;
}

.setup-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.photo-drop {
  position: relative;
  min-height: 170px;
  border: 1px dashed var(--gold);
  border-radius: 2px;
  background: var(--surface);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--gold);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.photo-drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.photo-drop.dragging {
  border-color: var(--rose);
  background: var(--green-soft);
}

.photo-drop img {
  width: 100%;
  height: 240px;
  object-fit: cover;
}

.photo-drop[data-mode="back-label"] {
  min-height: 132px;
  grid-template-columns: 82px 1fr;
  place-items: center start;
  gap: 16px;
  padding: 16px;
  text-align: left;
}

.photo-drop[data-mode="back-label"] img {
  width: 82px;
  height: 108px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

.photo-drop[data-mode="back-label"] span {
  position: relative;
  z-index: 1;
  color: var(--gold);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.full-label {
  display: grid;
}

.batch-panel {
  display: grid;
  gap: 12px;
}

.scan-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.batch-rows {
  display: grid;
  gap: 12px;
}

.batch-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.scan-queue-row {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(241, 196, 130, 0.2);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.scan-queue-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.scan-queue-row strong {
  color: var(--ink);
  font-size: 13px;
}

.scan-queue-row span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-queue-row em {
  color: var(--gold);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.scan-queue-row.scan-queue-error em {
  color: var(--rose);
}

.batch-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.batch-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.batch-thumb {
  width: 58px;
  height: 42px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.batch-row .icon-button {
  width: 32px;
  height: 32px;
  font-size: 18px;
}

.low-confidence-panel {
  border: 1px solid rgba(183, 90, 74, 0.34);
  background: rgba(183, 90, 74, 0.08);
  border-radius: 2px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.low-confidence-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.back-label-upload {
  position: relative;
  border: 1px dashed var(--rose);
  background: var(--surface);
  color: var(--rose);
  padding: 10px 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.back-label-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dialog-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.rating-readout {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  color: var(--green);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 2px;
  padding: 32px;
  color: var(--muted);
  background: var(--surface);
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

  .cellar-shelf {
    min-height: 240px;
  }

  .origin-map-grid {
    min-height: 160px;
  }

  .origin-svg {
    min-height: 160px;
  }

  .topbar {
    padding: 0 16px;
  }

  .view {
    padding: 18px 16px;
  }

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

  .wine-card {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .wine-photo,
  .wine-card img.wine-photo {
    height: 210px;
  }

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

  .preference-picker {
    grid-template-columns: repeat(2, 1fr);
  }

  .wine-detail-photo {
    max-height: 260px;
  }

  .dialog-actions {
    flex-direction: column;
  }

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

  .message {
    max-width: 94%;
  }
}

/* Glug visual system */
:root {
  --paper: #3a0712;
  --surface: rgba(83, 11, 27, 0.86);
  --surface-strong: rgba(98, 15, 33, 0.94);
  --ink: #fff8ef;
  --muted: #d9b9ad;
  --line: rgba(255, 214, 164, 0.2);
  --green: #f0bf72;
  --green-soft: rgba(240, 191, 114, 0.18);
  --blue: #c58c6f;
  --rose: #e27b77;
  --gold: #f0bf72;
  --clay: #b7624b;
  --shadow: 0 22px 70px rgba(20, 0, 6, 0.42);
}

body {
  background:
    radial-gradient(circle at 52% 0%, rgba(120, 20, 40, 0.42), transparent 34rem),
    radial-gradient(circle at 8% 18%, rgba(240, 191, 114, 0.12), transparent 22rem),
    linear-gradient(145deg, #25030b 0%, #4b0717 48%, #2f0410 100%);
  color: var(--ink);
  font-family: Inter, "Avenir Next", "Helvetica Neue", Arial, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.65), transparent 72%);
}

h1,
h2,
.wine-name-button strong,
.map-count strong,
.empty-map strong,
.origin-wine-tile span,
.rating-readout {
  font-family: Inter, "Avenir Next", "Helvetica Neue", Arial, ui-sans-serif, system-ui, sans-serif;
}

h2,
.tab,
.text-button,
.secondary-button,
.primary-button,
.chat-composer button,
.wine-actions button,
.recommend-card button,
.wine-name-button span,
.recommend-action span,
.preference-picker span,
.back-label-upload {
  letter-spacing: 0.12em;
}

.server-warning {
  background: rgba(153, 45, 51, 0.96);
}

.scan-toast,
.panel,
.cellar-shelf,
.wine-card,
.message,
.review-item,
.dialog-card,
.batch-row,
.recommend-action,
.preference-picker,
.preference-picker label,
.chat-composer,
.search-wrap,
.pairing-bubble,
.photo-drop,
.empty-state {
  background: linear-gradient(160deg, rgba(92, 13, 31, 0.92), rgba(48, 5, 16, 0.8));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.app-shell {
  position: relative;
  z-index: 1;
  grid-template-columns: 340px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid rgba(255, 214, 164, 0.14);
  background:
    radial-gradient(circle at 50% 0%, rgba(240, 191, 114, 0.16), transparent 19rem),
    linear-gradient(180deg, rgba(71, 7, 22, 0.92), rgba(38, 3, 12, 0.74));
  padding: 28px;
}

.brand {
  align-items: center;
  text-align: center;
  gap: 0;
}

.brand-logo-wrap {
  max-width: 230px;
  place-items: center;
}

.brand-logo {
  max-width: 230px;
  border-radius: 28px;
  filter: drop-shadow(0 20px 34px rgba(0, 0, 0, 0.26));
  mix-blend-mode: normal;
}

.brand p {
  display: none;
}

.cellar-shelf {
  min-height: 285px;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 42%, rgba(240, 191, 114, 0.18), transparent 18rem),
    linear-gradient(160deg, rgba(93, 13, 31, 0.72), rgba(42, 4, 14, 0.9));
}

.main {
  background: linear-gradient(180deg, rgba(75, 7, 23, 0.34), rgba(35, 3, 11, 0.14));
}

.topbar {
  height: 84px;
  border-bottom: 1px solid rgba(255, 214, 164, 0.14);
  background: rgba(45, 4, 15, 0.64);
  backdrop-filter: blur(22px);
  padding: 0 32px;
}

.tabs {
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}

.tab,
.text-button,
.secondary-button,
.primary-button,
.chat-composer button,
.wine-actions button,
.recommend-card button,
.review-actions button,
.bottle-pairing-form button {
  border-color: rgba(240, 191, 114, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  box-shadow: none;
}

.tab.active,
.wine-actions button:first-child,
.primary-button,
.chat-composer button,
.recommend-card button,
.bottle-pairing-form button {
  background: linear-gradient(145deg, #ffd98b, #c98635);
  border-color: rgba(255, 225, 168, 0.62);
  color: #3a0712;
  box-shadow: 0 12px 28px rgba(240, 191, 114, 0.22);
}

.icon-button {
  border-radius: 50%;
  border-color: rgba(240, 191, 114, 0.34);
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold);
}

.icon-button.ghost {
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
}

.search-wrap,
select,
input,
textarea {
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  border-color: var(--line);
  border-radius: 18px;
}

input::placeholder,
textarea::placeholder {
  color: rgba(170, 182, 196, 0.76);
}

select option {
  color: #3a0712;
}

.wine-card {
  grid-template-columns: minmax(128px, 32%) minmax(0, 1fr);
  overflow: hidden;
}

.wine-image-wrap {
  background:
    radial-gradient(circle at 50% 44%, rgba(240, 191, 114, 0.18), transparent 9rem),
    rgba(255, 255, 255, 0.04);
  border-right: 1px solid var(--line);
}

.wine-card img.wine-photo,
.wine-photo,
.wine-detail-photo,
.batch-thumb,
.origin-wine-tile {
  border-radius: 16px;
}

.wine-photo {
  color: var(--gold);
}

.wine-name-button {
  color: var(--ink);
}

.wine-name-button strong {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.wine-name-button span,
.map-count span,
.wine-meta,
.wine-notes,
.review-date,
.message-meta,
.detail-list dt,
.scan-status,
.setup-copy,
label,
.recommend-copy,
.recipe-link span,
.origin-detail-head {
  color: var(--muted);
}

.wine-detail-copy,
.detail-list dd,
.wine-detail-content,
.wine-edit-form input,
.wine-edit-form textarea,
.wine-edit-form select {
  color: var(--ink);
}

.detail-note-section {
  display: grid;
  gap: 7px;
}

.detail-note-section h3 {
  margin: 0;
  color: #ffd98b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.detail-note-section .wine-notes {
  color: rgba(255, 248, 239, 0.88);
}

.enrichment-status {
  color: #ffd98b;
  font-size: 13px;
}

.qty,
.review-score.preference-icon,
.origin-wine-tile strong {
  background: linear-gradient(145deg, #ffd98b, #c98635);
  border: 1px solid rgba(255, 225, 168, 0.52);
  color: #3a0712;
  border-radius: 999px;
}

.chip {
  border-color: rgba(240, 191, 114, 0.28);
  background: rgba(240, 191, 114, 0.12);
  color: #ffd98b;
  border-radius: 999px;
}

.origin-outline {
  fill: rgba(240, 191, 114, 0.18);
  stroke: rgba(255, 226, 178, 0.9);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.28));
}

.origin-feature:hover .origin-outline,
.origin-feature:focus .origin-outline {
  fill: rgba(240, 191, 114, 0.32);
  stroke: #ffdf9a;
}

.origin-feature.state .origin-outline,
.origin-feature.province .origin-outline {
  stroke: #e6a989;
}

.origin-feature.continent .origin-outline {
  fill: rgba(240, 191, 114, 0.16);
  stroke: rgba(255, 225, 168, 0.92);
}

.origin-qty-dot {
  fill: rgba(58, 7, 18, 0.82);
  stroke: rgba(255, 225, 168, 0.85);
}

.origin-qty {
  fill: #fff8ef;
  font-size: 6.8px;
  font-weight: 650;
  paint-order: stroke;
  stroke: rgba(58, 7, 18, 0.78);
  stroke-width: 1.6px;
  stroke-linejoin: round;
}

.continent-qty {
  font-size: 8.8px;
}

.continent-head {
  margin-top: -4px;
}

.map-loading,
.empty-map {
  color: var(--muted);
}

.message.user,
.pairing-bubble.user {
  background: linear-gradient(145deg, rgba(255, 217, 139, 0.96), rgba(201, 134, 53, 0.92));
  border-color: rgba(255, 225, 168, 0.5);
  color: #3a0712;
}

.chat-layout {
  max-width: 980px;
}

.chat-thread {
  padding-right: 8px;
}

.recommend-action {
  background: rgba(255, 255, 255, 0.045);
  box-shadow: none;
}

.recipe-link {
  border-left-color: var(--gold);
}

.recipe-link a,
.recipe-link strong {
  color: var(--ink);
}

.review-score.preference-icon.love,
.review-score.preference-icon.up,
.review-score.preference-icon.sideways,
.review-score.preference-icon.down {
  color: #3a0712;
}

.preference-picker label:has(input:checked) {
  background: rgba(240, 191, 114, 0.18);
  border-color: rgba(240, 191, 114, 0.72);
  color: #ffdf9a;
}

.dialog::backdrop {
  background: rgba(30, 0, 8, 0.72);
  backdrop-filter: blur(10px);
}

.dialog-card {
  background:
    radial-gradient(circle at 50% 0%, rgba(240, 191, 114, 0.14), transparent 18rem),
    linear-gradient(155deg, rgba(91, 12, 30, 0.98), rgba(42, 4, 14, 0.96));
}

.photo-drop,
.back-label-upload {
  border-color: rgba(240, 191, 114, 0.45);
  color: #ffd98b;
}

.photo-drop.dragging {
  background: rgba(240, 191, 114, 0.12);
}

.low-confidence-panel {
  border-color: rgba(213, 125, 114, 0.36);
  background: rgba(213, 125, 114, 0.1);
  border-radius: 18px;
}

.empty-state {
  border-style: solid;
}

.dialog[open] {
  animation: dialog-shell-enter var(--motion-fast) var(--ease-standard) both;
}

.dialog[open]::backdrop {
  animation: backdrop-enter var(--motion-medium) var(--ease-standard) both;
}

.dialog[open] .dialog-card {
  animation: dialog-card-enter var(--motion-medium) var(--ease-standard) both;
}

.dialog[open].from-card .dialog-card {
  animation: detail-card-open 420ms var(--ease-standard) both;
}

.dialog[open].is-closing {
  animation: dialog-shell-exit var(--motion-fast) var(--ease-standard) both;
}

.dialog[open].is-closing .dialog-card {
  animation: dialog-card-exit var(--motion-fast) var(--ease-standard) both;
}

button,
.wine-card,
.recommend-action,
.origin-feature,
.origin-wine-tile {
  transition:
    transform var(--motion-fast) var(--ease-press),
    border-color var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard),
    opacity var(--motion-fast) var(--ease-standard);
}

button:active,
.origin-wine-tile:active {
  transform: translateY(1px) scale(0.985);
}

.wine-card:hover,
.recommend-action:hover,
.origin-wine-tile:hover {
  transform: translateY(-2px);
}

.recommend-action {
  animation: card-enter var(--motion-medium) var(--ease-standard) both;
}

.recommendation-actions .recommend-action:nth-child(2),
.recommendation-actions .recommend-wine-card:nth-child(2) {
  animation-delay: 70ms;
}

.recommendation-actions .recommend-action:nth-child(3),
.recommendation-actions .recommend-wine-card:nth-child(3) {
  animation-delay: 140ms;
}

.scan-toast:not([hidden]) {
  animation: toast-enter var(--motion-medium) var(--ease-standard) both;
}

.photo-drop.dragging {
  transform: scale(1.01);
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes message-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes answer-reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes map-level-exit {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
}

@keyframes map-level-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(1.035);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dialog-shell-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes dialog-card-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes detail-card-open {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.92);
    filter: blur(3px);
  }
  55% {
    opacity: 1;
    filter: blur(0);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes dialog-shell-exit {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes dialog-card-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

@keyframes backdrop-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes caret-blink {
  0%,
  45% {
    opacity: 1;
  }
  46%,
  100% {
    opacity: 0;
  }
}

@keyframes status-pulse {
  0%,
  100% {
    opacity: 0.38;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 214, 164, 0.14);
  }

  .brand-logo-wrap,
  .brand-logo {
    max-width: 190px;
  }

  .topbar {
    height: auto;
    gap: 12px;
    padding: 14px 16px;
    flex-wrap: wrap;
  }

  .tabs {
    flex: 1;
    justify-content: space-between;
  }

.tab {
  flex: 1;
}
}

.add-bottle-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 50;
  width: min(520px, calc(100vw - 34px));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(255, 220, 157, 0.78);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 248, 239, 0.16), transparent 37%),
    radial-gradient(circle at 50% -24%, rgba(255, 214, 132, 0.34), transparent 58%),
    linear-gradient(180deg, rgba(82, 9, 29, 0.98), rgba(30, 2, 11, 0.99));
  box-shadow:
    0 0 0 1px rgba(255, 248, 239, 0.12) inset,
    0 2px 0 rgba(255, 248, 239, 0.12) inset,
    0 -16px 40px rgba(255, 214, 132, 0.16),
    0 30px 82px rgba(8, 1, 5, 0.8),
    0 9px 24px rgba(8, 1, 5, 0.5);
  backdrop-filter: blur(26px) saturate(1.18);
  transform: translateX(-50%);
}

.bottom-nav-button {
  appearance: none;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 3px;
  border: 1px solid rgba(255, 220, 157, 0.14);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 248, 239, 0.11), rgba(255, 248, 239, 0.03));
  color: rgba(255, 248, 239, 0.84);
  padding: 9px 3px 8px;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.02em;
  line-height: 1.05;
  box-shadow:
    0 1px 0 rgba(255, 248, 239, 0.1) inset,
    0 8px 18px rgba(10, 2, 5, 0.24);
  transition: background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard);
}

.bottom-nav-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav-button.active,
.bottom-nav-button:hover,
.bottom-nav-button:focus-visible {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 248, 239, 0.48), transparent 56%),
    linear-gradient(180deg, rgba(255, 218, 143, 0.46), rgba(156, 104, 42, 0.44));
  border-color: rgba(255, 232, 176, 0.82);
  color: #fff8ef;
  transform: translateY(-3px);
  box-shadow:
    0 0 0 1px rgba(255, 248, 239, 0.18) inset,
    0 0 26px rgba(255, 214, 132, 0.28),
    0 15px 30px rgba(10, 2, 5, 0.42);
}

.bottom-nav-add svg {
  stroke-width: 1.9;
}

.shops-view {
  min-height: min(520px, 68vh);
  position: relative;
  display: none;
  place-items: center;
}

.shops-view.active-view {
  display: grid;
}

.shops-close {
  position: absolute;
  top: 20px;
  right: 20px;
}

.coming-soon-panel {
  display: grid;
  justify-items: center;
  gap: 14px;
  color: #fff8ef;
  text-align: center;
}

.coming-soon-panel svg {
  width: 68px;
  height: 68px;
  fill: none;
  stroke: #ffd684;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.coming-soon-panel h2 {
  color: #ffd684;
  font-size: 13px;
}

.coming-soon-panel p {
  margin: 0;
  color: rgba(255, 248, 239, 0.72);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
}

body {
  padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
}

.topbar {
  display: none;
}

.main {
  padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
}

.sidebar > .brand {
  display: none;
}

.map-count {
  align-items: flex-start;
  justify-content: space-between;
  color: var(--ink);
}

.map-count span {
  padding-top: 4px;
  color: rgba(247, 244, 238, 0.82);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.map-logo {
  width: 164px;
  height: 88px;
  object-fit: contain;
  border-radius: 16px;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.24));
}

.cellar-shelf {
  min-height: 430px;
}

.origin-map-grid {
  min-height: 305px;
}

.origin-svg {
  min-height: 305px;
}

/* Keep the prototype in a phone-style vertical layout at every window size. */
.app-shell {
  width: min(100%, 640px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
}

.sidebar {
  border-right: 0;
  border-bottom: 1px solid rgba(255, 214, 164, 0.14);
}

.main {
  min-width: 0;
}

.cellar-shelf {
  width: 100%;
}

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

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 8;
}

@media (max-width: 560px) {
  html {
    scroll-padding-top: calc(96px + env(safe-area-inset-top, 0px));
    scroll-padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }

  body {
    min-height: 100svh;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overscroll-behavior-y: contain;
  }

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

  .sidebar {
    scroll-margin-top: calc(16px + env(safe-area-inset-top, 0px));
  }

  .topbar {
    top: env(safe-area-inset-top, 0px);
  }

  .view {
    padding: 16px 12px calc(42px + env(safe-area-inset-bottom, 0px));
    scroll-margin-top: calc(96px + env(safe-area-inset-top, 0px));
    scroll-margin-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }

  .chat-layout {
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }

  .chat-composer,
  .bottle-pairing-form {
    scroll-margin-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  }

  .dialog-card {
    max-height: calc(100svh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px);
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }

  .wine-grid {
    gap: 14px;
  }

  .wine-card {
    grid-template-columns: minmax(104px, 34%) minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
  }

  .wine-image-wrap {
    min-height: 100%;
    padding: 6px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .wine-photo,
  .wine-card img.wine-photo {
    height: 100%;
    min-height: 190px;
  }

  .wine-body {
    padding: 14px;
    gap: 9px;
    min-width: 0;
  }

  .wine-title {
    align-items: flex-start;
  }

  .wine-name-button strong {
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  .wine-meta,
  .wine-notes {
    overflow-wrap: anywhere;
  }

  .keyword-row {
    gap: 6px;
  }

  .wine-actions {
    display: none;
  }

  .detail-manage-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-manage-actions .primary-button,
  .detail-manage-actions .danger-button {
    grid-column: span 2;
  }

  .detail-open-row .primary-button {
    grid-column: auto;
  }

  .bottle-pairing-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
  }

  .bottle-pairing-form textarea {
    min-height: 76px;
  }

  .bottle-pairing-form button {
    min-height: 44px;
    min-width: 96px;
  }

  .origin-qty {
    font-size: 12px;
    stroke-width: 2.2px;
  }

  .continent-qty {
    font-size: 14.5px;
  }

  .origin-qty-dot {
    r: 4.6px;
  }

  .continent-qty-dot {
    r: 5.4px;
  }
}

/* Premium login / landing refresh */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(22px, env(safe-area-inset-top, 0px)) 18px max(22px, env(safe-area-inset-bottom, 0px));
  overflow: auto;
  background:
    radial-gradient(circle at 50% 14%, rgba(248, 210, 139, 0.11), transparent 18rem),
    radial-gradient(circle at 12% 88%, rgba(121, 21, 39, 0.46), transparent 18rem),
    radial-gradient(circle at 88% 80%, rgba(74, 8, 23, 0.48), transparent 20rem),
    linear-gradient(155deg, #3d0814 0%, #21030a 48%, #0d0105 100%);
}

.auth-card {
  position: relative;
  width: min(430px, calc(100vw - 36px));
  display: grid;
  gap: 17px;
  padding: clamp(19px, 5vw, 30px);
  overflow: hidden;
  border: 1px solid rgba(239, 188, 112, 0.24);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 247, 238, 0.075), rgba(255, 247, 238, 0.028)),
    rgba(38, 3, 12, 0.74);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 238, 0.11),
    0 36px 110px rgba(3, 0, 2, 0.58);
  backdrop-filter: blur(26px) saturate(1.08);
  animation: glug-view-enter 420ms var(--ease-standard) both;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(248, 210, 139, 0.11), transparent 14rem),
    radial-gradient(circle at 8% 0%, rgba(255, 247, 238, 0.055), transparent 13rem);
  opacity: 0.9;
}

.auth-card > * {
  position: relative;
  z-index: 1;
}

.auth-logo {
  width: min(330px, 78vw);
  display: block;
  justify-self: center;
  border-radius: 26px;
  border: 1px solid rgba(239, 188, 112, 0.16);
  background: rgba(22, 2, 8, 0.54);
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 238, 0.08),
    0 22px 58px rgba(5, 0, 2, 0.34);
}

.auth-card .eyebrow {
  margin: 0;
  color: var(--gold-bright);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}

.auth-card label {
  gap: 8px;
  color: rgba(255, 237, 218, 0.72);
  font-size: 12px;
  font-weight: 560;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.auth-card input {
  min-height: 48px;
  border: 1px solid rgba(239, 188, 112, 0.18);
  border-radius: 17px;
  background: rgba(12, 1, 5, 0.32);
  color: var(--ink);
  padding: 13px 15px;
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 238, 0.05),
    0 10px 28px rgba(3, 0, 2, 0.12);
}

.auth-card input:focus {
  border-color: rgba(248, 210, 139, 0.66);
  box-shadow:
    0 0 0 3px rgba(248, 210, 139, 0.1),
    0 14px 36px rgba(3, 0, 2, 0.18);
}

.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px rgba(39, 3, 12, 0.94) inset;
  border-color: rgba(239, 188, 112, 0.28);
}

.auth-status {
  min-height: 20px;
  margin: 0;
  color: rgba(255, 237, 218, 0.64);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.auth-card .dialog-actions {
  margin-top: 2px;
  justify-content: stretch;
}

.auth-card .primary-button {
  width: 100%;
  min-height: 50px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 660;
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 238, 0.42),
    0 18px 38px rgba(233, 182, 109, 0.22);
}

@media (max-width: 560px) {
  .auth-gate {
    align-items: center;
    padding-inline: 16px;
  }

  .auth-card {
    width: min(100%, 390px);
    border-radius: 28px;
  }

  .auth-logo {
    width: min(300px, 76vw);
    border-radius: 24px;
  }
}

body {
  padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
}

.topbar {
  display: none;
}

.main {
  padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 560px) {
  html {
    scroll-padding-top: calc(18px + env(safe-area-inset-top, 0px));
    scroll-padding-bottom: calc(124px + env(safe-area-inset-bottom, 0px));
  }

  body {
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }

  .view {
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
    scroll-margin-top: calc(18px + env(safe-area-inset-top, 0px));
  }

  .bottom-nav {
    width: min(410px, calc(100vw - 22px));
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    padding: 7px;
    border-radius: 999px;
    box-shadow:
      0 0 0 1px rgba(255, 248, 239, 0.12) inset,
      0 2px 0 rgba(255, 248, 239, 0.1) inset,
      0 -10px 26px rgba(255, 214, 132, 0.12),
      0 16px 44px rgba(8, 1, 5, 0.62);
    backdrop-filter: none;
  }

  .bottom-nav-button {
    font-size: 9px;
    padding: 7px 2px 6px;
  }

  .bottom-nav-button svg {
    width: 22px;
    height: 22px;
  }
}

/* Premium burgundy visual refresh */
:root {
  --app-bg-solid: #21040a;
  --app-bg:
    radial-gradient(circle at 50% -12%, rgba(120, 28, 48, 0.58), transparent 29rem),
    radial-gradient(circle at 10% 10%, rgba(232, 174, 100, 0.095), transparent 19rem),
    radial-gradient(circle at 88% 18%, rgba(255, 216, 142, 0.07), transparent 18rem),
    linear-gradient(150deg, #21040a 0%, #3f0714 50%, #21040a 100%);
  --paper: #21040a;
  --surface: rgba(62, 8, 18, 0.72);
  --surface-strong: rgba(74, 10, 23, 0.86);
  --surface-soft: rgba(255, 246, 232, 0.055);
  --ink: #fff7ee;
  --muted: rgba(255, 235, 217, 0.68);
  --line: rgba(239, 188, 112, 0.18);
  --line-strong: rgba(239, 188, 112, 0.32);
  --gold: #e9b66d;
  --gold-bright: #ffd88e;
  --rose: #e47973;
  --shadow: 0 26px 80px rgba(9, 0, 4, 0.44);
  --shadow-soft: 0 16px 46px rgba(12, 0, 5, 0.26);
  --ease-standard: cubic-bezier(0.2, 0.9, 0.2, 1);
  --motion-fast: 170ms;
  --motion-medium: 280ms;
  --motion-slow: 460ms;
}

body {
  background: var(--app-bg);
  background-color: var(--app-bg-solid);
  background-attachment: fixed;
  font-family: Inter, "SF Pro Display", "Avenir Next", "Helvetica Neue", Arial, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html {
  background: var(--app-bg);
  background-color: var(--app-bg-solid);
  background-attachment: fixed;
}

body::before {
  opacity: 0.22;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.08), transparent 18rem),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: auto, 56px 56px, 56px 56px;
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: env(safe-area-inset-top, 0px);
  z-index: 2147483647;
  pointer-events: none;
  background: var(--app-bg-solid);
}

.app-shell {
  width: min(100%, 620px);
  max-width: 100%;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 14rem),
    linear-gradient(180deg, rgba(53, 5, 17, 0.52), rgba(24, 2, 8, 0.16));
}

.app-shell,
.sidebar,
.main,
.view,
.cellar-shelf,
.origin-map-grid,
.origin-svg,
.wine-grid,
.wine-card,
.wine-image-wrap,
.wine-body,
.toolbar,
.search-wrap,
.chat-composer,
.bottom-nav {
  max-width: 100%;
  min-width: 0;
}

.sidebar {
  padding: 16px 14px 10px;
  border: 0;
  background: transparent;
}

.main {
  background: transparent;
}

.view {
  padding: 14px 14px calc(44px + env(safe-area-inset-bottom, 0px));
}

h1,
.coming-soon-panel p,
.section-heading h2,
.dialog-head h2,
#wineDetailTitle {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.section-heading h2,
.dialog-head h2,
#wineDetailTitle {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.12;
  text-transform: none;
}

h2,
.eyebrow,
.drawer-panel h3,
.map-place-label,
.wine-name-button span,
.message-meta {
  font-weight: 720;
  letter-spacing: 0.075em;
}

.eyebrow,
.drawer-panel h3,
.map-place-label {
  color: var(--gold);
}

.cellar-shelf,
.wine-card,
.message,
.review-item,
.dialog-card,
.batch-row,
.preference-picker,
.preference-picker label,
.chat-composer,
.search-wrap,
.pairing-bubble,
.photo-drop,
.empty-state,
.drawer-panel,
.profile-card,
.access-row,
.origin-wine-tile {
  background:
    linear-gradient(180deg, rgba(255, 247, 234, 0.052), rgba(255, 247, 234, 0.018)),
    radial-gradient(circle at 50% 0%, rgba(233, 182, 109, 0.075), transparent 11rem),
    rgba(55, 6, 17, 0.66);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px) saturate(1.08);
}

.cellar-shelf {
  min-height: 382px;
  padding: 16px 16px 12px;
  background:
    radial-gradient(circle at 30% 18%, rgba(233, 182, 109, 0.12), transparent 14rem),
    radial-gradient(circle at 76% 54%, rgba(255, 216, 142, 0.07), transparent 18rem),
    linear-gradient(150deg, rgba(69, 8, 21, 0.82), rgba(31, 3, 10, 0.9));
  border-color: rgba(239, 188, 112, 0.24);
}

.map-count {
  align-items: start;
}

.map-logo {
  width: 152px;
  height: 82px;
  object-fit: contain;
  padding: 5px;
  border: 1px solid rgba(239, 188, 112, 0.12);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 216, 142, 0.08), transparent 6rem),
    rgba(25, 2, 9, 0.32);
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.28));
}

.map-count-actions {
  padding-top: 4px;
  gap: 10px;
}

.map-account-button {
  width: 30px;
  height: 30px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: rgba(255, 247, 238, 0.9);
  font-size: 20px;
  letter-spacing: 0.09em;
}

.map-account-button:hover,
.map-account-button:focus-visible {
  background: rgba(255, 247, 238, 0.06);
  box-shadow: 0 0 0 1px rgba(239, 188, 112, 0.22);
}

.map-count-lines {
  gap: 4px;
}

.map-count span,
.map-count-lines span {
  color: rgba(255, 237, 218, 0.78);
  font-size: 14px;
  font-weight: 450;
  letter-spacing: 0.01em;
}

.origin-map-grid {
  min-height: 265px;
  margin-top: -4px;
}

.origin-svg {
  min-height: 265px;
  width: 100%;
  display: block;
}

.origin-outline,
.origin-feature.state .origin-outline,
.origin-feature.province .origin-outline,
.origin-feature.continent .origin-outline {
  fill: transparent;
  stroke: rgba(255, 203, 118, 0.93);
  stroke-width: 0.74;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 2px 5px rgba(233, 182, 109, 0.14));
}

.origin-feature.continent .origin-outline {
  stroke-width: 0.68;
}

.origin-feature:hover .origin-outline,
.origin-feature:focus .origin-outline {
  fill: rgba(233, 182, 109, 0.045);
  stroke: var(--gold-bright);
  stroke-width: 0.95;
  filter: drop-shadow(0 0 9px rgba(233, 182, 109, 0.22));
}

.origin-qty-dot,
.continent-qty-dot {
  fill: rgba(39, 3, 11, 0.54);
  stroke: rgba(255, 216, 142, 0.42);
  stroke-width: 0.28;
}

.origin-qty,
.continent-qty {
  fill: var(--ink);
  font-weight: 560;
  stroke: rgba(39, 3, 11, 0.72);
  stroke-width: 1px;
  paint-order: stroke;
}

.origin-qty {
  font-size: 5.2px;
}

.continent-qty {
  font-size: 8px;
}

.origin-detail-head {
  color: var(--muted);
}

.map-place-label {
  color: var(--gold-bright);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0.02em;
}

.toolbar {
  gap: 10px;
  margin-bottom: 16px;
  max-width: 100%;
}

.search-wrap,
.toolbar select,
select,
input,
textarea {
  border-color: rgba(239, 188, 112, 0.15);
  background: rgba(34, 3, 11, 0.28);
  color: var(--ink);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 247, 238, 0.035);
}

.search-wrap {
  flex: 1 1 auto;
  height: 42px;
  padding: 0 12px;
}

.search-wrap span {
  color: rgba(233, 182, 109, 0.78);
}

.toolbar select {
  flex: 0 0 clamp(96px, 28vw, 112px);
  width: clamp(96px, 28vw, 112px);
  min-width: 0;
  height: 42px;
  font-size: 13px;
  font-weight: 500;
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 235, 217, 0.46);
}

.wine-grid {
  gap: 13px;
}

.wine-card,
.review-item {
  border-radius: 18px;
  border-color: rgba(239, 188, 112, 0.16);
  box-shadow: 0 14px 42px rgba(8, 0, 4, 0.24);
}

.wine-card {
  grid-template-columns: minmax(118px, 30%) minmax(0, 1fr);
  min-height: 168px;
}

.wine-name-button,
.wine-name-button strong,
.wine-meta,
.wine-notes,
.keyword-row,
.descriptor-chip {
  min-width: 0;
  overflow-wrap: anywhere;
}

.wine-image-wrap {
  background: rgba(255, 247, 238, 0.045);
  border-right-color: rgba(239, 188, 112, 0.12);
  padding: 8px;
}

.wine-photo,
.wine-card img.wine-photo {
  height: 154px;
  min-height: 154px;
  border-radius: 12px;
}

.wine-body {
  padding: 13px 13px 12px;
  gap: 7px;
}

.wine-name-button span {
  color: var(--gold);
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0.045em;
}

.wine-name-button strong {
  color: var(--ink);
  font-family: Inter, "SF Pro Display", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-weight: 640;
  letter-spacing: -0.005em;
}

.wine-meta,
.wine-notes,
.review-date,
.message-meta {
  color: var(--muted);
  font-size: 13px;
}

.qty,
.review-score.preference-icon,
.origin-wine-tile strong {
  background: linear-gradient(145deg, #f8d186, #c98a3b);
  color: #2b030b;
  border: 0;
  box-shadow: 0 10px 22px rgba(233, 182, 109, 0.18);
}

.chip {
  padding: 5px 9px;
  border-color: rgba(239, 188, 112, 0.22);
  background: rgba(233, 182, 109, 0.08);
  color: #f4c986;
  font-size: 11px;
  font-weight: 560;
  letter-spacing: 0.01em;
}

.descriptor-chip:hover,
.descriptor-chip:focus-visible {
  background: rgba(233, 182, 109, 0.15);
  border-color: rgba(255, 216, 142, 0.44);
  transform: translateY(-1px);
}

.tab,
.text-button,
.secondary-button,
.primary-button,
.chat-composer button,
.wine-actions button,
.review-actions button,
.bottle-pairing-form button,
.back-label-upload {
  min-height: 38px;
  border-radius: 999px;
  border-color: rgba(239, 188, 112, 0.18);
  background: rgba(255, 247, 238, 0.035);
  color: rgba(255, 247, 238, 0.88);
  font-size: 13px;
  font-weight: 560;
  letter-spacing: 0.01em;
  text-transform: none;
  box-shadow: none;
}

.primary-button,
.chat-composer button,
.bottle-pairing-form button,
.drawer-panel .primary-button,
.tab.active {
  border: 0;
  background: linear-gradient(145deg, #f8d186, #bd7c32);
  color: #27030a;
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 238, 0.38),
    0 12px 28px rgba(233, 182, 109, 0.18);
}

.secondary-button,
.review-actions button,
.text-button {
  background: rgba(255, 247, 238, 0.035);
}

.danger-button,
.review-actions .danger-button,
.detail-manage-actions .danger-button,
.access-row button {
  border-color: rgba(228, 121, 115, 0.26);
  background: rgba(228, 121, 115, 0.045);
  color: #ff8a82;
}

.chat-layout {
  gap: 14px;
}

.message {
  border-radius: 18px;
  padding: 15px;
  line-height: 1.56;
  max-width: 92%;
}

.message.user,
.pairing-bubble.user {
  background: rgba(255, 247, 238, 0.09);
  color: var(--ink);
  border-color: rgba(255, 247, 238, 0.12);
}

.assistant-answer p {
  line-height: 1.62;
}

.assistant-answer p,
.pairing-bubble p {
  margin: 0;
}

.assistant-answer p + p,
.pairing-bubble p + p {
  margin-top: 1em;
}

.assistant-answer strong,
.pairing-bubble strong {
  color: var(--gold);
  font-weight: 680;
}

.chat-composer {
  border-radius: 20px;
  padding: 7px;
}

.chat-composer textarea {
  padding-left: 6px;
  min-height: 58px;
}

.bottle-pairing-actions {
  display: flex;
  justify-content: flex-end;
}

.review-list {
  gap: 13px;
}

.review-topline strong {
  font-size: 15px;
  line-height: 1.35;
}

.review-score.preference-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.review-score.preference-icon svg {
  width: 44px;
  height: 44px;
  stroke-width: 1.35;
}

.preference-picker {
  gap: 8px;
  padding: 10px;
}

.preference-picker label {
  min-height: 108px;
}

.dialog-card {
  border-radius: 24px;
  border-color: rgba(239, 188, 112, 0.22);
  box-shadow: 0 32px 96px rgba(4, 0, 2, 0.52);
}

.account-drawer {
  background:
    radial-gradient(circle at 80% 0%, rgba(233, 182, 109, 0.13), transparent 19rem),
    linear-gradient(160deg, rgba(64, 8, 19, 0.98), rgba(20, 2, 7, 0.98));
}

.profile-avatar {
  background: linear-gradient(145deg, #f8d186, #bd7c32);
  color: #27030a;
  box-shadow: 0 12px 26px rgba(233, 182, 109, 0.18);
}

.profile-card p,
.drawer-note,
.drawer-status,
.access-row span {
  color: var(--muted);
}

.bottom-nav {
  width: min(500px, calc(100vw - 30px));
  padding: 8px;
  border-color: rgba(239, 188, 112, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 247, 238, 0.075), rgba(255, 247, 238, 0.025)),
    rgba(27, 2, 9, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 238, 0.12),
    0 18px 58px rgba(3, 0, 2, 0.62);
  backdrop-filter: blur(24px) saturate(1.08);
}

.bottom-nav-button {
  border-color: transparent;
  background: transparent;
  color: rgba(255, 237, 218, 0.68);
  font-size: 10px;
  font-weight: 520;
  letter-spacing: 0;
  box-shadow: none;
}

.bottom-nav-button svg {
  stroke-width: 1.35;
}

.bottom-nav-button.active,
.bottom-nav-button:hover,
.bottom-nav-button:focus-visible {
  color: var(--gold-bright);
  background:
    radial-gradient(circle at 50% 18%, rgba(233, 182, 109, 0.24), transparent 56%),
    rgba(255, 247, 238, 0.045);
  border-color: rgba(239, 188, 112, 0.14);
  box-shadow:
    0 0 24px rgba(233, 182, 109, 0.13),
    inset 0 1px 0 rgba(255, 247, 238, 0.08);
  transform: translateY(-2px);
}

button,
.wine-card,
.origin-feature,
.origin-wine-tile,
.descriptor-chip,
.bottom-nav-button {
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard),
    opacity var(--motion-fast) var(--ease-standard);
}

@media (max-width: 560px) {
  .sidebar {
    padding: 12px 10px 6px;
  }

  .cellar-shelf {
    overflow: hidden;
    min-height: 336px;
    padding: 13px 12px 10px;
    border-radius: 24px;
  }

  .map-logo {
    width: 136px;
    height: 74px;
  }

  .origin-map-grid,
  .origin-svg {
    min-height: 220px;
  }

  .origin-qty {
    font-size: 8.6px;
    stroke-width: 1.65px;
  }

  .continent-qty {
    font-size: 10.6px;
  }

  .origin-qty-dot {
    r: 3.7px;
  }

  .continent-qty-dot {
    r: 4.35px;
  }

  .view {
    padding-inline: 10px;
  }

  .wine-card {
    grid-template-columns: clamp(92px, 29vw, 112px) minmax(0, 1fr);
    border-radius: 18px;
  }

  .wine-photo,
  .wine-card img.wine-photo {
    min-height: 156px;
    height: 156px;
  }

  .wine-body {
    padding: 12px;
  }

  .bottom-nav {
    border-color: rgba(239, 188, 112, 0.28);
    box-shadow:
      inset 0 1px 0 rgba(255, 247, 238, 0.1),
      0 14px 44px rgba(3, 0, 2, 0.58);
  }
}

.opened-bottle-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(239, 188, 112, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(circle at 14% 0%, rgba(255, 221, 151, 0.16), transparent 45%),
    linear-gradient(145deg, rgba(74, 11, 28, 0.78), rgba(34, 4, 13, 0.9));
  color: #fff8ef;
  box-shadow: 0 16px 44px rgba(8, 0, 4, 0.28);
}

.opened-bottle-banner span {
  display: block;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.opened-bottle-banner strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.opened-bottle-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chat-open-button {
  width: fit-content;
  min-width: 112px;
  margin-top: 4px;
  padding-inline: 18px;
}

.dialog-actions.stacked {
  display: grid;
  gap: 10px;
}

.bottom-nav-button {
  position: relative;
}

.nav-badge {
  position: absolute;
  top: 3px;
  right: 16%;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(145deg, #ffd98b, #c98635);
  color: #23040e;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(255, 248, 239, 0.5), 0 8px 18px rgba(0, 0, 0, 0.24);
}

.section-badge {
  display: inline-grid;
  place-items: center;
  align-self: center;
  min-height: 26px;
  padding: 5px 10px;
  border: 1px solid rgba(239, 188, 112, 0.28);
  border-radius: 999px;
  background: rgba(255, 248, 239, 0.07);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 560px) {
  .opened-bottle-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .opened-bottle-actions {
    width: 100%;
    justify-content: stretch;
  }

  .opened-bottle-actions button {
    flex: 1;
  }
}

/* Mobile viewport guardrails: keep large surfaces inside the usable screen. */
:root {
  --safe-inline-gutter: max(12px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --safe-screen-width: calc(100vw - (var(--safe-inline-gutter) * 2));
  --safe-panel-width: min(100%, var(--safe-screen-width));
  --safe-shell-width: min(620px, 100%, var(--safe-screen-width));
  --safe-dialog-width: min(760px, 100%, var(--safe-screen-width));
  --safe-dialog-width-compact: min(480px, 100%, var(--safe-screen-width));
  --safe-detail-width: min(920px, 100%, var(--safe-screen-width));
}

@supports (width: 100dvw) {
  :root {
    --safe-screen-width: calc(100dvw - (var(--safe-inline-gutter) * 2));
  }
}

@supports (overflow: clip) {
  html,
  body,
  .app-shell,
  .main,
  .view,
  .cellar-shelf,
  .dialog-card,
  .wine-detail-card,
  .account-drawer {
    overflow-x: clip;
  }
}

.app-shell {
  width: var(--safe-shell-width);
  max-width: var(--safe-shell-width);
}

.app-shell,
.sidebar,
.main,
.view,
.cellar-shelf,
.origin-map-grid,
.origin-svg,
.wine-grid,
.wine-card,
.wine-image-wrap,
.wine-body,
.toolbar,
.search-wrap,
.chat-layout,
.chat-thread,
.chat-composer,
.message,
.review-list,
.review-item,
.recommendation-actions,
.recommend-action,
.recommend-wine-card,
.dialog-card,
.wine-detail-card,
.wine-detail-content,
.bottle-pairing-panel,
.bottle-pairing-form,
.drawer-panel,
.profile-card,
.access-row,
.origin-filter-banner,
.coming-soon-panel {
  max-width: 100%;
  min-width: 0;
}

.dialog {
  max-width: 100vw;
  max-height: 100vh;
}

@supports (width: 100dvw) {
  .dialog {
    max-width: 100dvw;
    max-height: 100dvh;
  }
}

.dialog-card {
  width: var(--safe-dialog-width);
  max-width: var(--safe-dialog-width);
  margin-inline: auto;
}

.dialog-card.compact {
  width: var(--safe-dialog-width-compact);
  max-width: var(--safe-dialog-width-compact);
}

.wine-detail-card {
  width: var(--safe-detail-width);
  max-width: var(--safe-detail-width);
  margin-inline: auto;
}

.account-drawer {
  width: min(390px, 100vw);
  max-width: 100vw;
  padding-right: max(18px, calc(env(safe-area-inset-right, 0px) + 16px));
  padding-left: max(18px, calc(env(safe-area-inset-left, 0px) + 16px));
  overflow-x: hidden;
}

@supports (width: 100dvw) {
  .account-drawer {
    width: min(390px, 100dvw);
    max-width: 100dvw;
    height: 100dvh;
  }
}

@media (max-width: 560px) {
  .view {
    padding-inline: max(14px, var(--safe-inline-gutter));
  }

  .dialog-card,
  .wine-detail-card {
    width: var(--safe-panel-width);
    max-width: var(--safe-panel-width);
  }

  .bottom-nav {
    width: min(410px, var(--safe-screen-width));
    max-width: var(--safe-screen-width);
  }
}

/* Account drawer needs extra safe-area space because it is edge-pinned. */
.account-drawer {
  width: min(390px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  height: 100vh;
  padding-top: max(22px, calc(env(safe-area-inset-top, 0px) + 20px));
  padding-right: max(18px, calc(env(safe-area-inset-right, 0px) + 18px));
  padding-bottom: max(24px, calc(env(safe-area-inset-bottom, 0px) + 24px));
  padding-left: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@supports (width: 100dvw) {
  .account-drawer {
    width: min(390px, calc(100dvw - 28px));
    max-width: calc(100dvw - 28px);
    height: 100dvh;
  }
}

.account-drawer .drawer-head {
  min-height: 48px;
  flex: 0 0 auto;
  gap: 12px;
}

.account-drawer .drawer-head .icon-button {
  width: 48px;
  height: 48px;
  min-width: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  margin: 0;
}
