:root {
  --bpb-bg: #efe8d7;
  --bpb-bg-2: #f8f5ea;
  --bpb-panel: rgba(255, 253, 247, 0.92);
  --bpb-panel-strong: #fffdf7;
  --bpb-border: #e4dbc1;
  --bpb-border-strong: #d7cbab;
  --bpb-text: #183348;
  --bpb-muted: #5f6f78;
  --bpb-accent: #0ea7a0;
  --bpb-accent-strong: #0a7f7b;
  --bpb-shadow: 0 12px 28px rgba(28, 40, 64, 0.1);
  --bpb-shadow-strong: 0 18px 38px rgba(28, 40, 64, 0.16);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --compare-bg: #e2e5e8;
  --compare-bg-2: #d8dde2;
  --compare-border: #bfc7cf;

  --swatch-w: 108px;
  --swatch-h: 148px;
  --palette-swatch-w: 90px;
  --palette-swatch-h: 124px;
  --string-top: 88px;
  --palette-string-top: 72px;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Autour One", serif;
  color: var(--bpb-text);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 248, 221, 0.95), rgba(255, 248, 221, 0) 42%),
    radial-gradient(circle at 88% 2%, rgba(14, 167, 160, 0.12), rgba(14, 167, 160, 0) 28%),
    linear-gradient(180deg, #f4efdf 0%, var(--bpb-bg) 36%, #ebe3cf 100%);
}

body.modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.modal-open > *:not(.palette-modal-backdrop):not(.preset-modal-backdrop):not(#zoom-overlay):not(script) {
  pointer-events: none;
}

.navbar {
  background: rgba(14, 167, 160, 0.94) !important;
  backdrop-filter: blur(6px);
}

.navbar .navbar-item,
.navbar .navbar-link {
  color: #08383b;
  font-weight: 700;
}

.navbar .navbar-item.is-active,
.navbar .navbar-item:hover {
  background: rgba(255, 255, 255, 0.28) !important;
  color: #072d2f !important;
}

.navbar-brand .navbar-item img {
  max-height: 2.5rem;
  border-radius: 8px;
  padding: 4px;
}

.color-picker-app {
  width: min(1240px, calc(100% - 20px));
  margin: 14px auto 24px;
  display: grid;
  gap: 16px;
}

.page-hero {
  position: relative;
  overflow: clip;
  display: grid;
  grid-template-columns: 1.2fr minmax(140px, 220px);
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(255, 251, 240, 0.92)),
    url('assets/pictures/asfalt-light.png');
  border: 1px solid var(--bpb-border);
  border-radius: 20px;
  box-shadow: var(--bpb-shadow);
}

.page-hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 167, 160, 0.18), rgba(14, 167, 160, 0));
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--bpb-accent-strong);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.page-hero h1 {
  margin: 0;
  font-size: clamp(1.1rem, 2.8vw, 1.8rem);
  line-height: 1.15;
  color: #14354a;
}

.page-hero-text {
  margin: 8px 0 0;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--bpb-muted);
}

.hero-balloons {
  position: relative;
  min-height: 124px;
  display: flex;
  align-items: end;
  justify-content: center;
}

.hero-balloon {
  position: absolute;
  width: 52px;
  height: 74px;
  border-radius: 50% 50% 48% 48% / 44% 44% 56% 56%;
  box-shadow: 0 10px 18px rgba(25, 39, 60, 0.16);
  animation: heroFloat 5.2s ease-in-out infinite;
}

.hero-balloon::before {
  content: "";
  position: absolute;
  inset: 10px auto auto 10px;
  width: 16px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transform: rotate(-22deg);
}

.hero-balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% - 2px);
  width: 1.5px;
  height: 38px;
  background: linear-gradient(180deg, rgba(78, 78, 78, 0.9), rgba(78, 78, 78, 0.1));
  transform: translateX(-50%);
}

