/* Penny Game page: preview, configurator, cart drawer, gallery, lightbox, copy. */

/* ---------- Breadcrumb ---------- */

.breadcrumb ol {
  list-style: none; margin: 0; padding: 20px 0 8px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  font-size: .875rem; color: var(--muted);
}
.breadcrumb li { display: inline-flex; align-items: center; gap: 4px; }
.breadcrumb li + li::before { content: "/"; color: var(--border-strong); margin-right: 2px; }
.breadcrumb a { display: inline-flex; align-items: center; min-height: 32px; text-decoration: none; color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb [aria-current] { color: var(--ink); font-weight: 500; }

/* ---------- Layout ---------- */

.pg {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: clamp(28px, 4.5vw, 64px);
  padding-bottom: clamp(48px, 7vw, 96px);
  padding-top: 12px;
}
.pg__media { display: flex; flex-direction: column; gap: 40px; }
.pg__sticky { flex: 1; }
@media (min-width: 901px) {
  .pg__sticky-inner { position: sticky; top: 92px; }
}

/* ---------- Preview ---------- */

.preview {
  background: var(--panel);
  border-radius: var(--radius-card-lg);
  padding: clamp(18px, 3vw, 32px);
  display: grid; gap: 18px;
}
.preview figure { margin: 0; display: grid; gap: 10px; }
.preview figcaption {
  font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); text-align: center;
}
.preview__lid .lid { filter: drop-shadow(0 14px 22px rgba(15, 15, 16, .14)); max-width: 520px; margin-inline: auto; }
.preview__row { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: end; }

