/* Haggle Market (w047) */
.hm { display: grid; gap: .75rem; }
.hm > * { min-width: 0; }
.hm .hm-note:empty, .hm .kit-status:empty, .hm .hm-turn:empty, .hm .hm-hint:empty { display: none; }

.hm-modes { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; padding: .25rem; border: 1px solid var(--border); border-radius: .8rem; background: #0c1220; }
.hm-modes button { border: 0; background: transparent; }
.hm-modes button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.hm-stall { display: grid; gap: .5rem; padding: .75rem; border: 1px solid var(--border); border-radius: 1rem; background: #0c1220; }
.hm-title { margin: 0; color: var(--muted); font-size: .95rem; font-weight: 700; line-height: 1.3; }
.hm-title:focus { outline: none; }
.hm-title:focus-visible { outline: 3px solid #ffd36e; outline-offset: 2px; }
.hm-seller { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .6rem; }
.hm-icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--card); font-size: 1.4rem; }
.hm-who { margin: 0; line-height: 1.3; }
.hm-who strong { font-size: 1.1rem; }
.hm-kind { color: var(--accent); font-weight: 700; }
.hm-kind::before { content: '· '; color: var(--muted); }
.hm-hint { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.35; }
.hm-mood { display: flex; flex-direction: column; align-items: center; margin: 0; padding: .2rem .5rem; border: 2px solid var(--border); border-radius: .7rem; font-size: .8rem; font-weight: 700; line-height: 1.2; text-align: center; }
.hm-mood #mood-face { font-size: 1.5rem; line-height: 1.1; }
/* Color supports the face and the word; it is never the only signal. */
.hm .hm-mood[data-mood="happy"] { border-color: #69db7c; }
.hm .hm-mood[data-mood="content"] { border-color: var(--accent); }
.hm .hm-mood[data-mood="unsure"] { border-color: #ffd43b; }
.hm .hm-mood[data-mood="annoyed"] { border-color: var(--danger); border-style: dashed; }

.hm-item { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .6rem; padding: .45rem .6rem; border-radius: .75rem; background: var(--card); }
.hm-item-emoji { font-size: 1.8rem; line-height: 1; }
.hm-item-name { flex: 1 1 auto; font-weight: 700; overflow-wrap: normal; word-break: normal; }
.hm-prices { display: grid; justify-items: end; margin-inline-start: auto; text-align: end; line-height: 1.25; }
.hm-list { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.hm-ask { font-weight: 800; white-space: nowrap; }
.hm-ask bdi { color: var(--accent); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.hm-list bdi { font-variant-numeric: tabular-nums; }

.hm-say { display: grid; gap: .2rem; padding: .55rem .75rem; border-radius: .75rem; border-end-start-radius: .2rem; background: #1c2a40; }
.hm-say p { margin: 0; }
.hm-you { color: var(--muted); font-size: .9rem; }
.hm-speech { font-weight: 600; }

.hm-play { display: grid; gap: .5rem; }
.hm-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .3rem; }
.hm-card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; min-width: 0; min-height: 52px; padding: .3rem .15rem; line-height: 1.1; }
.hm-card-icon { font-size: 1.3rem; line-height: 1; }
.hm-card-label { font-size: .78rem; font-weight: 700; text-align: center; overflow-wrap: normal; word-break: keep-all; hyphens: manual; }
.hm-card-used { display: none; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.hm .hm-card[aria-pressed="true"] { border: 2px solid #ffd36e; background: #3a3214; }
.hm .hm-card.used { opacity: .55; border-style: dashed; }
.hm .hm-card.used .hm-card-label { text-decoration: line-through; }
.hm .hm-card.used .hm-card-used { display: block; }
.hm .hm-card.used .hm-card-icon { filter: grayscale(1); }
.hm-note { margin: 0; color: var(--muted); font-size: .9rem; }
.hm .hm-error { color: var(--danger); }

.hm-offer { display: grid; grid-template-columns: 44px minmax(4rem, 1fr) 44px minmax(0, auto); gap: .3rem; align-items: stretch; }
.hm-step { padding: 0; font-size: 1.4rem; line-height: 1; }
.hm-field { position: relative; display: block; }
.hm-coin { position: absolute; inset-inline-start: .55rem; top: 50%; transform: translateY(-50%); font-size: 1rem; pointer-events: none; }
.hm-field input { height: 100%; padding-inline-start: 2rem !important; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.hm-send { min-height: 48px; max-width: 11rem; padding-inline: .7rem; line-height: 1.2; overflow-wrap: normal; }
#offer-range { margin: 0; }
.hm-accept-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.hm-turn { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.hm-accept { margin-inline-start: auto; }

.hm-final { display: grid; gap: .6rem; padding: .85rem; border: 2px solid #ffd36e; border-radius: 1rem; background: #2a2414; }
.hm-final-title { margin: 0; font-size: 1.2rem; font-weight: 800; }
.hm-final-title:focus { outline: none; }
.hm-final-title:focus-visible { outline: 3px solid #ffd36e; outline-offset: 2px; }

.hm-result { display: grid; gap: .6rem; padding: 1rem; border: 2px solid var(--accent); border-radius: 1rem; background: #13231f; text-align: center; }
.hm-result[data-deal="false"] { border-color: var(--danger); background: #2a1a1d; }
.hm-result h2 { margin: 0; font-size: clamp(1.2rem, 5vw, 1.6rem); line-height: 1.3; }
.hm-result h2:focus { outline: none; }
.hm-result h2:focus-visible { outline: 3px solid #ffd36e; outline-offset: 2px; }
.hm-stars { margin: 0; font-size: 1.8rem; letter-spacing: .1em; }
.hm-result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: 0; }
.hm-result-grid div { padding: .45rem .3rem; border-radius: .6rem; background: #0c1220; }
.hm-result-grid dt { color: var(--muted); font-size: .8rem; line-height: 1.25; }
.hm-result-grid dd { margin: .15rem 0 0; font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hm-result-actions { justify-content: center; }
.hm-result-actions button { min-height: 48px; }

.hm-fold { border: 1px solid var(--border); border-radius: .85rem; background: #0c1220; }
.hm-fold summary { display: flex; align-items: center; min-height: 48px; padding: .5rem 1rem; cursor: pointer; font-weight: 700; }
.hm-fold-body { display: grid; gap: .6rem; padding: 0 1rem 1rem; }
.hm-fold-body p { margin: 0; }
.hm-card-list { display: grid; gap: .35rem; margin: 0; padding-inline-start: 1.2rem; }
.hm-log { display: grid; gap: .45rem; margin: 0; padding: 0 1rem 1rem 2.4rem; }
.hm-log li { display: grid; gap: .1rem; }
.hm-log-you { color: var(--muted); font-size: .9rem; }

.hm-stats { display: grid; gap: .5rem; padding: 1rem; border: 1px solid var(--border); border-radius: .85rem; }
.hm-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: 0; text-align: center; }
.hm-stat-grid dt { color: var(--muted); font-size: .85rem; line-height: 1.25; }
.hm-stat-grid dd { margin: 0; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.hm-footer-actions { justify-content: flex-end; }

@media (max-width: 480px) {
  .hm-stall { padding: .6rem; }
  .hm-result-grid, .hm-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-field input { padding-inline-end: .3rem !important; }
  .hm-coin { inset-inline-start: .4rem; }
}
@media (min-width: 640px) {
  .hm-offer { grid-template-columns: 44px minmax(6rem, 10rem) 44px auto; justify-content: start; }
  .hm-send { max-width: none; }
  .hm-card { flex-direction: row; gap: .4rem; }
  .hm-card-label { font-size: .9rem; }
  .hm-card.used { flex-wrap: wrap; }
}