.hero-balloon-a {
  background: linear-gradient(160deg, #fff4a5, #ffd25f 52%, #cf9d27);
  transform: translate(-34px, 10px) rotate(-4deg);
  animation-delay: -0.6s;
}

.hero-balloon-b {
  background: linear-gradient(160deg, #d8f9ff, #6fd7eb 52%, #2694b6);
  transform: translate(2px, -6px) rotate(5deg);
  width: 58px;
  height: 82px;
  animation-duration: 4.8s;
}

.hero-balloon-c {
  background: linear-gradient(160deg, #ffe4ee, #ff9dc1 54%, #cc5d86);
  transform: translate(42px, 6px) rotate(7deg);
  animation-delay: -1.4s;
  animation-duration: 5.6s;
}

@keyframes heroFloat {
  0%, 100% { transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg)); }
  50% { transform: translate(var(--x, 0), calc(var(--y, 0) - 8px)) rotate(calc(var(--r, 0deg) * -1)); }
}

.hero-balloon-a { --x: -34px; --y: 10px; --r: -4deg; }
.hero-balloon-b { --x: 2px; --y: -6px; --r: 5deg; }
.hero-balloon-c { --x: 42px; --y: 6px; --r: 7deg; }

.picker-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

#selected-palette {
  position: sticky;
  top: 10px;
  z-index: 5;
  display: grid;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,252,244,0.92));
  border: 1px solid var(--bpb-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--bpb-shadow);
  backdrop-filter: blur(4px);
  max-height: calc(100vh - 28px);
}

#selected-palette.stuck {
  box-shadow: var(--bpb-shadow-strong);
}

.palette-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.palette-title-group h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #15384c;
}

.palette-subtitle {
  margin: 4px 0 0;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--bpb-muted);
}

#palette-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.palette-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.palette-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(14, 167, 160, 0.1);
  border: 1px solid rgba(14, 167, 160, 0.25);
  color: #0b6561;
  font-size: 0.76rem;
}

.palette-hint {
  font-size: 0.72rem;
  color: var(--bpb-muted);
}

#palette-colors {
  position: relative;
  min-height: 190px;
  max-height: min(52vh, 420px);
  padding: 10px 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--compare-border);
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, #e1e6ea 0%, #e1e6ea 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 8px 10px;
  overflow: auto;
}

#palette-colors.is-empty {
  display: grid;
  place-items: center;
}

.palette-empty-state {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  color: var(--bpb-muted);
  padding: 18px 8px;
}

.palette-empty-state i {
  font-size: 1.3rem;
  color: rgba(21, 56, 76, 0.45);
}

.palette-empty-state strong {
  color: #17384c;
  font-size: 0.9rem;
}

.palette-empty-state span {
  font-size: 0.74rem;
  line-height: 1.35;
}

.palette-footer-row {
  display: flex;
  justify-content: flex-end;
}

#clear-palette {
  border: 1px solid rgba(21, 56, 76, 0.18);
  background: #ffffff;
  color: #15384c;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  box-shadow: 0 6px 12px rgba(24, 40, 72, 0.06);
}

#clear-palette:hover {
  background: #f8f3e6;
}

#clear-palette:disabled,
.palette-control-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.library-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.library-inline-title {
  margin: 0;
  padding: 2px 4px 0;
  font-size: 0.95rem;
  color: #15384c;
}

.library-header {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--bpb-border);
  background: rgba(255, 253, 246, 0.86);
  box-shadow: var(--bpb-shadow);
}

.library-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #15384c;
}

.library-header p {
  margin: 5px 0 0;
  color: var(--bpb-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.library-controls {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.library-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(21, 56, 76, 0.14);
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  padding: 6px 10px;
}

.library-search i {
  color: #6a7880;
  font-size: 0.8rem;
}

.library-search input {
  border: 0;
  outline: 0;
  background: transparent;
  color: #17384c;
  font-family: inherit;
  font-size: 0.78rem;
  min-width: 0;
}

.library-search input::placeholder {
  color: #7c8a92;
}

.library-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--bpb-muted);
  font-size: 0.72rem;
}

.library-sort select {
  border: 1px solid rgba(21, 56, 76, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #17384c;
  font-family: inherit;
  font-size: 0.72rem;
  padding: 6px 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#color-families {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.color-family {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px 12px 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,251,240,0.92));
  border: 1px solid var(--bpb-border);
  border-radius: var(--radius-md);
  box-shadow: var(--bpb-shadow);
  animation: fadeInUp 0.45s ease;
}

.color-family h3 {
  text-align: left;
  margin: 0;
  padding-inline: 4px;
  font-size: 0.95rem;
  color: #15384c;
}

.color-family.is-hidden {
  display: none;
}

.family-empty-note {
  display: none;
}

#color-families.has-filtered-results-none::before {
  content: "No colors match that search.";
  display: block;
  grid-column: 1 / -1;
  padding: 16px;
  text-align: center;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(21, 56, 76, 0.2);
  background: rgba(255, 255, 255, 0.82);
  color: var(--bpb-muted);
  box-shadow: var(--bpb-shadow);
}

.swatch-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px 8px;
  align-items: start;
}

.swatch-wrapper {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  min-width: 0;
  transition: filter 0.2s ease;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.18));
}

.swatch-wrapper:hover {
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.2));
}

