* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    15px/1.6 'Microsoft YaHei',
    sans-serif;
  background: #faf9f5;
  color: #292520;
  --wine: #792939;
  --line: #ddd8cf;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: white;
  padding: 10px 15px;
  max-width: 100%;
}
button {
  cursor: pointer;
}
button:hover {
  border-color: var(--wine);
  color: var(--wine);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button.hot,
button.hot:hover {
  background: var(--wine);
  color: white;
  border-color: var(--wine);
}
body > header,
.flex,
#tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
body > header {
  justify-content: space-between;
  padding: 16px 4%;
  background: white;
  border-bottom: 1px solid var(--line);
}
header strong {
  font: bold 30px SimSun;
}
header i,
.eyebrow {
  font: 14px Georgia;
  letter-spacing: 3px;
  color: var(--wine);
}
#tabs button,
.link {
  border: none;
  background: none;
}
#tabs .sel {
  color: var(--wine);
  box-shadow: inset 0 -2px;
  border-radius: 0;
  font-weight: bold;
}
main {
  max-width: 1420px;
  margin: auto;
  padding: 28px 4%;
}
footer {
  text-align: center;
  padding: 20px;
  color: #736b62;
  font-size: 13px;
}
.between {
  justify-content: space-between;
}
.mirrorGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4vw;
}
.stage {
  height: min(80vh, 65vw);
  position: sticky;
  top: 16px;
  background: #e8dfd3;
  border-radius: 18px;
  overflow: hidden;
}
.stage > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.stage .label,
.stage .tools {
  position: absolute;
  left: 16px;
}
.stage .label {
  top: 16px;
  background: #fffcf5ed;
  padding: 8px 14px;
  border-radius: 30px;
  font-size: 13px;
}
.stage .tools {
  bottom: 18px;
  right: 16px;
  justify-content: center;
}
.shop h1 {
  font: bold 30px SimSun;
  margin: 12px 0 18px;
}
.shop h2 {
  margin: 6px 0;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.tile {
  text-align: left;
  border: 0;
  padding: 0;
  background: none;
  overflow: hidden;
}
.tile img {
  width: 100%;
  aspect-ratio: 1.5;
  object-fit: cover;
  object-position: 50% 34%;
  border-radius: 9px;
  display: block;
  margin-bottom: 6px;
}
.tile.active img {
  border: 3px solid var(--wine);
}
.tile b {
  display: block;
}
.shop small,
dialog small,
.sub {
  font-size: 13px;
  color: #70695e;
}
.price {
  font: 27px Georgia;
  color: var(--wine);
}
.bar {
  border-top: 1px solid var(--line);
  padding-top: 15px;
}
.shop p {
  margin: 10px 0;
}
.wide {
  flex: 1;
}
.boxx {
  padding: 18px;
  margin: 14px 0;
  border: 1px solid var(--line);
  background: white;
  border-radius: 14px;
}
.duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.duo img {
  width: 100%;
  height: min(48vh, 430px);
  object-fit: contain;
  background: #eee7de;
  border-radius: 12px;
}
#panel {
  border: 0;
  border-radius: 18px;
  padding: 24px;
  width: min(760px, 95vw);
  max-height: 92vh;
  color: inherit;
}
dialog::backdrop {
  background: #18141399;
}
#message:not(:empty) {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #251d1b;
  color: white;
  padding: 14px 22px;
  border-radius: 12px;
  z-index: 99999;
}
#err {
  color: #902538;
}
.thumb {
  width: 76px;
  height: 98px;
  object-fit: cover;
  border-radius: 8px;
}
code {
  overflow-wrap: anywhere;
}
@media (max-width: 850px), (orientation: portrait) {
  .mirrorGrid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .stage {
    position: relative;
    top: 0;
    height: min(56vh, 124vw);
  }
  main {
    padding-top: 14px;
  }
  #tabs {
    gap: 0;
  }
  #tabs button {
    padding: 8px;
  }
  .cards {
    gap: 10px;
  }
  .shop h1 {
    font-size: 25px;
  }
  .stage .tools button {
    padding: 9px 10px;
  }
  .tile {
    font-size: 13px;
  }
  .stage .label {
    font-size: 11px;
    left: 8px;
    top: 8px;
  }
  .duo img {
    height: auto;
  }
  body > header {
    padding: 10px 4%;
  }
}
@media (min-width: 780px) and (orientation: portrait) {
  .cards {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .stage {
    height: 51vh;
  }
}
.fun .stage {
  background: #fff;
  border: 1px solid var(--line);
}
.fun .stage > img {
  padding: 42px 12px 82px;
}
.fun .tile img {
  object-fit: contain;
  aspect-ratio: 1;
  background: white;
  border: 1px solid var(--line);
  padding: 6px;
}
.fun .tile.active img {
  border: 3px solid var(--wine);
}
.fun .download {
  color: var(--wine);
  padding: 10px 14px;
  background: #f3e8e8;
  border-radius: 9px;
  text-decoration: none;
}
.fun .label {
  background: #f5f1eb;
}
@media (min-width: 780px) and (orientation: portrait) {
  .fun .cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Full-screen fitting room. The mirror stays in view while the rack scrolls. */
body:has(dialog[data-fitting][open]) {
  overflow: hidden;
}
dialog[data-fitting][open] {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  border: 0;
  padding: 0;
  background: #fffdf9;
  color: #292520;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(370px, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: 'head head' 'stage rack' 'controls rack';
}
[data-fitting] button {
  min-height: 44px;
  line-height: 1.35;
}
.fitHead,
.fitNav,
.fitActions,
[data-groups] {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fitHead {
  grid-area: head;
  justify-content: space-between;
  padding: 10px 3%;
  border-bottom: 1px solid var(--line);
}
.fitHead strong {
  color: var(--wine);
  font-size: 20px;
}
.fitStage {
  grid-area: stage;
  position: relative;
  background: #f1ede6;
  min-height: 0;
}
.fitStage img,
.fitStage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.fitStage video {
  background: #171616;
}
.fitStage:has(video:not([hidden])) img {
  visibility: hidden;
}
.fitStage span {
  position: absolute;
  left: 14px;
  top: 14px;
  background: #292520d9;
  color: white;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 13px;
  pointer-events: none;
}
.fitRack {
  grid-area: rack;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 18px 4% 0;
  border-left: 1px solid var(--line);
}
.fitNav strong {
  flex: 1;
  text-align: center;
  font-size: 17px;
  overflow-wrap: anywhere;
}
.fitNav button {
  flex: none;
}
[data-groups] {
  overflow: auto;
  padding: 2px;
  flex-wrap: wrap;
}
[data-groups] button {
  border-radius: 24px;
  padding: 6px 14px;
  flex: none;
}
[data-groups] [aria-pressed='true'] {
  background: var(--wine);
  color: white;
  border-color: var(--wine);
}
[data-cards] {
  overflow: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  padding: 3px 3px 20px;
}
[data-cards] button {
  position: relative;
  padding: 6px 6px 10px;
  border-radius: 13px;
  overflow-wrap: anywhere;
}
[data-cards] img {
  display: block;
  width: 100%;
  height: clamp(120px, 20vh, 220px);
  object-fit: contain;
  margin-bottom: 6px;
}
[data-cards] [aria-pressed='true'] {
  border-color: var(--wine);
  box-shadow: 0 0 0 2px var(--wine);
  color: var(--wine);
  font-weight: bold;
}
[data-cards] [aria-pressed='true']::after {
  content: '✓';
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--wine);
  color: white;
  border-radius: 50%;
  width: 24px;
  line-height: 24px;
}
.fitControls {
  grid-area: controls;
  max-height: 40dvh;
  overflow: auto;
  padding: 12px 4% max(14px, env(safe-area-inset-bottom));
  font-size: 14px;
}
.fitControls p {
  margin: 0;
  font-weight: bold;
}
.fitControls small {
  display: block;
  font-size: 13px;
  color: #625a51;
  margin-top: 5px;
}
.fitControls:has([data-permission][hidden]) small {
  display: none;
}
.fitControls ol {
  overflow-wrap: anywhere;
}
.fitActions {
  margin-top: 10px;
  flex-wrap: wrap;
}
.fitActions:has([data-go][hidden][disabled]):has([data-preview][hidden]) {
  margin: 0;
}
.fitActions [data-go] {
  flex: 1;
  min-width: 160px;
  font-weight: bold;
  min-height: 48px;
}
@media (max-width: 760px) {
  dialog[data-fitting][open] {
    grid-template-columns: 100%;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: 'head' 'stage' 'rack' 'controls';
  }
  .fitHead {
    padding: 4px 12px;
  }
  .fitHead strong {
    font-size: 16px;
  }
  .fitRack {
    padding: 6px 8px 0;
    gap: 3px;
    border: 0;
  }
  .fitNav strong {
    font-size: 14px;
  }
  .fitNav button,
  [data-groups] button,
  .fitActions button {
    padding: 5px 10px;
  }
  [data-groups] {
    flex-wrap: nowrap;
  }
  [data-cards] {
    display: flex;
    gap: 9px;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }
  [data-cards] button {
    flex: 0 0 102px;
    font-size: 13px;
    padding: 3px;
    scroll-snap-align: start;
  }
  [data-cards] img {
    height: clamp(60px, 10dvh, 105px);
    margin: 0;
  }
  .fitControls {
    padding: 6px 12px max(8px, env(safe-area-inset-bottom));
    max-height: 32dvh;
    font-size: 13px;
    line-height: 1.45;
  }
  .fitActions {
    margin-top: 6px;
  }
  .fitStage span {
    top: 6px;
    left: 6px;
    font-size: 11px;
  }
}
@media (max-height: 570px) and (orientation: landscape) {
  dialog[data-fitting][open] {
    overflow: auto;
    grid-template-rows: auto minmax(190px, 1fr) auto;
  }
  .fitControls {
    max-height: none;
  }
  .fitHead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: white;
  }
}

.funQuick {
  display: none;
}
@media (max-width: 800px) {
  .funQuick.picked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: sticky;
    bottom: 0;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
    background: #fffdf9;
    border-top: 1px solid var(--line);
    z-index: 1;
  }
  .funQuick button {
    min-height: 44px;
    flex: none;
  }
}
@media (max-width: 760px) and (max-height: 680px) {
  .fitControls {
    max-height: 36dvh;
  }
  .fitControls [data-state]:has(+ ol[hidden]) {
    font-size: 12px;
  }
  .fitControls small {
    font-size: 12px;
  }
  .fitActions {
    position: sticky;
    bottom: 0;
    background: #fffdf9;
  }
}
.cardDesk {
  width: min(460px, 94vw);
  max-height: 92dvh;
  border: 0;
  border-radius: 18px;
  padding: 22px;
  background: #fffdf9;
  color: inherit;
  overflow-wrap: anywhere;
}
.cardDesk h2 {
  margin: 0;
  font-size: 23px;
}
.cardDesk button {
  min-height: 44px;
}
.cardDesk form {
  display: grid;
  gap: 14px;
  margin: 16px 0;
}
.cardDesk input,
.cardDesk textarea {
  display: block;
  width: 100%;
  font-size: 16px;
  margin: 5px 0;
}
.cardDesk small {
  display: block;
  margin-top: 10px;
}
.cardDesk [role='status'] {
  margin: 12px 0 0;
  color: var(--wine);
  font-weight: bold;
}
.cardModes {
  display: flex;
  gap: 6px;
}
.cardModes button {
  flex: 1;
}
.cardModes [aria-pressed='true'] {
  background: #f6e9eb;
  color: var(--wine);
  border-color: var(--wine);
}
.cardRules {
  padding: 12px;
  background: #f3eee6;
  border-radius: 10px;
  font-size: 14px;
}
.cardBalance {
  font-size: 22px;
  font-weight: bold;
  color: var(--wine);
}
.cardStart {
  width: 100%;
}
