:root {
  --bg: #121212;
  --surface: #1a1a1a;
  --surface-2: #222;
  --border: #2e2e2e;
  --text: #f0f0f0;
  --text-dim: #9a9a9a;
  --muted: #6b6b6b;
  --accent: #4a9ae8;
  --chart-point: #4a9ae8;
  --chart-line: #e85a5a;
  --track: #333;
  --thumb: #e8e8e8;
  --acidity: #ffe8f2;
  --sweetness: #ffd0e6;
  --botanical: #f494b9;
  --proof: #c85082;
  --aroma: #6a2e48;
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --touch-min: 44px;
  --viz-heading-pink: rgba(255, 0, 149, 1);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

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

button,
.btn,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  touch-action: manipulation;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: clip;
}

.app {
  max-width: 1240px;
  margin: 0 auto;
  padding-top: max(1rem, var(--safe-top));
  padding-right: max(1rem, var(--safe-right));
  padding-bottom: max(1.5rem, var(--safe-bottom));
  padding-left: max(1rem, var(--safe-left));
  background: transparent;
  background-image: none;
}

.hero--dash {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

@media (max-width: 640px) {
  .hero--dash {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding-bottom: 0.75rem;
  }
}

.hero__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.hero--dash .hero__brand {
  flex-wrap: wrap;
  align-items: baseline;
}

.hero--dash .hero__brand h1 {
  margin: 0;
  font-size: clamp(17px, 2.8vw, 1.42rem);
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: 0.02em;
  max-width: min(100%, 28rem);
}

.hero__brand h1 {
  margin: 0;
}

.hero__badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background-color: rgba(255, 219, 237, 1);
  color: #0a0e12;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.dashboard__top {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .dashboard__top {
    flex-direction: row;
    align-items: stretch;
  }

  .dashboard__inputs {
    flex: 0 0 40%;
    max-width: 40%;
    min-width: 0;
    order: 0;
  }

  .dashboard__viz {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    order: 0;
  }
}

.dashboard__viz .card--viz {
  flex: 1;
  min-height: 0;
}

.dashboard__viz .card--viz.card--viz-fingerprint {
  flex: 0 0 auto;
}

.dashboard__bottom {
  width: 100%;
}

.card--compact {
  padding: 0.85rem 1rem;
}

.card--compact .card-title {
  margin-bottom: 0.65rem;
  font-size: 0.72rem;
}

.fieldset--compact {
  padding: 0.55rem 0.65rem 0.65rem;
  margin-bottom: 0.65rem;
}

.sliders--compact {
  gap: 0.45rem;
}

.slider-row--compact {
  grid-template-columns: 2rem 1fr 1.75rem;
  gap: 0.35rem;
  font-size: 0.78rem;
}

.input--compact,
.textarea--compact {
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
}

.textarea--compact {
  min-height: 3.25rem;
}