.box-side {
  aspect-ratio: 2.35 / 1;
  border-radius: 10px;
  display: grid; place-items: center;
  padding: 6% 7%;
  background: var(--body, #F5F5F4);
  box-shadow: inset 0 0 0 2px rgba(15, 15, 16, .10), inset 0 -6px 0 rgba(15, 15, 16, .06), 0 10px 20px rgba(15, 15, 16, .12);
  overflow: hidden;
  container-type: inline-size;
}
.box-side__text {
  display: block;
  width: 100%;
  color: var(--ink, #1F1F1F);
  text-align: center;
  line-height: 1.08;
  font-size: 28px;
}
.box-side__text.is-placeholder { opacity: .38; }

.pieces {
  min-height: 100px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  flex-wrap: wrap;
}
.pieces__dice { display: flex; align-items: flex-end; gap: 8px; }
.pieces__dice .die:first-child { transform: rotate(-8deg); }
.pieces__dice .die:last-child { transform: rotate(6deg); }
.penny--real {
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 55%),
    linear-gradient(135deg, #C77B45, #9A5420);
}
.penny--real .penny__text { color: #7A3F15; text-shadow: 0 1px 0 rgba(255, 255, 255, .25); font-size: 15px !important; }

.preview__note { margin: 12px 4px 0; font-size: .8125rem; color: var(--muted); text-align: center; }

/* ---------- Gallery ---------- */

.gallery h2 { font-size: 1.5rem; margin: 0 0 4px; }
.gallery > p { margin: 0 0 16px; font-size: .9375rem; }
.gallery__grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.gallery__grid button {
  display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--panel);
}
.gallery__grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.gallery__grid button:hover img { transform: scale(1.04); }

/* ---------- Config header + price ---------- */

.pg__config h1 { font-size: clamp(2.25rem, 4.5vw, 3.25rem); margin: 14px 0 12px; }
.pg__desc { color: var(--muted); font-size: 1.0625rem; max-width: 50ch; }

.price-block {
  margin: 22px 0 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card-sm);
  background: var(--panel-soft);
}
.price-block__main { display: flex; align-items: baseline; gap: 12px; }
.price-block__amount { font-family: var(--font-head); font-size: 2.25rem; font-weight: 700; line-height: 1; }
.price-block__tier { font-weight: 600; color: var(--accent); }
.price-block__extra { margin: 6px 0 0; font-size: .875rem; color: var(--muted); }

.tiers {
  list-style: none; margin: 16px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.tiers li {
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font-size: .8125rem; color: var(--muted); line-height: 1.35;
  transition: border-color .15s ease, background-color .15s ease;
}
.tiers strong { display: block; color: var(--ink); font-size: .9375rem; margin-bottom: 2px; }
.tiers li.is-current { border-color: var(--accent); background: var(--accent-tint); }
.tiers li.is-current strong { color: var(--accent); }

.edit-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; padding: 4px 6px 4px 16px;
  border-radius: var(--radius-input);
  background: var(--ink); color: #fff; font-weight: 500; font-size: .9375rem;
}
.edit-banner[hidden] { display: none; }
.edit-banner .link-btn { color: #fff; }

/* ---------- Steps ---------- */

.config { display: grid; gap: 14px; }
.step {
  margin: 0; padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card-sm);
  display: grid; gap: 16px;
  min-width: 0;
}
.step__title {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 0; margin-bottom: 2px;
  font-family: var(--font-head); font-weight: 700; font-size: 1.1875rem;
  float: left; width: 100%;
}
.step__title + * { clear: both; }
.step__num {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: #fff;
  font-family: var(--font-body); font-size: .8125rem; font-weight: 700;
}
.step__optional { font-family: var(--font-body); font-size: .8125rem; font-weight: 500; color: var(--muted); }
.pill--sm { padding: 4px 10px; font-size: .75rem; font-family: var(--font-body); }

.field__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.counter { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.is-full { color: var(--accent); font-weight: 600; }
.step .hint { margin: -6px 0 0; }
.step .note { margin: 0; }

/* Swatches */
.swatch-group { display: grid; gap: 8px; }
.swatch-group__label { margin: 0; font-weight: 600; font-size: .9375rem; }
.swatch-group__value { font-weight: 400; color: var(--muted); }
.swatch-group__value::before { content: "· "; }
.swatches-row { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch {
  position: relative;
  display: grid; place-items: center;
  width: var(--tap); height: var(--tap);
  border-radius: 50%;
  cursor: pointer;
}
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch__dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(15, 15, 16, .16);
  transition: transform .12s ease;
}
.swatch:hover .swatch__dot { transform: scale(1.08); }
.swatch input:checked + .swatch__dot {
  box-shadow: inset 0 0 0 1px rgba(15, 15, 16, .16), 0 0 0 3px #fff, 0 0 0 5px var(--ink);
}
.swatch input:focus-visible + .swatch__dot { outline: 3px solid var(--accent); outline-offset: 5px; }
.swatch__custom {
  position: absolute; top: 2px; right: 2px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); border: 1.5px solid #fff;
  pointer-events: none;
}

/* Radio cards */
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-row--3 { grid-template-columns: repeat(3, 1fr); }
.choice {
  position: relative;
  display: grid; gap: 2px; align-content: center;
  min-height: 64px; padding: 12px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.choice:hover { border-color: var(--ink); }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice__title { font-weight: 600; }
.choice__sub { font-size: .8125rem; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--ink); background: var(--panel-soft); box-shadow: inset 0 0 0 1px var(--ink); }
.choice:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

.printed-options { display: grid; gap: 16px; padding-top: 4px; }
.printed-options[hidden] { display: none; }

/* Checkbox */
.check {
  position: relative;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  min-height: var(--tap); padding: 10px 14px;
  border: 1.5px solid var(--border-strong); border-radius: 14px;
  cursor: pointer;
}
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check__box {
  width: 22px; height: 22px; flex: none; border-radius: 6px;
  border: 1.5px solid var(--border-strong); background: #fff;
  display: grid; place-items: center;
}
.check input:checked + .check__box {
  background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3.2L15 7' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
  border-color: var(--ink);
}
.check input:focus-visible + .check__box { outline: 3px solid var(--accent); outline-offset: 2px; }
.check:has(input:checked) { border-color: var(--ink); }
.check .pill { margin-left: auto; }

/* Buy row */
.buy {
  display: flex; gap: 12px; align-items: center;
  margin-top: 6px;
}
.buy .stepper { flex: none; }
.buy__btn { flex: 1; }
.buy__meta { margin: 0; font-size: .875rem; color: var(--muted); }

/* ---------- How to play / box / FAQ ---------- */

.rules {
  list-style: none; margin: 32px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px;
  counter-reset: rule;
}
.rules li {
  counter-increment: rule;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-card-sm);
  padding: 20px;
}
.rules li::before {
  content: counter(rule);
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-tint); color: var(--accent);
  font-weight: 800; margin-bottom: 14px;
}
.rules h3 { font-size: 1.0625rem; margin-bottom: 6px; }
.rules p { margin: 0; color: var(--muted); font-size: .9375rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 80px); }
.box-list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; }
.box-list li {
  position: relative; padding: 14px 16px 14px 48px;
  background: var(--panel-soft); border: 1px solid var(--border); border-radius: 14px;
}
.box-list li::before {
  content: ""; position: absolute; left: 16px; top: 17px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 10.3l2.6 2.6L14 7.5' fill='none' stroke='%239A5420' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat;
}