.color-swatch {
  width: var(--swatch-w);
  height: var(--swatch-h);
  position: relative;
  z-index: 1;
  background: radial-gradient(circle at 30% 30%, #fff5, transparent 60%), #ddd;
  transition: transform 0.2s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;

  -webkit-mask-image: url('images/balloon-mask.svg');
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;

  mask-image: url('images/balloon-mask.svg');
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

.color-swatch:hover,
.color-swatch:active {
  transform: translateY(-2px) scale(1.05);
}

.color-swatch:focus-visible {
  outline: 3px solid rgba(14, 167, 160, 0.45);
  outline-offset: 3px;
  border-radius: 14px;
}

.color-background {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.08);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.color-background.finish-image {
  background-size: 125%;
  background-position: center;
}

.color-background.chosen {
  border-color: rgba(12, 86, 109, 0.55);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.28),
    0 0 0 3px rgba(14, 167, 160, 0.22);
}

.color-shine {
  position: absolute;
  top: 45%;
  left: 45%;
  width: 70px;
  opacity: 0.62;
  z-index: 100;
  pointer-events: none;
  transform: translate(-50%, -50%);
  height: auto;
}

.color-shine.has-halo {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.color-name {
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
  font-size: 0.76rem;
  line-height: 1.15;
  text-align: center;
  color: #334854;
  width: min(100%, 98px);
  min-height: 1.7em;
  white-space: normal;
  word-break: break-word;
}

.color-name.highlighted-name {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  font-weight: 700;
  color: #132f42;
}

#selected-palette .swatch-wrapper {
  gap: 4px;
}

#selected-palette .color-swatch {
  width: var(--palette-swatch-w);
  height: var(--palette-swatch-h);
}

#selected-palette .color-swatch:hover,
#selected-palette .color-swatch:active {
  transform: translateY(-2px) scale(1.03);
}

#selected-palette .color-name {
  width: min(100%, 84px);
  font-size: 0.68rem;
  min-height: 2.2em;
}

.balloon-float-group {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation-name: balloonFloat;
  animation-duration: 4s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  transform-origin: bottom center;
}

@keyframes balloonFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

.balloon-string-svg {
  position: absolute;
  top: var(--string-top);
  left: calc(47% - 3px);
  transform: translateX(-50%);
  width: 18px;
  height: 38px;
  z-index: -1;
  pointer-events: none;
  overflow: visible;
  transform-origin: top center;
}

#selected-palette .balloon-string-svg {
  top: var(--palette-string-top);
  height: 32px;
}

.wiggle-path {
  stroke: #727171;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}

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

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.color-background.pop {
  animation: pop 0.25s ease;
}

.chosen {
  z-index: 4;
}

/* Shared metallic style */
.metallic {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.chrome-gold {
  background: linear-gradient(145deg, #fefcea, #b69978, #a18b67, #806748);
}

.chrome-silver {
  background: linear-gradient(145deg, #e0e0e0, #a9a9a9, #808080, #e0e0e0);
}

.chrome-rosegold {
  background: linear-gradient(145deg, #fbe3dc, #e6b7a9, #d19387, #fbe3dc);
}

.chrome-champagne {
  background: linear-gradient(145deg, #fff2cc, #f2e6b6, #d9c08e, #fff2cc);
}

.chrome-blue {
  background: linear-gradient(145deg, #d0f0ff, #4d7995, #2d576f, #d0f0ff);
}

.chrome-purple {
  background: linear-gradient(145deg, #e0ccff, #b08be1, #915bc4, #e0ccff);
}

.chrome-green {
  background: linear-gradient(145deg, #e2ffe2, #457066, #5c877d, #e2ffe2);
}

#palette-controls .palette-control-btn {
  font-size: 0.95rem;
  padding: 0;
  border: 1px solid var(--bpb-border);
  background: #fff;
  color: #17384c;
  border-radius: 10px;
  cursor: pointer;
  width: 34px;
  height: 34px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 10px rgba(24, 40, 72, 0.08);
}

#palette-controls .palette-control-btn:hover {
  background: #f7f2e2;
  transform: translateY(-1px);
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #e6dfc8;
  transition: 0.3s;
  border-radius: 20px;
  border: 1px solid rgba(21, 56, 76, 0.12);
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
  background-color: var(--bpb-accent);
}

input:checked + .slider:before {
  transform: translateX(19px);
}

.palette-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 20, 32, 0.55);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 1000;
}

.palette-modal-backdrop .palette-modal {
  background: var(--bpb-panel-strong);
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--bpb-border);
  max-width: 480px;
  width: min(100%, 480px);
  box-shadow: var(--bpb-shadow-strong);
  text-align: center;
  display: block;
}

.palette-modal h3 {
  margin: 0;
  color: #15384c;
}

.preset-modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: rgba(11, 20, 32, 0.42);
  z-index: 1000;
}

.preset-modal {
  width: min(100%, 720px);
  max-height: min(82vh, 760px);
  overflow: auto;
  background: rgba(255, 253, 247, 0.96);
  border: 1px solid var(--bpb-border);
  border-radius: 16px;
  box-shadow: var(--bpb-shadow-strong);
  padding: 14px;
}

.preset-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preset-modal-header h3 {
  margin: 0;
  color: #15384c;
  font-size: 1rem;
}

#close-preset-modal {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(21, 56, 76, 0.14);
  background: #fff;
  color: #15384c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#close-preset-modal:hover {
  background: #f7f2e2;
}

.preset-modal-subtitle {
  margin: 6px 0 10px;
  color: var(--bpb-muted);
  font-size: 0.75rem;
}

#preset-palette-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.preset-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(21, 56, 76, 0.1);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 4px 10px rgba(24, 40, 72, 0.05);
}

.preset-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.preset-card-title {
  margin: 0;
  font-size: 0.82rem;
  color: #15384c;
  line-height: 1.15;
}

.preset-card-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(21, 56, 76, 0.1);
  background: rgba(21, 56, 76, 0.05);
  color: #47616f;
  font-size: 0.6rem;
  white-space: nowrap;
}