.meta-grid--compact {
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.taste-bars--compact {
  margin-top: 0.5rem;
  gap: 0.35rem;
}

.taste-bars--compact .tbar-wrap {
  font-size: 0.72rem;
}

.actions--compact {
  margin: 0.35rem 0 0;
  gap: 0.45rem;
}

.btn--small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn--block {
  width: 100%;
  margin-top: 0.5rem;
}

.wine-parse-hint {
  margin: 0.25rem 0 0.5rem;
  font-size: 10px;
  color: rgba(255, 160, 200, 0.5);
  line-height: 1.35;
  min-height: 2.2em;
}

.card--viz-fingerprint .vibe-fingerprint-wrap {
  width: 100%;
  max-width: none;
  border-radius: 12px;
}

.card--viz-fingerprint .vibe-fingerprint {
  width: 100%;
  min-height: clamp(7.5rem, 22vw, 11rem);
  border-radius: inherit;
}

.card--viz-fingerprint .vibe-caption {
  margin: 0.45rem 0 0;
  padding: 0 0.05rem;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-align: left;
  line-height: 1.45;
  max-width: none;
}

.chart-host--tall {
  min-height: 220px;
}

.stat-row--compact {
  margin-bottom: 0.65rem;
  gap: 0.45rem;
}

.stat-row--compact .stat {
  padding: 0.45rem 0.5rem;
}

.stat-row--compact .stat-v {
  font-size: 1rem;
}

.hint--compact {
  margin-bottom: 0.5rem;
  font-size: 0.72rem;
}

.bubble-cloud-host {
  position: relative;
  width: 100%;
  margin: 0 0 0.85rem;
}

.topic-bubble-cloud {
  position: relative;
  width: 100%;
  min-height: 260px;
  border-radius: 12px;
  background: #141414;
  border: 1px solid var(--border);
  overflow: hidden;
}

.topic-bubble-svg {
  width: 100%;
  display: block;
  vertical-align: top;
}

.topic-bubble-tip {
  position: absolute;
  z-index: 6;
  left: 0;
  top: 0;
  max-width: 17rem;
  padding: 0.38rem 0.6rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text);
  background: rgba(28, 28, 28, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
}

.topic-parent-blob {
  pointer-events: none;
  shape-rendering: geometricPrecision;
}

.topic-kw-text {
  shape-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

.topic-kw-layer {
  pointer-events: none;
}

.topic-kw-node {
  pointer-events: auto;
}

.topic-kw-node:hover circle {
  stroke-width: 1.1px;
}

.legend--compact {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  gap: 0.85rem;
}

.card--bottom {
  padding: 1rem 1.15rem 1.25rem;
}

.subsection-title {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
}

.card--bottom .subsection-title {
  color: var(--viz-heading-pink);
}

.subsection-title--spaced {
  margin-top: 1.15rem;
}

.bottom-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .bottom-grid {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .bottom-col {
    flex: 1;
    min-width: 0;
  }

  .bottom-col--records {
    flex: 0 0 30%;
    max-width: 280px;
  }

  .bottom-col--social {
    flex: 1;
    max-width: none;
    min-width: 0;
  }
}

.friend-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.field--inline .field-label {
  flex-shrink: 0;
  margin: 0;
}

.field--inline .input {
  flex: 1;
}

.friend-taste-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem 0.5rem;
}

.mini-slider {
  display: grid;
  grid-template-columns: 1.25rem 1fr 1.25rem;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.mini-slider input[type="range"] {
  height: 4px;
}

.friend-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.friend-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  font-size: 0.78rem;
  padding: 0.35rem 0.45rem;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.friend-row__name {
  font-weight: 600;
  color: var(--text);
}

.friend-row__meta {
  color: var(--muted);
  flex: 1;
}

.friend-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin: 0.35rem 0 0.15rem;
  font-size: 0.8rem;
}

.friend-check {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  color: var(--text-dim);
}

.group-suggestion-out,
.mixer-suggestion-out {
  margin-top: 0.65rem;
  min-height: 0;
}

.suggestion-card {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(74, 154, 232, 0.45);
  background: linear-gradient(165deg, rgba(74, 154, 232, 0.12), var(--surface-2));
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text);
}

.suggestion-card p {
  margin: 0 0 0.5rem;
}

.suggestion-card p:last-child {
  margin-bottom: 0;
}

.suggestion-card--warn {
  border-color: rgba(232, 90, 90, 0.5);
  background: rgba(232, 90, 90, 0.08);
}

.suggestion-card--muted {
  border-color: var(--border);
  background: var(--surface-2);
}

.mixer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.mixer-row .input {
  flex: 1;
  min-width: 140px;
}

.hero:not(.hero--dash) h1 {
  margin: 0 0 0.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1.75rem;
}

.lede {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
  font-weight: 500;
  max-width: 52ch;
}

@media (max-width: 640px) {
  .lede {
    max-width: none;
    font-size: 0.9rem;
    line-height: 1.55;
  }
}

.grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: #3a3a3a;
}

.card-wide {
  max-width: 100%;
}

.card-full {
  width: 100%;
}

.card-title {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.card-title .sub {
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 0.35rem;
}

#vibe-title.card-title,
#bubble-title.card-title {
  color: var(--viz-heading-pink);
}

#vibe-title.card-title .sub,
#bubble-title.card-title .sub {
  color: rgba(255, 160, 200, 0.92);
  font-weight: 500;
}

.sliders {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.slider-row {
  display: grid;
  grid-template-columns: 2rem 1fr 2rem;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.dim-label {
  color: var(--text-dim);
}

.val {
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--track);
  border-radius: 999px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--thumb);
  border: 2px solid var(--surface-2);
  cursor: pointer;
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.08);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--thumb);
  border: 2px solid var(--surface-2);
  cursor: pointer;
}

.vibe-lede {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 58ch;
}

