:root {
  color-scheme: light;
  --ink: #17323a;
  --muted: #5d6d72;
  --line: #cddfe2;
  --soft: #e8f5f7;
  --paper: #fbf7ef;
  --panel: #ffffff;
  --surface: #dff4f7;
  --surface-subtle: #f6fbfc;
  --accent: #2f8f9d;
  --accent-dark: #17616d;
  --accent-soft: #dff3f5;
  --success: #4b8b72;
  --warning: #b8772c;
  --page-bg: linear-gradient(180deg, #eef9fb 0%, #f8efe5 64%, #f4eadf 100%);
  --hero-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(226, 247, 250, 0.94) 52%, rgba(255, 244, 228, 0.92));
  --hero-shadow: rgba(47, 143, 157, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  background: var(--page-bg);
  color: var(--ink);
}

.theme-princess {
  --ink: #19324a;
  --muted: #5b6a7a;
  --line: #cbd9e8;
  --soft: #edf6fb;
  --paper: #fbf7ef;
  --surface: #e9f5fb;
  --surface-subtle: #f8fbfe;
  --accent: #3f82b7;
  --accent-dark: #265f8c;
  --accent-soft: #e3f0f8;
  --warning: #b98935;
  --page-bg: linear-gradient(180deg, #eef8fc 0%, #f8f2e8 68%, #f5eadc 100%);
  --hero-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(226, 242, 251, 0.96) 56%, rgba(255, 247, 232, 0.92));
  --hero-shadow: rgba(63, 130, 183, 0.14);
}

.theme-carnival {
  --ink: #26313c;
  --muted: #68717a;
  --line: #d8d6cb;
  --soft: #f7efe5;
  --paper: #fff9f0;
  --surface: #fff2df;
  --surface-subtle: #fffaf4;
  --accent: #d36b3d;
  --accent-dark: #9b4c2f;
  --accent-soft: #fde7d9;
  --warning: #c55e38;
  --page-bg: linear-gradient(180deg, #fef5e8 0%, #eef8fb 58%, #f6eadc 100%);
  --hero-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(255, 239, 219, 0.95) 56%, rgba(226, 246, 250, 0.9));
  --hero-shadow: rgba(211, 107, 61, 0.14);
}

.package-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

.package-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 18px;
  align-items: end;
  overflow: hidden;
  min-height: 150px;
  padding: 24px 28px;
  border-radius: 8px;
  background: var(--hero-bg), var(--surface);
  color: var(--ink);
}

.customer-facing {
  border: 1px solid #b7dbe0;
  box-shadow: 0 8px 22px var(--hero-shadow);
}

.preview-gate-panel {
  margin: 16px 0 0;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--warning) 55%, #ffffff);
  border-radius: 8px;
  background: #fff7ea;
  color: var(--ink);
}

.preview-gate-panel h2 {
  margin: 0 0 8px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}

.preview-gate-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.preview-gate-panel ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.6;
}

.package-hero::after {
  content: "";
  position: absolute;
  right: 26px;
  bottom: 22px;
  width: 230px;
  height: 62px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-top: 0;
  border-left: 0;
  transform: skewX(-18deg);
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 780px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  color: #b8772c;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-meta {
  max-width: 760px;
  margin: 10px 0 0;
  color: #49636b;
  font-size: 14px;
  line-height: 1.45;
}

.hero-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  align-items: end;
  min-width: 180px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 6px 16px var(--hero-shadow);
}

.hero-panel strong {
  font-size: 25px;
  line-height: 1;
}

.hero-panel span {
  color: #557079;
  font-size: 12px;
  font-weight: 700;
}

.notice-band,
.toolbar,
.port-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.notice-band {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 10px 0;
  padding: 10px 14px;
  border-color: #d7bd90;
  color: #78561e;
  background: #f7ecd8;
}

.notice-band[hidden] {
  display: none;
}

.notice-band p {
  margin: 0;
  line-height: 1.35;
  font-size: 13px;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(208px, 1fr));
  gap: 10px 12px;
  align-items: end;
  margin-bottom: 10px;
  padding: 12px 14px;
  background: rgba(247, 241, 234, 0.96);
  backdrop-filter: blur(10px);
}

.control-panel {
  position: static;
}

.toolbar label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.wide-control {
  grid-column: span 2;
}

.range-control-label {
  grid-column: span 2;
}

.toolbar span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

select,
input {
  min-height: 42px;
  border: 1px solid #c7d2df;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

select:focus,
input:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 109, 107, 0.2);
  outline-offset: 2px;
}