.preset-card-desc {
  margin: 0;
  color: #5f6f78;
  font-size: 0.68rem;
  line-height: 1.3;
  min-height: 2.2em;
}

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

.preset-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(21, 56, 76, 0.15);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
  flex: 0 0 auto;
}

.preset-dot.is-image {
  background-size: 220%;
  background-position: center 34%;
  background-repeat: no-repeat;
}

.preset-card button {
  justify-self: start;
  border: 1px solid rgba(21, 56, 76, 0.14);
  background: #fff;
  color: #15384c;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.72rem;
  cursor: pointer;
}

.preset-card button:hover {
  background: #f7f2e2;
}

#share-link-input {
  display: block;
  width: 100%;
  padding: 10px;
  margin: 14px auto 0;
  border: 1px solid #d7d7d7;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: left;
  background: #fff;
}

#copy-link-button,
#close-modal {
  margin-top: 14px;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid rgba(21, 56, 76, 0.15);
  cursor: pointer;
}

#copy-link-button {
  background: var(--bpb-accent);
  color: white;
  border-color: var(--bpb-accent-strong);
}

#copy-link-button:hover {
  background: var(--bpb-accent-strong);
}

#close-modal {
  margin-left: 8px;
  background: #fff;
  color: #15384c;
}

#zoom-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.78);
  z-index: 1001;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  cursor: zoom-out;
  padding: 16px;
}

#zoom-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

#zoom-modal-shell {
  position: relative;
  width: min(94vw, 1120px);
}

#zoomed-palette-content {
  width: 100%;
  max-height: 82vh;
  padding: 16px;
  background:
    linear-gradient(180deg, #eef0f3 0%, #dfe4e9 100%);
  border-radius: 16px;
  border: 1px solid var(--bpb-border);
  box-shadow: var(--bpb-shadow-strong);
  overflow: auto;
  display: block;
  cursor: default;
}

.zoom-palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  align-items: start;
}

.zoom-color-card {
  display: grid;
  gap: 4px;
  justify-items: center;
  align-content: start;
  padding: 10px 10px 8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.zoom-balloon-wrap {
  height: 138px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
}

.zoom-color-balloon {
  width: 120px;
  height: 164px;
  cursor: default;
  filter: drop-shadow(0 10px 14px rgba(24, 40, 72, 0.2));
}

#zoomed-palette-content .zoom-color-balloon .color-background {
  border: 2px solid rgba(21, 56, 76, 0.2);
}

#zoomed-palette-content .zoom-color-balloon .color-background.chosen {
  border-color: rgba(21, 56, 76, 0.34);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.45),
    0 0 0 3px rgba(21, 56, 76, 0.12);
}

.zoom-color-balloon:hover,
.zoom-color-balloon:active {
  transform: none;
}

.zoom-color-balloon .color-shine {
  width: 84px;
}

.zoom-color-name {
  text-align: center;
  color: #15384c;
  font-size: 0.8rem;
  line-height: 1.05;
  margin-top: -18px;
}

#zoom-close {
  position: absolute;
  top: -10px;
  right: -10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bpb-panel-strong);
  border: 1px solid var(--bpb-border);
  color: #15384c;
  text-decoration: none;
  font-size: 20px;
  line-height: 1;
  z-index: 1002;
}

