@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}

@font-face {
  font-family: Fraunces;
  src: url("/quiestce/fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f6f3eb;
  --card: #fffdf7;
  --ink: #284967;
  --blue: #315f88;
  --muted: #50646b;
  --line: #d8ddd4;
  --active: #e1ebed;
  --mirror: #dfeae8;
  --mirror-line: #bccfcc;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
p, h1, h2 { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.frame {
  width: min(calc(100% - 72px), 1160px);
  margin-inline: auto;
}

.site-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  font-size: .875rem;
  font-weight: 650;
  text-decoration: none;
}

.back:hover { text-decoration: underline; }
.wordmark { font-size: .875rem; font-weight: 600; }
.back svg, .reset svg, .goal-mark svg, .piece-mark svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding-block: 27px 23px;
}

.game-heading {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 17px);
}

.game-mark {
  display: block;
  flex: none;
  width: clamp(46px, 6vw, 68px);
  height: auto;
}

h1, h2 { font-family: Fraunces, Georgia, serif; font-weight: 500; }
h1 {
  font-size: clamp(2.3rem, 4.25vw, 4.15rem);
  line-height: 1.06;
  letter-spacing: -.05em;
}

.intro p, .help, .challenge p { color: var(--muted); }
.intro p { margin-top: 7px; font-size: 1rem; }

.modes {
  display: flex;
  gap: 3px;
  flex: none;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
}

.modes button {
  min-height: 44px;
  padding: 0 17px;
  border: 0;
  border-radius: 24px;
  background: transparent;
  font-size: .925rem;
  font-weight: 650;
}

.modes button[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.modes button[aria-pressed="false"]:hover { background: var(--active); }

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 4fr) minmax(0, 6fr);
  align-items: start;
  gap: 26px;
  padding-bottom: 38px;
}

.fitting-room, .closet, .challenge {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.fitting-room {
  position: sticky;
  top: 16px;
  padding: 11px 16px 16px;
}

.fitting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 3px 7px;
}

h2 { font-size: 1.5rem; letter-spacing: -.025em; line-height: 1.15; }
.reset {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 44px;
  padding-inline: 7px;
  margin-right: -7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: .8125rem;
  font-weight: 620;
}
.reset:hover:not(:disabled) { background: var(--active); }
.reset:disabled { color: var(--muted); opacity: .68; }

.mirror {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--mirror-line);
  border-radius: 42% 42% 10px 10px / 25% 25% 10px 10px;
  background: var(--mirror);
}

#avatar {
  display: block;
  width: 100%;
  height: clamp(300px, 49vh, 460px);
}

#body-navigation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.body-zone {
  fill: transparent;
  pointer-events: fill;
  cursor: pointer;
}

.body-zone:focus { outline: none; }
.body-zone:focus-visible {
  fill: rgb(255 253 247 / .17);
  stroke: var(--blue);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

@media (hover: hover) {
  .body-zone:hover:not(:focus-visible) {
    fill: rgb(255 253 247 / .12);
    stroke: var(--blue);
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
    vector-effect: non-scaling-stroke;
  }
}

.fitting-caption {
  min-height: 4rem;
  padding: 13px 4px 0;
}

.outfit {
  font-size: .975rem;
  line-height: 1.6;
}
.outfit strong { font-weight: 700; }
#body-help {
  margin-top: 5px;
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.35;
}

.wardrobe { display: grid; gap: 15px; min-width: 0; }
.closet, .challenge { padding: 19px 21px 21px; }
.help, .challenge > p { margin-top: 5px; font-size: .9rem; }

.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 11px;
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
}

.category-group { display: flex; flex-wrap: wrap; gap: 5px; }

.categories button {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  font-size: .875rem;
  font-weight: 620;
}

.categories button[aria-pressed="true"] { background: var(--active); border-color: var(--blue); }
.categories button[aria-pressed="false"]:hover { background: var(--paper); }
.categories button.is-related { border-color: var(--blue); }
#region-title { margin: 14px 0 0; font-size: 1rem; }
#closet-title { scroll-margin-top: 12px; }

