:root {
  color-scheme: light;
  --bg: #fff1e3;
  --surface: #fffaf5;
  --surface-strong: #ffe2bf;
  --ink: #1f2937;
  --muted: #667085;
  --line: #ffc98f;
  --land: #cfd6d8;
  --land-line: #fff8f1;
  --water: #fff8f0;
  --orange: #ff7900;
  --orange-dark: #b43b00;
  --teal: #087f8c;
  --blue: #3157c8;
  --yellow: #facc15;
  --red: #dc2626;
  --shadow: 0 18px 50px rgba(255, 121, 0, 0.16);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background: linear-gradient(180deg, #fff4e8 0%, #fff0df 100%);
  color: var(--ink);
}

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

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: max(14px, env(safe-area-inset-top)) 16px 92px;
}

.sync-banner {
  max-width: 1048px;
  margin: 0 auto 14px;
  padding: 12px 14px;
  border: 1px solid rgba(180, 59, 0, 0.25);
  border-radius: 8px;
  background: #fff7ed;
  color: var(--orange-dark);
  font-size: 0.95rem;
  font-weight: 700;
}

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid rgba(255, 201, 143, 0.8);
  background: rgba(255, 244, 232, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: var(--orange);
  color: white;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1.05;
}

.brand small {
  overflow: hidden;
  max-width: 52vw;
  color: var(--muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-pill {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.admin-pill.is-admin {
  border-color: rgba(15, 118, 110, 0.28);
  background: #d7fff8;
  color: var(--teal);
}

.screen {
  width: min(1160px, 100%);
  margin: 0 auto;
}

.map-layout,
.browse-layout,
.admin-layout,
.form-layout,
.login-panel {
  display: grid;
  gap: 16px;
}

.map-copy,
.page-heading {
  display: grid;
  gap: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 820px;
  font-size: clamp(2rem, 8vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.page-heading h1 {
  font-size: clamp(2rem, 7vw, 3.5rem);
}

.map-copy p,
.page-heading p,
.detail-body p,
.empty-state p {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.55;
}

.stat-row,
.action-row,
.tag-row,
.map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.stat-row span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 0.86rem;
}

.stat-row strong {
  color: var(--ink);
}

.map-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 36px rgba(255, 121, 0, 0.12);
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 8px;
}

.map-header h1 {
  font-size: 1.05rem;
  line-height: 1.1;
}

.world-map {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1000 / 520;
  background: var(--water);
}

.map-water {
  fill: var(--water);
}

.country-shape {
  cursor: default;
  fill: var(--land);
  stroke: var(--land-line);
  stroke-linejoin: round;
  stroke-width: 1.1;
  transition:
    fill 150ms ease,
    opacity 150ms ease,
    stroke 150ms ease;
  vector-effect: non-scaling-stroke;
}

.country-shape.tried {
  cursor: pointer;
}

.country-shape:hover,
.country-shape:focus-visible {
  stroke: #fff;
  outline: none;
}

.country-shape.tried:hover,
.country-shape.tried:focus-visible {
  fill: var(--blue);
}

.country-shape.tried {
  fill: var(--orange);
  stroke: #fff8ec;
}

.drink-pin {
  cursor: pointer;
}

.pin-halo {
  fill: rgba(31, 41, 55, 0.16);
  stroke: none;
}

.drink-pin circle {
  fill: #1f2937;
  stroke: #fff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.drink-pin:hover circle,
.drink-pin:focus-visible circle {
  fill: var(--blue);
}

.map-legend {
  padding: 0 14px 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.legend-dot,
.pin-sample {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--land);
  vertical-align: -1px;
}

.legend-dot.tried {
  background: var(--orange);
}

.pin-sample {
  background: #1f2937;
}

.recent-strip,
.drink-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.drink-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(130, 78, 26, 0.08);
}

.drink-card a {
  display: grid;
  grid-template-columns: 92px 1fr;
  min-height: 112px;
  color: inherit;
  text-decoration: none;
}

.drink-card img {
  width: 100%;
  height: 100%;
  min-height: 112px;
  object-fit: cover;
}

.drink-card div {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  padding: 14px;
}

.drink-card h2 {
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.drink-card p,
.drink-card span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.86rem;
}

.drink-card.compact a {
  grid-template-columns: 78px 1fr;
  min-height: 96px;
}

.drink-card.compact img {
  min-height: 96px;
}

.filters,
.drink-form,
.login-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.filters label,
.drink-form label,
.login-form label {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.filters .wide,
.drink-form .wide,
.login-form {
  grid-column: 1 / -1;
}

.filter-disclosure {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(255, 201, 143, 0.62);
  padding-top: 2px;
}

.filter-disclosure summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  color: var(--orange-dark);
  font-size: 0.9rem;
  font-weight: 900;
}

.filter-disclosure summary::-webkit-details-marker {
  display: none;
}

.filter-disclosure summary::after {
  content: "+";
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--orange-dark);
  font-size: 1.1rem;
  line-height: 1;
}

.filter-disclosure[open] summary::after {
  content: "-";
}

.filter-disclosure:not([open]) .filter-disclosure-body {
  display: none;
}

.filter-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.filter-disclosure-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 8px;
}

.range-filter {
  display: grid;
  gap: 6px;
  padding: 10px 12px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7ef;
}

.tag-filter {
  display: grid;
  gap: 10px;
}

.tag-filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.tag-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip,
.text-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.tag-chip {
  min-height: 36px;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.86rem;
  font-weight: 800;
}

.tag-chip.is-selected {
  border-color: rgba(255, 138, 0, 0.28);
  background: var(--orange);
  color: white;
}

.tag-chip.is-clear {
  color: var(--muted);
}

.text-button {
  border: 0;
  padding: 0;
  color: var(--orange-dark);
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.range-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 900;
}

.range-slider {
  position: relative;
  height: 48px;
  margin: 0 6px;
}

.range-slider::before {
  position: absolute;
  top: 15px;
  right: 0;
  left: 0;
  height: 4px;
  border-radius: 999px;
  background: #ffc98f;
  content: "";
}

.range-slider input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
  appearance: none;
}