.budget-control {
  display: grid;
  grid-template-columns: minmax(128px, 1fr) minmax(54px, auto);
  gap: 7px;
  align-items: center;
}

.budget-control input[type="range"] {
  width: 100%;
  min-height: 42px;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.budget-control strong {
  min-width: 74px;
  color: var(--ink);
  font-size: 13px;
}

.small-button {
  min-width: 58px;
  min-height: 40px;
  border: 1px solid #c7d2df;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.small-button:hover {
  background: #efe4d8;
}

.copy-link-button {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.copy-link-button:hover {
  background: var(--accent-dark);
}

.copy-link-button.secondary {
  background: #fff;
  color: var(--accent);
}

.copy-link-button.secondary:hover {
  background: var(--accent-soft);
}

.copy-link-status {
  min-width: 148px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.section-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.port-entry-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.port-filter-control {
  display: grid;
  gap: 7px;
  max-width: 360px;
  margin: 0 0 14px;
}

.port-filter-control span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.muted-eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
}

.selected-summary {
  margin: 0 0 18px;
  border: 1px solid #cfdcd6;
  border-radius: 8px;
  background: #f8fbf8;
}

.selected-empty,
.selected-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
}

.selected-empty strong,
.selected-header strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 18px;
}

.selected-empty span,
.selected-header span {
  color: var(--muted);
  line-height: 1.45;
}

.selected-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.selected-groups {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.selected-group {
  border: 1px solid #d6e1dc;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.selected-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #e1e8e4;
  background: #fbfdfb;
}

.selected-group-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.selected-group-count {
  flex: 0 0 auto;
  color: var(--success);
  font-size: 12px;
  font-weight: 900;
}

.selected-list {
  display: grid;
  padding: 4px 14px;
}

.selected-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #edf2ee;
}

.selected-item:last-child {
  border-bottom: 0;
}

.selected-item-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.selected-item strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.selected-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.selected-remove-button {
  min-height: 34px;
  color: #52657a;
}

.port-entry-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.port-entry-card {
  display: grid;
  gap: 12px;
  grid-template-rows: 124px auto 1fr;
  min-height: 270px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 0 16px;
  background: var(--paper);
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
}

.port-entry-card:hover,
.port-entry-card.active {
  border-color: var(--accent);
  background: #fff;
}

.port-entry-card h3 {
  margin: 0;
  padding: 0 16px;
  font-size: 19px;
  line-height: 1.25;
}

.port-entry-card p {
  margin: 0;
  padding: 0 16px;
  color: var(--muted);
}

.port-entry-media {
  overflow: hidden;
  height: 124px;
  background: #e9ded4;
}

.port-entry-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.port-entry-media .generated-port-image {
  object-fit: cover;
}

.port-entry-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding: 0 16px;
}

.port-entry-stats span,
.selected-count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.selected-count-pill {
  background: #edf4ee;
  color: #456d4b;
}

.port-list {
  display: grid;
  gap: 18px;
}

.port-card {
  overflow: hidden;
}

.source-status-panel {
  display: grid;
  gap: 4px;
  margin: 16px 16px 0;
  border: 1px solid #d8c5ae;
  border-radius: 8px;
  background: #fff8ed;
  padding: 12px 14px;
  color: #5f4b35;
  font-size: 13px;
  line-height: 1.55;
}

.source-status-panel strong {
  color: var(--ink);
  font-size: 14px;
}

.source-status-summary {
  background: #f4fbfc;
  border-color: #b9dce2;
  color: #244c54;
}

.source-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.source-status-item {
  display: grid;
  gap: 2px;
  border: 1px solid #d8e8eb;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.source-status-item span {
  color: #0f8791;
  font-weight: 800;
  font-size: 12px;
}

.source-status-item b {
  color: var(--ink);
  font-size: 14px;
}

.source-status-item em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
  align-items: stretch;
  padding: 16px;
}

.port-actions {
  display: flex;
  justify-content: center;
  padding: 0 16px 18px;
}

