.market-header { background: var(--bg); border-bottom: 1px solid var(--line); }
.market-nav { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: .86rem; font-weight: 700; }
.market-nav a:hover { color: var(--accent-deep); }
.marketplace { max-width: 1060px; }
.market-hero { padding-block: clamp(28px, 5vw, 54px) 24px; }
.market-hero h1 { font-size: clamp(2.2rem, 5vw, 4rem); letter-spacing: -.05em; font-weight: 650; text-wrap: balance; }
.market-hero p { margin-top: 10px; max-width: 64ch; color: var(--ink-2); font-size: 1rem; }

.market-shell { display: grid; gap: 14px; }
.market-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: fit-content; max-width: 100%; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; }
.market-tabs button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 6px 16px; border: 1px solid transparent; border-radius: 12px; background: transparent; font-weight: 750; font-size: .84rem; cursor: pointer; }
.market-tabs button[aria-current] { background: var(--bg-2); border-color: var(--line); box-shadow: 0 2px 4px rgb(50 36 25 / 6%); }
.market-tabs button:hover:not([aria-current]) { background: #e9e1d9; }
.market-pane, .market-form-details { display: grid; gap: 14px; min-width: 0; }
.market-form { grid-template-columns: minmax(312px, 368px) minmax(0, 1fr); align-items: start; }
.market-pane[hidden], .market-error[hidden] { display: none; }
.market-section { display: grid; gap: 14px; min-width: 0; padding: clamp(14px, 2vw, 22px); background: var(--bg); border: 1px solid #eae3dc; border-radius: 20px; box-shadow: 0 2px 5px rgb(50 36 25 / 3%); }
.market-section h2, .market-guide h2 { font-size: 1.18rem; font-weight: 800; line-height: 1.2; letter-spacing: -.035em; }
.market-date-section { justify-items: start; }

.market-calendar { width: 100%; max-width: 324px; }
.market-calendar-head { display: flex; align-items: center; gap: 5px; margin-bottom: 8px; }
.market-calendar-head strong { margin-right: auto; font-size: 1rem; font-weight: 800; }
.market-calendar-head button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: #f4efea; font-size: 1.2rem; cursor: pointer; }
.market-calendar-head button:hover:not(:disabled) { background: #ebe2da; }
.market-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); justify-items: center; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; }
.market-week abbr { padding-block: 5px; color: var(--ink-2); font-size: .65rem; font-weight: 800; letter-spacing: .035em; text-decoration: none; text-transform: uppercase; }
.market-week button { width: min(100%, 44px); min-height: 40px; padding: 0; border: 0; border-radius: 11px; background: transparent; font-size: .87rem; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; }
.market-week button:hover:not(:disabled), .market-week button[aria-current="date"] { background: #f5ece5; }
.market-week button[aria-pressed="true"], .market-week button[aria-pressed="true"]:hover { background: var(--dark); color: #fff; }
.market-shell button:disabled { cursor: default; opacity: .5; }
.market-date { color: var(--ink-2); font-size: .83rem; font-weight: 750; }
.market-calendar-picker { width: fit-content; max-width: 100%; padding: 9px 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; }
.market-calendar-picker[open] { width: 100%; max-width: 352px; }
.market-calendar-picker summary { font-size: .9rem; font-weight: 750; cursor: pointer; }
.market-calendar-picker .market-calendar { margin-top: 10px; }

.market-options { display: grid; gap: 7px; width: 100%; }
.market-switch, .market-service { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 46px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: .91rem; font-weight: 750; cursor: pointer; }
.market-service { background: var(--bg); }
.market-service:hover { border-color: #c8b5a9; }
.market-service:has(input:checked) { background: #faf0ea; border-color: #d7a893; }
.market-service small { display: block; margin-top: 3px; color: var(--ink-2); font-size: .82rem; font-weight: 500; overflow-wrap: anywhere; }
.market-service input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--dark); cursor: pointer; }
.market-switch input { appearance: none; flex: 0 0 40px; width: 40px; height: 24px; margin: 0; position: relative; border-radius: 100px; background: #78716d; cursor: pointer; }
.market-switch input::before { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 100%; background: #fff; transition: transform 150ms ease; }
.market-switch input:checked { background: var(--dark); }
.market-switch input:checked::before { transform: translateX(16px); }

.market-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.market-fields label, .market-field { display: grid; gap: 5px; font-size: .87rem; font-weight: 750; }
.market-fields input, .market-field input { width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; border: 1px solid #e5dfda; border-radius: 11px; background: var(--bg); font-size: 1rem; }
.market-section .btn { justify-self: start; max-width: 100%; white-space: normal; }
.market-form button[type="submit"] { width: 100%; min-height: 46px; border-radius: 12px; }
.market-message, .market-error { font-size: .88rem; }
.market-message { color: var(--ink-2); }
.market-error { color: #943529; font-weight: 750; }

.market-list { display: grid; gap: 10px; }
.market-list > .btn { justify-self: start; }
.market-item { display: grid; gap: 7px; min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.market-item h3, .market-item h4 { color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
.market-item h3 { font-size: 1rem; }
.market-item ul { list-style: disc; padding-left: 18px; }
.market-item p, .market-item li { color: var(--ink-2); font-size: .88rem; overflow-wrap: anywhere; }
.market-item p { white-space: pre-line; }
.market-studio-heading { display: flex; gap: 10px; align-items: center; }
.market-studio-heading img { width: 40px; height: 40px; object-fit: contain; border-radius: 9px; }
.market-offer-top { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.market-offer-state { padding: 3px 8px; border-radius: 100px; background: #f0eae4; color: var(--ink-2); font-size: .75rem; font-weight: 750; }
.market-offer-state[data-status="accepted"] { background: #e7f2e9; color: #235637; }
.market-offer-amount { font-size: 1.23rem; }

.market-guide { padding-block: clamp(32px, 6vw, 64px); }
.market-guide ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 14px; }
.market-guide li { border-top: 1px solid #e5dfda; padding-top: 10px; }
.market-guide h3 { font-size: .95rem; }
.market-guide p { color: var(--ink-2); font-size: .88rem; margin-top: 4px; }

@media (max-width: 740px) {
  .market-form, .market-guide ol { grid-template-columns: 1fr; }
  .market-date-section { justify-items: center; }
  .market-date-section > h2 { justify-self: start; }
  .market-date-section > .market-options { max-width: 324px; }
}

@media (max-width: 420px) {
  .market-tabs { width: 100%; }
  .market-tabs button { gap: 4px; padding-inline: 4px; }
  .market-tabs .ic { width: .9em; height: .9em; }
  .market-fields { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .market-switch input::before { transition: none; }
}
.market-message a { text-decoration: underline; text-underline-offset: 3px; }
