:root {
  color-scheme: light;
  --ink: #1b352c;
  --muted: #55675c;
  --green: #173e33;
  --green-dark: #0d2d24;
  --cream: #f8f4ea;
  --paper: #fffcf5;
  --line: #ddd9ca;
  --gold: #e7ab62;
  --red: #923828;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
button, a, input, select { outline-offset: 4px; }
a { color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 500; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
p { line-height: 1.5; }
.loading { padding: 2rem; }
.mark { display: inline-grid; place-items: center; flex: none; color: var(--gold); font-size: 1.9rem; line-height: 1; }

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: .65rem .95rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  background: transparent;
  text-decoration: none;
  font-weight: 680;
  font-size: .92rem;
  white-space: nowrap;
}
.button.primary { background: var(--green); border-color: var(--green); color: #fffdf3; }
.button.primary:hover:not(:disabled) { background: var(--green-dark); }
.button.secondary { border-color: var(--line); background: var(--paper); color: var(--ink); }
.button.secondary:hover:not(:disabled) { border-color: #6d7b6c; }
.button span { font-size: 1.05rem; }
.text-button { background: transparent; border: 0; color: var(--green); font-weight: 700; min-height: 42px; padding: .4rem .15rem; }
.text-button:hover { text-decoration: underline; }

.welcome {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .92fr);
  background: var(--green);
  color: var(--cream);
}
.welcome-photo { background: url('/market.webp') center / cover; min-height: 42svh; }
.welcome-content { display: grid; place-content: center; justify-items: start; padding: clamp(2rem, 6vw, 7rem); }
.welcome-content > .mark { font-size: 3rem; margin-bottom: 1.35rem; }
.welcome h1 { font-size: clamp(3.2rem, 7.2vw, 8rem); line-height: .89; letter-spacing: -.075em; }
.welcome h1 span, .price-header h1 span { color: #a04630; }
.welcome h1 span { color: var(--gold); }
.welcome-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.welcome .button.primary { background: #f1ce95; color: #232f25; border-color: #f1ce95; }
.welcome .button.primary:hover { background: #f9dcad; }
.welcome .button.secondary { background: transparent; border-color: #a9b3a7; color: var(--cream); }

.entry { max-width: 520px; margin: 0 auto; padding: 2rem 1.25rem; }
.entry .brand { color: var(--green); }
.entry-panel { background: var(--paper); border: 1px solid var(--line); border-radius: .85rem; margin-top: 2rem; padding: clamp(1.35rem, 5vw, 2.4rem); }
.entry h1 { font-size: clamp(2.1rem, 7vw, 3rem); line-height: 1.05; margin-bottom: 1.2rem; }
.entry p { color: var(--muted); margin-bottom: 1.15rem; }
.entry .form-error { color: var(--red); }
.code-input { text-transform: uppercase; letter-spacing: .16em; }

.topbar { background: var(--green); color: var(--cream); }
.topbar-inner { max-width: 1340px; padding: .6rem max(1rem, 3vw); margin: auto; display: flex; align-items: center; justify-content: space-between; gap: .7rem; min-height: 74px; }
.brand { text-decoration: none; white-space: nowrap; display: inline-flex; gap: .55rem; align-items: center; font-family: var(--serif); font-size: 1.25rem; }
nav { display: flex; align-self: stretch; align-items: center; justify-content: center; gap: .13rem; }
nav button {
  min-height: 45px; border: 0; border-radius: .45rem; padding: 0 .75rem;
  background: transparent; color: #e4ede4; font-size: .91rem; font-weight: 650;
}
nav button:is(:hover, [aria-current]) { background: #305447; color: white; }
.sync { white-space: nowrap; color: #e3ede5; font-size: .83rem; font-weight: 650; display: inline-flex; align-items: center; gap: .45rem; }
.sync i { width: .54rem; height: .54rem; border-radius: 50%; }
.sync i.good { background: #94d9a2; }
.sync i.waiting { background: #efbe78; }

.workspace { max-width: 1220px; margin: auto; padding: clamp(1.3rem, 3.7vw, 3rem) max(1rem, 3vw) 3rem; }
.page-heading { display: flex; gap: .8rem 1.1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.3rem; }
.page-heading h1 { font-size: clamp(2.65rem, 5vw, 4.5rem); line-height: .95; letter-spacing: -.065em; }
.page-heading p { color: var(--muted); margin-top: .65rem; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: #4b6659; border-radius: .8rem; overflow: hidden; margin-bottom: 1.25rem; }
.metrics > div { background: var(--green); color: var(--cream); padding: 1rem clamp(1rem, 2.7vw, 2rem); display: grid; gap: .35rem; }
.metrics span { font-size: .9rem; color: #dce9df; }
.metrics strong { font-family: var(--serif); font-weight: 500; font-size: clamp(2rem, 5.3vw, 3.7rem); letter-spacing: -.045em; line-height: 1.05; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 1.3rem 0 .7rem; min-height: 38px; }
.section-heading h2 { font-size: 1.65rem; letter-spacing: -.045em; }
.history-heading { margin-top: 1.75rem; }
.sale-grid, .payout-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: .8rem; }
.sale-card, .display-card { background: var(--paper); border: 1px solid var(--line); border-radius: .75rem; min-width: 0; }
.sale-card { padding: 1rem; }
.sale-card-title { display: flex; justify-content: space-between; align-items: baseline; gap: .65rem; }
.sale-card h3 { font-size: 1.16rem; font-weight: 720; overflow-wrap: anywhere; }
.sale-card-title strong { font-size: 1.1rem; white-space: nowrap; }
.sale-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: .35rem; margin-top: 1rem; }
.sale-card-bottom .button { min-width: 102px; }
.stock, .sold-out { display: inline-block; width: fit-content; border-radius: 2rem; padding: .33rem .62rem; font-size: .79rem; color: #285242; background: #e7efe4; white-space: nowrap; font-weight: 720; }
.sold-out { background: #f8e4d9; color: #852f23; }
.empty, .empty-line { border: 1px solid var(--line); border-radius: .7rem; background: var(--paper); padding: 1.1rem; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: .35rem; }
.empty .button { margin-top: 1rem; }
.list { border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; background: var(--paper); }
.inventory-row, .sale-row { display: grid; gap: .7rem; align-items: center; padding: .65rem 1rem; border-bottom: 1px solid var(--line); }
.inventory-row:last-child, .sale-row:last-child { border-bottom: 0; }
.inventory-row { grid-template-columns: minmax(0, 1fr) 8.3rem 6.5rem auto; }
.sale-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.sale-row .text-button { padding-inline: .35rem; }
.sale-row > .button { grid-column: 3; }
.detail { color: var(--muted); font-size: .82rem; line-height: 1.4; margin-top: .22rem; }
.inventory-price del, .board-amount del { color: var(--muted); font-size: .84em; }
.payout-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.payout-item { display: flex; justify-content: space-between; gap: .5rem; font-size: .87rem; margin-top: .55rem; }
.payout-item:first-of-type { margin-top: .9rem; }
.display-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.display-card { overflow: hidden; }
.display-art { height: clamp(100px, 18vw, 230px); }
.display-art.prices { background: #efe5d1; color: #234436; display: grid; align-content: center; padding: 1rem 14%; gap: .45rem; }
.display-art.prices span { font: 500 clamp(1.3rem, 3.7vw, 3.3rem)/1 var(--serif); letter-spacing: -.06em; }
.display-art.prices i { border-top: 1px solid #abac96; width: 100%; }
.display-art.attraction { background: url('/market.webp') 50% 48% / cover; }
.display-card-body { padding: 1rem; }
.display-card h2 { font-size: 1.6rem; }
.display-card p { color: var(--muted); margin: .35rem 0 .75rem; }
.display-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.problem { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; padding: .7rem 1rem; background: #f8e4d9; border-radius: .55rem; margin-bottom: 1rem; color: #702e22; }
.problem .button { min-height: 40px; }

dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: .85rem; padding: clamp(1rem, 4vw, 1.65rem); width: min(96vw, 560px); max-height: 88svh; overflow: auto; }
dialog::backdrop { background: #132720aa; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .8rem; }
.dialog-heading h2 { font-size: 1.85rem; letter-spacing: -.05em; }
.close { font-size: 1.65rem; min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: .5rem; background: transparent; color: var(--ink); }
.stack { display: grid; gap: .8rem; }
dialog p + form { margin-top: .85rem; }
label { display: grid; gap: .35rem; font-size: .87rem; font-weight: 650; }
input:not([type=checkbox]), select {
  min-height: 44px; display: block; width: 100%; padding: .5rem .62rem; border: 1px solid #b9bbae;
  border-radius: .45rem; color: var(--ink); background: white; font-size: 1rem;
}
fieldset { margin: 0; border: 1px solid var(--line); border-radius: .55rem; padding: .35rem .75rem .55rem; }
legend { padding-inline: .3rem; font-size: .87rem; font-weight: 650; }
.checkbox { display: flex; align-items: center; gap: .5rem; min-height: 34px; }
input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--green); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.makers-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-error { color: var(--red); }
.pair-dialog { text-align: center; }
.pair-dialog img { display: block; margin: 0 auto .75rem; border-radius: .5rem; }
.pair-code { display: block; font-size: 2rem; letter-spacing: .16em; margin-top: .8rem; }
#notice {
  position: fixed; z-index: 3; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%); max-width: 90vw; width: max-content;
  color: #fffdf3; background: #203d31; padding: .7rem 1rem; border-radius: .58rem;
  box-shadow: 0 4px 20px #15221e24; font-size: .92rem; pointer-events: none;
}
body.sign #notice { font-size: .78rem; opacity: .92; }

.sign-brand { display: flex; align-items: center; gap: .7rem; font-size: clamp(.72rem, 1.55vw, 1.15rem); font-weight: 700; letter-spacing: .19em; text-transform: uppercase; }
.sign-brand .mark { font-size: clamp(1.5rem, 3.1vw, 3rem); }
.attraction { min-height: 100svh; display: grid; grid-template-columns: 47% 53%; background: #163b30; color: #fff1d4; position: relative; overflow: hidden; }
.poster { min-width: 0; min-height: 100svh; display: grid; padding: clamp(1.6rem, 5.4vw, 6rem); background: radial-gradient(ellipse at 24% 48%, #224a3c, #14382e 75%); }
.poster-inner { display: grid; grid-template-rows: auto 1fr auto; position: relative; border-block: 1px solid #c0a47370; padding-block: clamp(1rem, 3vw, 2.7rem); }
.slide-copy { display: grid; align-content: center; padding-block: 1rem; }
.slide-copy > * { animation: settle .46s ease-out both; }
@keyframes settle { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.slide-copy h1 { font-size: clamp(2.7rem, 9vw, 12rem); line-height: .86; letter-spacing: -.082em; }
.slide-copy p { font-family: var(--serif); font-style: italic; font-size: clamp(1rem, 2.65vw, 2.3rem); line-height: 1.24; margin-top: clamp(.8rem, 2.2vw, 2.5rem); color: #f4dcb4; text-wrap: balance; }
.slide-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .35rem; }
.next-slide { display: inline-flex; align-items: center; gap: .7rem; background: transparent; color: #fff1d4; border: 1px solid #d3b586; border-radius: 2rem; font-weight: 650; padding: .55rem .75rem; min-height: 44px; font-size: clamp(.76rem, 1.4vw, 1rem); }
.next-slide:hover { background: #f7e8cc20; }
.slide-dots { display: flex; }
.slide-dots button { border: 0; min-width: 27px; min-height: 44px; background: transparent; display: grid; place-items: center; }
.slide-dots button::after { content: ''; width: 8px; height: 8px; box-shadow: 0 0 0 1px #d3b586; border-radius: 50%; }
.slide-dots button[aria-current=true]::after { background: #e7ab62; box-shadow: 0 0 0 1px #e7ab62; }
.poster-image { min-width: 0; background: url('/market.webp') 53% center / cover; transition: background-position .8s ease-out; }
.poster-image.treats { background-position: 76% 20%; }
.poster-image.crafts { background-position: 51% 80%; }

.price-board { position: relative; min-height: 100svh; display: flex; flex-direction: column; padding: clamp(1.25rem, 4vw, 4.5rem) clamp(1.2rem, 6vw, 6rem); background: #fbf1dd; box-shadow: inset 0 0 0 clamp(6px, 1vw, 13px) #21473a; }
.price-header { text-align: center; display: grid; justify-items: center; gap: clamp(.6rem, 1.6vw, 1.8rem); margin-bottom: clamp(1.2rem, 4vw, 4rem); }
.price-header .sign-brand { color: #21473a; }
.price-header .mark { color: #a04630; }
.price-header h1 { font-size: clamp(3rem, 10vw, 10rem); line-height: .88; letter-spacing: -.08em; }
.price-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: clamp(.95rem, 4vw, 4rem); }
.price-grid.single { max-width: 800px; grid-template-columns: 1fr; align-self: center; }
.price-group { border-top: 2px solid #345644; }
.price-group h2 { color: #852f23; font: 700 clamp(.8rem, 1.7vw, 1.45rem)/1.1 var(--sans); text-transform: uppercase; letter-spacing: .11em; margin: .9rem 0 .55rem; }
.price-line { display: flex; justify-content: space-between; align-items: baseline; gap: .55rem; padding: clamp(.5rem, 1.4vw, 1.3rem) 0; border-bottom: 1px solid #c9c2ac; font: 500 clamp(1.15rem, 2.9vw, 3.35rem)/1.08 var(--serif); letter-spacing: -.032em; }
.price-line > span:first-child { overflow-wrap: anywhere; }
.board-amount { display: inline-flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: .25rem .5rem; }
.board-amount strong { font-weight: 500; }
.board-amount .sold-out { font: 750 clamp(.7rem, 1.6vw, 1.15rem)/1 var(--sans); letter-spacing: 0; }
.menu-empty { text-align: center; font: italic clamp(1.2rem, 3.5vw, 2.7rem) var(--serif); color: var(--muted); }
.price-board footer { margin-top: auto; padding-top: clamp(1.2rem, 5vw, 4rem); text-align: center; color: #345644; font: italic clamp(.92rem, 2.1vw, 1.7rem) var(--serif); }
.price-board footer span { color: #9f472d; }
.preview-back { position: fixed; bottom: 1rem; right: 1rem; }

@media (min-width: 880px) {
  .sale-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 740px) {
  .welcome { grid-template-columns: 1fr; grid-template-rows: 45svh auto; }
  .welcome-photo { min-height: 0; }
  .welcome-content { display: block; padding: 2rem 1.4rem; }
  .topbar-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem; padding-block: .55rem .35rem; }
  .topbar nav { grid-row: 2; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .topbar .brand { font-size: 1.03rem; }
  .topbar .mark { font-size: 1.42rem; }
  nav button { padding-inline: .25rem; font-size: .85rem; }
  .page-heading { flex-wrap: wrap; align-items: flex-start; }
  .inventory-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: .35rem .5rem; padding: .55rem .65rem; }
  .inventory-row > :nth-child(3) { grid-column: 1; grid-row: 2; }
  .inventory-row > :last-child { grid-column: 3; grid-row: 1 / span 2; }
  .inventory-price del { display: block; }
  .display-grid { grid-template-columns: 1fr; }
}
@media (orientation: portrait) {
  .attraction { grid-template-columns: 1fr; grid-template-rows: minmax(360px, 56svh) minmax(220px, 44svh); }
  .poster { min-height: 0; }
  .slide-copy h1 { font-size: clamp(3.5rem, 13vw, 8rem); }
  .slide-copy p { font-size: clamp(1rem, 3.8vw, 2.4rem); }
}
@media (orientation: portrait) and (max-width: 600px) {
  .price-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation: none !important; transition: none !important; }
}

.custom-frame { display: block; width: 100%; min-height: 100svh; border: 0; background: var(--cream); }
.studio-top-actions, .studio-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.studio-layout { display: grid; grid-template-columns: minmax(200px, .38fr) minmax(0, 1fr); gap: 1.15rem; }
.studio-layout aside { display: grid; align-content: start; gap: .65rem; }
.studio-sign-list { display: grid; gap: .4rem; }
.studio-sign { display: grid; gap: .3rem; width: 100%; text-align: left; min-height: 58px; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--paper); color: var(--ink); }
.studio-sign[aria-current] { border-color: var(--green); background: #e7eee4; }
.studio-sign small, .studio-version small { color: var(--muted); display: block; font-size: .82rem; margin-top: .15rem; }
.studio-register-link { margin-top: 1rem; }
.studio-detail { min-width: 0; }
.studio-detail-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; margin: .15rem 0 .8rem; }
.studio-detail-heading h2 { font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -.06em; line-height: .98; }
.studio-panel { border: 1px solid var(--line); background: var(--paper); padding: 1rem; border-radius: .75rem; margin-bottom: .8rem; }
.studio-panel h3 { font: 500 1.4rem var(--serif); margin-bottom: .55rem; }
.studio-version, .studio-publishers > div, .studio-row-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.studio-version:last-child, .studio-publishers > div:last-child { border-bottom: 0; }
label.studio-upload { position: relative; cursor: pointer; }
.studio-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.studio-upload:focus-within { outline: 2px solid var(--green); }
.studio-panel textarea { width: 100%; padding: .5rem .62rem; border: 1px solid #b9bbae; border-radius: .45rem; color: var(--ink); background: white; font: 1rem var(--sans); }
.studio-field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: .5rem; margin-top: .55rem; }
.studio-row { border-bottom: 1px solid var(--line); padding-bottom: .65rem; margin-bottom: .65rem; }
.studio-row-heading { border: 0; padding-block: 0; }
.studio-panel .checkbox small, .studio-panel label small { color: var(--muted); font-weight: 500; }
#studio-status { margin-bottom: .65rem; color: var(--ink); background: #e7eee4; padding: .55rem .75rem; border-radius: .4rem; }
@media (max-width: 760px) {
  .studio-layout { grid-template-columns: 1fr; gap: .85rem; }
  .studio-sign-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
}