.items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 14px;
}

.piece {
  position: relative;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  min-height: 110px;
  padding: 9px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-weight: 650;
}

.piece:hover { background: var(--paper); border-color: #a9b5af; }
.piece[aria-pressed="true"] { border-color: var(--blue); background: var(--active); }

.piece-art {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 63px;
  flex: none;
}

.piece-art img { display: block; width: 78%; height: 100%; max-width: 114px; object-fit: contain; }
.piece-label { margin: auto 0; font-size: .875rem; line-height: 1.25; overflow-wrap: anywhere; }

.piece-mark {
  display: none;
  position: absolute;
  top: 5px;
  right: 5px;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--card);
}

.piece[aria-pressed="true"] .piece-mark { display: grid; }
.piece-mark svg { width: 13px; height: 13px; stroke-width: 2.5; }

.challenge { background: #f0f5f3; border-color: var(--mirror-line); }
.challenge-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 12px 0;
  list-style: none;
}

.challenge-items li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--mirror-line);
  border-radius: 20px;
  background: var(--card);
  font-size: .875rem;
  font-weight: 650;
}

.challenge-items li.worn { background: var(--active); }
.goal-mark {
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.goal-mark svg { visibility: hidden; width: 10px; height: 10px; stroke-width: 3; }
.worn .goal-mark { background: var(--ink); color: var(--card); }
.worn .goal-mark svg { visibility: visible; }
.challenge-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; }
.challenge-actions p { font-size: .875rem; }
.challenge-actions p[data-result="success"] { color: var(--ink); font-weight: 700; }

.action {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: var(--card);
  font-weight: 660;
}
.action:hover { background: var(--blue); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .frame { width: calc(100% - 42px); }
  .workspace { gap: 16px; grid-template-columns: minmax(245px, 4fr) minmax(0, 6fr); }
  .closet, .challenge { padding-inline: 14px; }
  .categories { gap: 5px; }
  .categories button { min-height: 44px; }
}

@media (max-width: 680px), (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .fitting-room {
    top: 6px;
    z-index: 1;
    padding: 3px 9px 8px;
    box-shadow: 0 4px 10px rgb(40 73 103 / .09);
  }
  .fitting-header { padding-bottom: 2px; }
  .fitting-caption { min-height: 0; padding: 7px 4px 2px; }
  .outfit {
    max-height: 4.2em;
    overflow-y: auto;
    font-size: .9rem;
    line-height: 1.4;
  }
}

@media (max-width: 680px) {
  html { scroll-padding-top: calc(var(--fitting-preview-height, 240px) + 8px); }
  .frame { width: calc(100% - 32px); }
  .site-header { min-height: 46px; }
  .intro { align-items: flex-start; flex-direction: column; gap: 11px; padding-block: 13px; }
  .intro p { font-size: .9rem; margin-top: 5px; }
  .modes button { font-size: .875rem; padding-inline: 13px; }
  .workspace { display: block; }
  .wardrobe { margin-top: 11px; }
  #avatar { height: clamp(104px, 26svh, 202px); }
  .closet, .challenge { padding: 13px; }
  .categories { padding-block: 11px; }
  .category-group { display: contents; }
  .categories button { padding-inline: 9px; font-size: .8125rem; }
  .items { gap: 6px; margin-top: 9px; }
  .piece { min-height: 92px; gap: 4px; padding: 6px 4px; }
  .piece-art { height: 49px; }
  .piece-label { font-size: .8125rem; }
}

@media (max-width: 680px) and (max-height: 650px) {
  #body-help { display: none; }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  html { scroll-padding-top: 8px; }
  .workspace {
    display: grid;
    grid-template-columns: minmax(175px, 1fr) minmax(0, 2fr);
    gap: 11px;
  }
  .wardrobe { margin-top: 0; }
  .fitting-header h2 { font-size: 1.15rem; }
  #avatar { height: clamp(104px, 40svh, 184px); }
  #body-help { display: none; }
}