.faq { margin-top: 24px; border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; cursor: pointer; list-style: none;
  font-weight: 600; font-size: 1.0625rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; font-size: 1.5rem; font-weight: 400; color: var(--muted); transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 18px; color: var(--muted); }
.faq a { color: var(--accent); font-weight: 600; }

/* ---------- Icon button ---------- */

.icon-btn {
  display: inline-grid; place-items: center;
  width: var(--tap); height: var(--tap); flex: none;
  border: 0; border-radius: 50%; background: var(--panel-soft); color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { background: var(--panel); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn--dark { background: rgba(255, 255, 255, .12); color: #fff; }
.icon-btn--dark:hover { background: rgba(255, 255, 255, .22); }
.icon-btn[disabled] { opacity: .35; cursor: not-allowed; }

/* ---------- Cart drawer ---------- */

dialog.drawer {
  margin: 0 0 0 auto;
  padding: 0; border: 0;
  width: min(440px, 100vw);
  height: 100dvh; max-height: 100dvh; max-width: 100vw;
  background: #fff; color: var(--ink);
  box-shadow: var(--shadow-pop);
}
dialog.drawer::backdrop { background: rgba(15, 15, 16, .45); }
dialog.drawer[open] { animation: drawer-in .22s ease-out; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }

.drawer__panel { display: flex; flex-direction: column; height: 100%; }
.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.drawer__head h2 { font-size: 1.375rem; margin: 0; }

.ship-progress { padding: 14px 20px; background: var(--panel-soft); border-bottom: 1px solid var(--border); }
.ship-progress__text { margin: 0 0 8px; font-size: .875rem; font-weight: 500; }
.ship-progress__bar { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.ship-progress__bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .3s ease; }

.drawer__lines { list-style: none; margin: 0; padding: 0 20px; overflow-y: auto; flex: 1; }
.drawer__empty { flex: 1; display: grid; place-items: center; color: var(--muted); }

.line {
  display: grid; grid-template-columns: 76px 1fr; gap: 14px;
  padding: 18px 0; border-bottom: 1px solid var(--border);
}
.line__thumb {
  width: 76px; height: 64px; border-radius: 12px; background: var(--panel);
  display: grid; place-items: center; padding: 6px;
}
.line__head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.line__title { font-weight: 600; margin: 0; }
.line__price { font-weight: 600; white-space: nowrap; }
.line__opts { list-style: none; margin: 4px 0 10px; padding: 0; font-size: .8125rem; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.line__actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.line__actions .stepper button { width: 36px; height: 36px; font-size: 1.05rem; }
.line__actions .stepper { min-height: var(--tap); }
.line__actions .link-btn { min-height: 36px; }

.drawer__foot { padding: 16px 20px 20px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.drawer__foot[hidden] { display: none; }
.totals { margin: 0 0 6px; display: grid; gap: 6px; }
.totals div { display: flex; justify-content: space-between; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; font-weight: 600; }

/* ---------- Lightbox ---------- */

dialog.lightbox {
  padding: 0; border: 0; margin: 0;
  width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh;
  background: rgba(10, 10, 11, .94); color: #fff;
}
dialog.lightbox[open] { display: flex; flex-direction: column; }
dialog.lightbox::backdrop { background: rgba(10, 10, 11, .6); }
.lightbox__frame { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 20px 20px 0; overflow: hidden; }
.lightbox__frame img {
  width: auto; height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 120px);
  object-fit: contain; border-radius: 12px;
}
.lightbox__bar {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 16px 20px max(16px, env(safe-area-inset-bottom));
}
.lightbox__count { min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.lightbox__close { margin-left: 8px; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .rules { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .pg { grid-template-columns: 1fr; }
  .pg__media { gap: 28px; }
  .two-col { grid-template-columns: 1fr; }
  .rules { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .preview__row { grid-template-columns: 1fr; }
  .gallery__grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .gallery__grid button { border-radius: 10px; }
  .tiers { grid-template-columns: 1fr; }
  .tiers li { display: flex; gap: 8px; align-items: baseline; padding: 10px 12px; }
  .tiers strong { margin: 0; white-space: nowrap; }
  .choice-row--3 { gap: 6px; }
  .choice { padding: 10px; }
  .step { padding: 16px; }
  .rules { grid-template-columns: 1fr; }
  .buy { position: sticky; bottom: 0; z-index: 5; background: #fff; padding: 10px 0 12px; margin-inline: -4px; padding-inline: 4px; border-top: 1px solid var(--border); }
}

/* Elements with a display rule above still need to hide when [hidden] is set. */
.drawer__empty[hidden], .ship-progress[hidden], .price-block__extra[hidden] { display: none; }