.expand-button {
  min-height: 40px;
  border: 1px solid #bfd1dc;
  border-radius: 6px;
  padding: 0 14px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.expand-button:hover {
  background: var(--accent-soft);
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  height: 100%;
  padding: 16px;
  border: 1px solid #ded2c5;
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.product-card.selected {
  border-color: var(--success);
  box-shadow: 0 0 0 2px rgba(93, 139, 99, 0.12);
}

.product-card.sold-out {
  border-color: #e2b9a2;
  background: #fbf7f3;
  opacity: 0.88;
}

.product-card.no-media {
  padding-top: 18px;
}

.product-media {
  overflow: hidden;
  height: 150px;
  border-radius: 8px;
  background: #e9ded4;
}

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

.image-fallback {
  display: grid;
  place-content: center;
  height: 100%;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(223, 243, 245, 0.95), rgba(255, 241, 219, 0.92)),
    #eaf7f8;
  color: var(--accent-dark);
  text-align: center;
}

.image-fallback span {
  font-size: 12px;
  font-weight: 800;
}

.image-fallback strong {
  display: block;
  margin-top: 6px;
  font-size: 17px;
}

.image-load-failed {
  background: #e9ded4;
}

.image-loading-slow {
  background:
    linear-gradient(110deg, #e9ded4 0%, #f6efe7 42%, #e9ded4 76%);
  background-size: 200% 100%;
}

.product-card:hover {
  border-color: #c6ac8f;
}

.product-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.product-title-original {
  margin-top: -8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.audience-note {
  color: #344054;
  font-weight: 800;
}

.product-detail-button {
  min-height: 40px;
  border: 1px solid #e0d2c2;
  border-radius: 8px;
  background: #fffaf5;
  padding: 10px 12px;
  color: var(--accent);
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.product-detail-button::before {
  content: "▶";
  margin-right: 8px;
}

.product-detail-button:hover {
  background: var(--accent-soft);
}

.product-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.product-source {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.recommendation-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #78561e;
  font-size: 12px;
  font-weight: 800;
}

.product-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.48;
}

.product-description {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.product-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fact {
  padding: 5px 8px;
  border-radius: 6px;
  background: #f3ebe3;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.price-fact {
  background: #eef6fb;
  color: var(--accent-dark);
}

.price-context-fact {
  background: #fff8ed;
  color: #7a4f16;
}

.recommendation-score-fact {
  background: #fff4d8;
  color: #76501c;
}

.guarantee-fact {
  background: #edf4ee;
  color: #456d4b;
}

.availability-fact {
  background: #edf4ee;
  color: #456d4b;
}

.sold-out-fact {
  background: #f7ded4;
  color: #8f2f10;
}

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

.book-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

.book-link:hover {
  background: var(--accent-dark);
}

.copy-product-button {
  min-height: 40px;
  border: 1px solid #d7c7b6;
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.copy-product-button:hover {
  background: var(--accent-soft);
}

.copy-product-button:disabled {
  border-color: #e1d5c9;
  background: #f1ebe4;
  color: #8b7b6d;
  cursor: not-allowed;
}

.copy-product-button:disabled:hover {
  background: #f1ebe4;
}

.select-product-button.selected {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.modal-open {
  overflow: hidden;
}

.product-detail-modal[hidden] {
  display: none;
}

.product-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
}

.product-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 50, 58, 0.38);
}

.product-detail-sheet {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 56px));
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 54px rgba(23, 50, 58, 0.22);
}

.detail-close-button {
  float: right;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.detail-sheet-kicker,
.detail-original-title {
  color: var(--muted);
  font-weight: 800;
}

.product-detail-sheet h2 {
  margin: 16px 0 10px;
  font-size: 26px;
  line-height: 1.2;
}

.detail-media {
  margin: 14px 0 16px;
  overflow: hidden;
  border-radius: 8px;
  background: #eef6f6;
}

.detail-media img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}

.detail-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.detail-audience {
  color: #344054;
  font-weight: 900;
}

.detail-body {
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.detail-body p {
  margin: 0;
}

.detail-note {
  color: #68717a;
  font-size: 13px;
}

.translation-pending-note {
  color: #8a5a12;
  font-weight: 800;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.empty {
  padding: 18px;
  color: var(--muted);
}

.no-results-panel {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 24px;
  background: #fff;
}

.no-results-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
}

.no-results-panel p {
  max-width: 620px;
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .package-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .package-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 24px;
  }

  .package-hero::after {
    right: 18px;
    bottom: 18px;
    width: 180px;
    height: 64px;
  }

  .hero-panel {
    width: 100%;
  }

  .toolbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .wide-control {
    grid-column: auto;
  }

  .range-control-label {
    grid-column: auto;
  }

  .port-filter-control {
    max-width: none;
  }

  .budget-control {
    grid-template-columns: 1fr;
  }

  .selected-empty,
  .selected-header,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .selected-item {
    grid-template-columns: 1fr;
  }

  .copy-link-button {
    width: 100%;
  }

  .product-actions {
    grid-template-columns: 1fr;
  }

}