.range-slider input::-webkit-slider-thumb {
  width: 30px;
  height: 30px;
  border: 4px solid #ffad5c;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(31, 41, 55, 0.14);
  pointer-events: auto;
  appearance: none;
}

.range-slider input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 4px solid #ffad5c;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(31, 41, 55, 0.14);
  pointer-events: auto;
}

.range-badge {
  position: absolute;
  top: 31px;
  min-width: 28px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.range-badge-min {
  color: var(--orange-dark);
}

input,
select,
textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 12px;
}

input[type="date"] {
  display: block;
  max-width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

input[type="date"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--orange);
  outline: 3px solid rgba(249, 115, 22, 0.18);
}

.button,
.icon-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.button.primary {
  background: var(--orange);
  color: white;
}

.button.danger {
  border-color: rgba(220, 38, 38, 0.22);
  background: var(--red);
  color: white;
}

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

.button.link-button {
  justify-self: start;
  border-color: rgba(15, 118, 110, 0.2);
  background: #d7fff8;
  color: var(--teal);
}

.icon-button {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.82rem;
}

.icon-button.danger {
  border-color: rgba(220, 38, 38, 0.22);
  color: var(--red);
}

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.results-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.sort-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: end;
  gap: 8px;
  margin-left: auto;
}

.sort-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.sort-controls select {
  width: auto;
  min-height: 34px;
  max-width: 150px;
  border-radius: 999px;
  padding: 7px 28px 7px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.detail {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

.detail-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.detail-body h1 {
  font-size: clamp(2rem, 8vw, 4rem);
}

.detail-kicker {
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tag-row span {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--orange-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.detail-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7ef;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.detail-list dd {
  margin: 3px 0 0;
  font-weight: 800;
}

.login-panel {
  max-width: 620px;
}

.form-message {
  grid-column: 1 / -1;
  min-height: 1.3em;
  margin: 0;
  color: var(--teal);
  font-size: 0.9rem;
  font-weight: 700;
}

.image-input img {
  width: min(260px, 100%);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-strong);
}

.image-input img.is-empty {
  display: none;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-row img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
}

.admin-row div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-row strong,
.admin-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

.empty-state {
  display: grid;
  place-items: start;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.empty-state.inline {
  grid-column: 1 / -1;
}

.empty-state h1,
.empty-state h2 {
  font-size: 1.5rem;
}

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 25;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 16px 28px rgba(194, 65, 12, 0.34);
  color: white;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 201, 143, 0.9);
  background: rgba(255, 250, 245, 0.94);
  backdrop-filter: blur(18px);
}

.bottom-nav.has-admin {
  grid-template-columns: repeat(3, 1fr);
}

.bottom-nav a,
.bottom-nav button {
  display: grid;
  min-height: 44px;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
}

.bottom-nav button {
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}

.bottom-nav a.active {
  background: var(--surface-strong);
  color: var(--orange-dark);
}

@media (min-width: 680px) {
  .app-shell {
    padding: 28px 28px 112px;
  }

  .recent-strip,
  .drink-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters,
  .drink-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (min-width: 980px) {
  .app-shell {
    padding-bottom: 36px;
  }

  .drink-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .drink-card a {
    grid-template-columns: 1fr;
  }

  .drink-card img {
    height: 190px;
  }

  .detail {
    grid-template-columns: minmax(320px, 0.82fr) 1fr;
  }

  .detail-image {
    height: 100%;
    max-height: none;
  }

  .bottom-nav {
    top: 16px;
    right: 50%;
    bottom: auto;
    left: auto;
    width: 260px;
    transform: translateX(50%);
    border: 1px solid rgba(255, 201, 143, 0.9);
    border-radius: 999px;
    padding: 6px;
  }

  .bottom-nav a,
  .bottom-nav button {
    border-radius: 999px;
  }

  .fab {
    bottom: 28px;
  }
}

@media (max-width: 440px) {
  .sort-controls {
    width: 100%;
    margin-left: 0;
  }

  .sort-controls label {
    flex: 1 1 0;
  }

  .sort-controls select {
    width: 100%;
    max-width: none;
  }

  .filters,
  .filter-disclosure-body,
  .drink-form {
    grid-template-columns: 1fr;
  }

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

  .admin-row .icon-button {
    grid-column: span 1;
  }
}