.vibe-fingerprint-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.vibe-fingerprint {
  position: relative;
  isolation: isolate;
  min-height: 152px;
  width: 100%;
  border-radius: 16px;
  filter: contrast(120%) brightness(110%);
  background-size: 120% 120%;
  transition: background 0.28s ease;
}

.vibe-radar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  opacity: 0.92;
}

.vibe-blobs {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.organic-blob {
  position: absolute;
  width: min(42%, 180px);
  height: min(38%, 160px);
  transform: translate(-50%, -50%) rotate(var(--rot, 12deg));
  background: var(--blob, #888);
  opacity: 0.62;
  filter: blur(14px) saturate(118%);
  border-radius: var(--brx, 55%) var(--bry, 45%) 52% 48% / 48% 52% 46% 54%;
  mix-blend-mode: screen;
}

.organic-blob--topic {
  opacity: 0.5;
  mix-blend-mode: lighten;
}

.vibe-fingerprint::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

.vibe-caption {
  margin: 0;
}

.field-hint-tight {
  margin-top: 0;
  margin-bottom: 0.65rem;
}

.th-gradient {
  width: 3.25rem;
}

.td-gradient {
  width: 3.25rem;
  vertical-align: middle;
}

.record-gradient-thumb {
  width: 40px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.taste-bars {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tbar-wrap {
  display: grid;
  grid-template-columns: 1.5rem 1fr 1.75rem;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.tbar-label {
  color: var(--text-dim);
}

.tbar-track {
  height: 10px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}

.tbar {
  height: 100%;
  border-radius: 999px;
  width: 50%;
  transition: width 0.2s ease;
}

.fill-acidity {
  background: linear-gradient(90deg, #fff7fb 0%, #ffe0f0 100%);
}
.fill-sweetness {
  background: linear-gradient(90deg, #ffeef6 0%, #ffc8e2 100%);
}
.fill-botanical {
  background: linear-gradient(90deg, #ffc4df 0%, #e870a5 100%);
}
.fill-proof {
  background: linear-gradient(90deg, #dc6090 0%, #a83862 100%);
}
.fill-aroma {
  background: linear-gradient(90deg, #7a3552 0%, #3d1a2c 100%);
}

.tbar-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.hint {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 70ch;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .stat-row {
    grid-template-columns: repeat(6, 1fr);
  }
}

.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-secondary {
  opacity: 0.92;
}

.stat-k {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-note {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.65rem;
}

.stat-v {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-v-sm {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
}

.chart-host {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #161616;
}

.plot-svg {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.lg {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.blue {
  background: var(--chart-point);
}

.line.red {
  width: 22px;
  height: 0;
  border-top: 2px dashed var(--chart-line);
  display: inline-block;
}

.dot.teal {
  background: #5ed4a8;
}

.analysis-source {
  margin: 0 0 0.75rem;
  font-size: 10px;
  color: rgba(255, 160, 200, 0.5);
  line-height: 1.45;
}

.fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem 1rem;
  margin: 0 0 1rem;
}

.fieldset-tight {
  margin-top: 0.25rem;
}

.fieldset-legend {
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.inline-legend {
  margin: 0 0 0.75rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.meta-grid {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .meta-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-block {
  margin-bottom: 1rem;
}

.field-label {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.field-hint {
  margin: 0.65rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

.input,
.textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.65rem;
  outline: none;
  transition: border-color 0.15s ease;
}

#input-wine-name,
#input-bar-name,
#input-date,
#textarea-diy-notes,
#topic-input,
#input-new-bottle {
  font-size: 10px;
}

.input:focus,
.textarea:focus {
  border-color: #4a6a8a;
}

.textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.5rem 0 1.25rem;
}

.btn {
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease,
    filter 0.1s ease,
    box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
  filter: brightness(0.94);
}

.btn-primary:active {
  filter: brightness(0.9);
}

.btn--ack {
  animation: btn-ack-flash 0.45s ease;
}

@keyframes btn-ack-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(94, 212, 168, 0.65);
    filter: brightness(1.15);
  }
  40% {
    box-shadow: 0 0 0 10px rgba(94, 212, 168, 0);
    filter: brightness(1.08);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
    filter: brightness(1);
  }
}

.btn-primary {
  background: var(--accent);
  color: #0f1419;
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

#btn-group-analyze.btn-primary,
#btn-add-record.btn-primary {
  background: rgba(255, 160, 200, 1);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}

.btn-ghost:hover {
  border-color: #4a4a4a;
  color: var(--text);
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.15s ease, opacity 0.1s ease, transform 0.1s ease;
}

.btn-link:active {
  opacity: 0.82;
  transform: scale(0.98);
}

.btn-ghost:active {
  transform: scale(0.97);
  filter: brightness(0.95);
}

.records-wrap {
  margin-top: 0.25rem;
}

.records-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
}

.records-deck-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #141414;
  max-height: 14rem;
  overflow: hidden;
}

.records-deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.4rem;
  padding: 0.4rem;
  max-height: 14rem;
  overflow-y: auto;
  font-size: 0.65rem;
}

.record-day-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
  list-style: none;
}

.record-day-card__toggle {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.22rem;
  width: 100%;
  margin: 0;
  padding: 0.38rem 0.4rem;
  border: none;
  background: rgba(10, 10, 12, 0.78);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease;
  backdrop-filter: blur(8px);
}

.record-day-card__toggle:hover,
.record-day-card__toggle:focus-visible {
  background: rgba(10, 10, 12, 0.88);
  outline: none;
}

.record-day-card--open .record-day-card__toggle {
  background: rgba(12, 18, 28, 0.88);
}

.record-day-card__date {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 0.08rem;
}

.record-day-card__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.35rem;
  font-size: 0.58rem;
  line-height: 1.35;
}

.record-day-card__row--kw .record-day-card__v {
  color: var(--text-dim);
}

.record-day-card__k {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--muted);
  min-width: 3.2rem;
}

.record-day-card__v {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  word-break: break-word;
}

.record-day-card__detail {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.35rem 0.4rem 0.42rem;
  background: rgba(0, 0, 0, 0.55);
  max-height: 10rem;
  overflow-y: auto;
  backdrop-filter: blur(6px);
}

.record-day-card__detail[hidden] {
  display: none !important;
}

.record-day-entry {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.3rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 0.6rem;
}

.record-day-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.record-day-entry__body {
  flex: 1;
  min-width: 0;
}

.record-day-entry__line {
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

.record-day-entry__del {
  font-size: 0.58rem !important;
  padding: 0 !important;
  flex-shrink: 0;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.records-table th,
.records-table td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.records-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.records-table tr:last-child td {
  border-bottom: none;
}

.td-notes {
  max-width: 14rem;
  color: var(--text-dim);
  word-break: break-word;
}

.records-empty {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.records-empty[hidden] {
  display: none;
}

/* recordDrink · userSelect · topic · combo portrait */
.user-select-root {
  min-height: 2.5rem;
}

.user-select__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.5rem;
  align-items: flex-start;
}

.user-select__person {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  max-width: 4.75rem;
}

.user-select__name {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-select__name--spacer {
  display: block;
  min-height: 1.15em;
  visibility: hidden;
  pointer-events: none;
}

.user-select__avatar {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 42% 58% 48% 52% / 52% 48% 55% 45%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: radial-gradient(
    120% 100% at 30% 25%,
    color-mix(in srgb, var(--avatar) 88%, white),
    var(--avatar)
  );
  color: #0f1419;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.user-select__avatar:hover {
  transform: scale(1.06);
}

.user-select__avatar.is-selected {
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(74, 154, 232, 0.45), 0 4px 14px rgba(0, 0, 0, 0.4);
}

.user-select__avatar--add {
  background: var(--surface-2);
  border-style: dashed;
  border-color: var(--border);
  color: var(--text-dim);
}

.user-select__plus {
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 300;
}

.user-select__hint {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.quick-friend-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.55rem;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  border: 1px dashed rgba(74, 154, 232, 0.35);
  background: rgba(74, 154, 232, 0.06);
}

.quick-friend-inline[hidden] {
  display: none !important;
}

.field--inline-tight .field-label {
  min-width: 3rem;
}

.textarea--topic {
  min-height: 7.5rem;
  line-height: 1.55;
}

.topic-tags {
  display: none;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0;
  min-height: 0;
}

.topic-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--chip, #888) 28%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--chip, #888) 55%, transparent);
  color: var(--text);
}

.topic-chip--inline {
  margin-right: 0.25rem;
}

.chart-mode-panel--combo {
  margin-top: 0.25rem;
}

.fieldset--flush {
  margin-bottom: 0.5rem;
}

.combo-portrait-out {
  margin-top: 0.65rem;
}

.combo-portrait-card {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(94, 212, 168, 0.35);
  background: linear-gradient(
    145deg,
    rgba(94, 212, 168, 0.1),
    rgba(155, 126, 217, 0.08),
    var(--surface-2)
  );
  font-size: 0.85rem;
  line-height: 1.55;
}

.combo-portrait-card p {
  margin: 0 0 0.5rem;
}

.combo-portrait-card p:last-child {
  margin-bottom: 0;
}

.combo-portrait-card--warn {
  border-color: rgba(232, 90, 90, 0.45);
  background: rgba(232, 90, 90, 0.07);
}

.combo-portrait-card--muted {
  border-color: var(--border);
  background: var(--surface-2);
}

.combo-portrait-card--muted p {
  font-size: 11px;
}

.combo-kw-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-dim);
}

.combo-kw {
  color: var(--text);
}

.combo-kw-n {
  margin-left: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.field-hint--tight {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
}

.taste-merged {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.taste-merged .tbar-merged-row:nth-child(6) {
  margin-top: max(0px, calc(16px - 0.55rem));
}

.tbar-merged-row {
  display: grid;
  grid-template-columns: 2rem 1fr 2rem;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.tbar-merged-label {
  color: var(--text-dim);
  text-align: right;
}

.taste-merged .tbar-merged-row:nth-child(1) .tbar-merged-label,
.taste-merged .tbar-merged-row:nth-child(2) .tbar-merged-label,
.taste-merged .tbar-merged-row:nth-child(3) .tbar-merged-label,
.taste-merged .tbar-merged-row:nth-child(6) .tbar-merged-label {
  font-size: 11px;
}

.taste-merged .tbar-merged-row:nth-child(4) .tbar-merged-label,
.taste-merged .tbar-merged-row:nth-child(5) .tbar-merged-label {
  font-size: 10px;
}

.tbar-merged-track {
  position: relative;
  height: 26px;
  border-radius: 999px;
  background: var(--track);
  overflow: visible;
}

.tbar-merged-fill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 12px;
  width: 50%;
  min-width: 0;
  max-width: 100%;
  border-radius: 999px;
  pointer-events: none;
  z-index: 1;
  transition: width 0.12s ease;
}

.tbar-merged-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.tbar-merged-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  box-shadow: none;
}

.tbar-merged-range::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
}

.tbar-merged-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
}

.tbar-merged-fill--alcohol {
  background: linear-gradient(90deg, #2d1f4a 0%, #5c3d9e 42%, #9b7ad4 72%, #d4c4f5 100%);
}

.user-select__emoji {
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.friend-list.friend-list--pref-deck {
  display: grid;
  flex-direction: unset;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
  align-items: stretch;
}

@media (max-width: 1280px) {
  .friend-list.friend-list--pref-deck {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .friend-list.friend-list--pref-deck {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .friend-list.friend-list--pref-deck {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .friend-list.friend-list--pref-deck {
    grid-template-columns: 1fr;
  }
}

.friend-pref-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  padding: 0.42rem 0.38rem 0.48rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.65rem;
  min-width: 0;
}

.friend-pref-card__head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2rem;
  padding: 0 2.35rem 0 0;
  min-width: 0;
}

.friend-pref-card__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  max-width: 100%;
  min-width: 0;
}

.friend-pref-card .friend-row__avatar--emoji {
  width: 1.85rem;
  height: 1.85rem;
  font-size: 1rem;
  flex-shrink: 0;
}

.friend-pref-card__name {
  font-weight: 700;
  font-size: 0.68rem;
  text-align: left;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-pref-card__del {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.62rem !important;
  padding: 0 !important;
  line-height: 1.2;
  opacity: 0.88;
}

.friend-pref-card__kw-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.2rem 0.28rem;
  width: 100%;
  align-items: start;
}

.friend-pref-card__block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
}

.friend-pref-card__label {
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 0.08rem;
}

.friend-pref-card__kw {
  font-size: 0.56rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.32;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.friend-row__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 45% 55% 50% 50% / 50% 45% 55% 50%;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0f1419;
  background: radial-gradient(
    120% 100% at 30% 22%,
    color-mix(in srgb, var(--avatar) 85%, white),
    var(--avatar)
  );
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.friend-row__avatar--emoji {
  width: 2.1rem;
  height: 2.1rem;
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1;
  border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%;
}

.td-tags,
.td-people {
  max-width: 7rem;
  color: var(--text-dim);
  font-size: 0.76rem;
  word-break: break-word;
}

@media (max-width: 560px) {
  .input--compact,
  .textarea--compact,
  .textarea--topic,
  .input:not(.input--compact) {
    font-size: 16px;
  }
}

/* —— 竖屏手机（含 iPhone 全面屏安全区）—— */
@media (max-width: 520px) {
  .dashboard__top {
    display: flex;
    flex-direction: column;
  }

  .dashboard__inputs {
    order: 2;
    min-width: 0;
  }

  .dashboard__viz {
    order: 1;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-width: 0;
  }

  .dashboard {
    gap: 1rem;
    margin-top: 0.85rem;
  }

  .dashboard__top {
    gap: 0.85rem;
  }

  .card--compact {
    padding: 0.75rem 0.85rem;
  }

  .card--bottom {
    padding: 0.85rem 0.85rem max(1rem, var(--safe-bottom));
  }

  .card--viz {
    padding: 0.85rem 0.85rem 1rem;
  }

  .card-title {
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .meta-grid--compact {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .actions--compact {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    margin-top: 0.5rem;
  }

  .actions--compact .btn {
    width: 100%;
    min-height: var(--touch-min);
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
  }

  .mixer-row {
    flex-direction: column;
    align-items: stretch;
  }

  .mixer-row .input {
    min-width: 0;
    width: 100%;
    min-height: var(--touch-min);
  }

  .mixer-row .btn {
    width: 100%;
    min-height: var(--touch-min);
    justify-content: center;
  }

  .btn--small {
    min-height: var(--touch-min);
    padding: 0.5rem 0.85rem;
    font-size: 0.88rem;
  }

  .btn--block {
    min-height: var(--touch-min);
  }

  .quick-friend-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-friend-inline .field--inline {
    width: 100%;
  }

  .tbar-merged-row {
    grid-template-columns: 2.75rem 1fr 2.25rem;
    gap: 0.35rem 0.45rem;
    font-size: 0.82rem;
  }

  .tbar-merged-track {
    height: 30px;
  }

  .tbar-merged-label {
    line-height: 1.2;
  }

  .taste-merged .tbar-merged-row:nth-child(1) .tbar-merged-label,
  .taste-merged .tbar-merged-row:nth-child(2) .tbar-merged-label,
  .taste-merged .tbar-merged-row:nth-child(3) .tbar-merged-label,
  .taste-merged .tbar-merged-row:nth-child(6) .tbar-merged-label {
    font-size: 11px;
  }

  .taste-merged .tbar-merged-row:nth-child(4) .tbar-merged-label,
  .taste-merged .tbar-merged-row:nth-child(5) .tbar-merged-label {
    font-size: 10px;
  }

  .hero--dash .hero__brand h1 {
    max-width: none;
    font-size: clamp(17px, 4.5vw, 1.22rem);
  }

  .topic-bubble-cloud {
    min-height: min(42dvh, 320px);
    min-height: min(42svh, 320px);
  }

  .card--viz-fingerprint .vibe-fingerprint {
    min-height: clamp(9.5rem, 38svmin, 12.5rem);
  }

  .records-deck-wrap,
  .records-deck {
    max-height: min(42dvh, 18rem);
    max-height: min(42svh, 18rem);
  }

  .record-day-card__toggle {
    min-height: var(--touch-min);
    padding: 0.55rem 0.5rem;
  }

  .record-day-card__row {
    font-size: 0.62rem;
  }

  .user-select__avatar {
    width: 2.75rem;
    height: 2.75rem;
    min-width: var(--touch-min);
    min-height: var(--touch-min);
  }

  .user-select__person {
    max-width: 5.25rem;
  }

  .friend-check {
    min-height: var(--touch-min);
    padding: 0.35rem 0.15rem;
    align-items: center;
  }

  .friend-check input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
  }

  .friend-pref-card__kw-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.4rem;
  }

  .friend-pref-card__kw {
    font-size: 0.58rem;
    -webkit-line-clamp: 4;
  }

  .hint,
  .field-hint,
  .field-hint--tight {
    max-width: none;
  }

  .hint--compact,
  .hint {
    word-break: break-word;
  }

  .topic-bubble-tip {
    max-width: min(17rem, calc(100vw - 1.5rem - var(--safe-left) - var(--safe-right)));
  }

  #input-date {
    min-height: var(--touch-min);
  }
}

@media (max-width: 899px) and (min-width: 521px) {
  .topic-bubble-cloud {
    min-height: 240px;
  }
}