#zoom-close:hover {
  background: #f7f2e2;
}

footer {
  text-align: center;
  font-size: 0.8rem;
  color: #5f6f78;
  padding: 10px 16px 22px;
}

@media (max-width: 1100px) {
  .picker-layout {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  }

  #color-families {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .swatch-container {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  }

  :root {
    --swatch-w: 96px;
    --swatch-h: 132px;
    --palette-swatch-w: 80px;
    --palette-swatch-h: 110px;
    --string-top: 78px;
    --palette-string-top: 64px;
  }

  .color-shine {
    width: 62px;
  }
}

@media (min-width: 1101px) {
  .picker-layout {
    grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
    gap: 18px;
  }

  #color-families {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .color-family {
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 12px 14px;
  }

  .color-family h3 {
    margin: 0;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(21, 56, 76, 0.05);
    border: 1px solid rgba(21, 56, 76, 0.08);
    line-height: 1.15;
    position: sticky;
    top: 0;
  }

  .swatch-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 10px 8px;
  }

  .swatch-container .swatch-wrapper {
    width: 106px;
  }

  .swatch-container .color-name {
    width: 100%;
    min-height: 1.9em;
  }
}

@media (max-width: 900px) {
  .picker-layout {
    grid-template-columns: 1fr;
  }

  #selected-palette {
    position: sticky;
    top: 6px;
    max-height: none;
  }

  #palette-colors {
    min-height: 112px;
    max-height: none;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: flex-start;
    align-content: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 10px 10px;
    gap: 6px;
    scroll-snap-type: x proximity;
  }

  #selected-palette .swatch-wrapper {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  #selected-palette .color-name {
    display: none;
  }

  #selected-palette .balloon-float-group {
    margin-bottom: 2px;
  }

  .page-hero {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-right: 14px;
  }

  .hero-balloons {
    min-height: 96px;
    justify-content: flex-end;
    margin-right: 8px;
  }

  .library-header {
    position: sticky;
    top: 6px;
    z-index: 4;
    backdrop-filter: blur(5px);
  }

  .library-controls {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .library-sort {
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .color-picker-app {
    width: calc(100% - 10px);
    margin-top: 8px;
    gap: 10px;
  }

  .page-hero {
    padding: 12px;
    border-radius: 16px;
  }

  .page-hero h1 {
    font-size: 1.02rem;
  }

  .page-hero-text {
    font-size: 0.76rem;
  }

  #selected-palette {
    padding: 10px;
    gap: 10px;
    border-radius: 16px;
  }

  .palette-header-row {
    grid-template-columns: 1fr;
  }

  #palette-controls {
    justify-content: space-between;
    width: 100%;
  }

  .palette-meta-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .library-search {
    padding: 5px 9px;
  }

  .library-search input,
  .library-sort,
  .library-sort select {
    font-size: 0.68rem;
  }

  #palette-colors {
    min-height: 86px;
    gap: 4px;
    padding: 6px 8px 8px;
  }

  #color-families {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .color-family {
    padding: 12px 10px 14px;
  }

  .swatch-container {
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 8px 6px;
  }

  :root {
    --swatch-w: 84px;
    --swatch-h: 116px;
    --palette-swatch-w: 62px;
    --palette-swatch-h: 86px;
    --string-top: 68px;
    --palette-string-top: 48px;
  }

  .color-shine {
    width: 54px;
  }

  .color-name {
    font-size: 0.68rem;
    width: min(100%, 82px);
  }

  #selected-palette .color-name {
    display: none;
  }

  #selected-palette .balloon-string-svg {
    height: 24px;
    width: 16px;
  }

  #zoomed-palette-content {
    padding: 14px;
    border-radius: 14px;
  }

  .zoom-palette-grid {
    grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
    gap: 10px;
  }

  .zoom-color-card {
    padding: 9px 8px 7px;
    gap: 3px;
  }

  .zoom-balloon-wrap {
    height: 112px;
  }

  .zoom-color-balloon {
    width: 100px;
    height: 136px;
    filter: drop-shadow(0 8px 12px rgba(24, 40, 72, 0.18));
  }

  .zoom-color-balloon .color-shine {
    width: 70px;
  }

  .zoom-color-name {
    font-size: 0.68rem;
    margin-top: -14px;
  }

  #zoom-close {
    top: -8px;
    right: -8px;
  }

  .navbar-brand .navbar-item img {
    max-height: 2rem;
  }

  #preset-palette-list {
    grid-template-columns: 1fr;
  }
}

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