/* ==========================================================================
   Car auction (auction branch) — ui/AuctionScreen.js. #app.auction-mode
   hides the shop HUD; #auction holds the top bar, the panel (bottom card on
   desktop, bottom sheet in phone portrait, right side panel in phone
   landscape — data-layout), the tutorial banner and the speech bubbles.
   ========================================================================== */
#auction { display: none; pointer-events: none; z-index: 55; font-family: var(--font-body); color: var(--ink); }
#app.auction-mode #auction { display: block; }
#app.auction-mode #hud, #app.auction-mode #notify, #app.auction-mode #coach, #app.auction-mode #world-labels,
#app.auction-mode #world-ui, #app.auction-mode #joystick { display: none !important; }
#auction .b3 { pointer-events: auto; }
#auction .i { width: 1em; height: 1em; fill: currentColor; flex: none; }

/* top bar */
.auc-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px;
  padding: calc(var(--sa-t) + 8px) calc(var(--sa-r) + 12px) 8px calc(var(--sa-l) + 12px);
  background: linear-gradient(180deg, rgba(18,23,29,.92), rgba(18,23,29,.72)); color: #fff; pointer-events: auto;
  border-bottom: 3px solid var(--outline); }
.auc-top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -7px; height: 4px; background: var(--stripe); background-size: 34px 34px; opacity: .85; }
.auc-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 24px; letter-spacing: .5px; color: var(--hz-yellow); white-space: nowrap; }
.auc-title .i { width: 28px; height: 28px; }
.auc-title small { font-family: var(--font-body); font-size: 14px; color: #c9d3dc; font-weight: 700; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; }
.auc-cash, .auc-insp { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 6px; border-radius: 999px; background: var(--steel-800);
  border: 2px solid var(--outline); font-family: var(--font-display); font-size: 20px; }
.auc-cash .i, .auc-insp .i { width: 28px; height: 28px; }
.auc-insp .i { fill: #8fd0ff; }

/* panel */
.auc-panel { position: absolute; pointer-events: auto; background: var(--paper); border: var(--bw) solid var(--outline);
  box-shadow: 0 -4px 0 rgba(0,0,0,.18), 0 10px 30px rgba(0,0,0,.35); overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
#auction[data-layout="desktop"] .auc-panel { left: 50%; bottom: calc(var(--sa-b) + 14px); transform: translateX(-50%);
  width: min(980px, calc(100vw - 28px)); max-height: 47vh; border-radius: var(--r-lg); }
#auction[data-layout="portrait"] .auc-panel { left: 0; right: 0; bottom: 0; max-height: 56vh; border-radius: 22px 22px 0 0;
  border-bottom: 0; padding-bottom: calc(var(--sa-b) + 12px); }
#auction[data-layout="land"] .auc-panel { right: 0; top: calc(var(--sa-t) + 60px); bottom: 0; width: min(420px, 48vw);
  border-radius: 18px 0 0 0; border-right: 0; padding-right: calc(var(--sa-r) + 12px); padding-bottom: calc(var(--sa-b) + 10px); gap: 7px; }
.auc-h2 { font-family: var(--font-display); font-size: 22px; line-height: 1.1; }
.auc-h2 span { display: block; font-family: var(--font-body); font-size: 14px; font-weight: 700; color: var(--ink-2); margin-top: 2px; }
.auc-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.auc-actions .b3.big { flex: 1; min-width: 220px; white-space: nowrap; }
#auction[data-layout="portrait"] .auc-actions { flex-wrap: nowrap; }
#auction[data-layout="portrait"] .auc-actions .b3.big { min-width: 0; font-size: clamp(15px, 4.6vw, 22px); padding-left: 10px; padding-right: 10px; }
#auction[data-layout="portrait"] .auc-actions .b3.ghost { flex: none; }
.auc-actions .b3.ghost .i { transform: rotate(180deg); }

/* car cards (preview) */
.ac-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
#auction[data-layout="portrait"] .ac-list, #auction[data-layout="land"] .ac-list { grid-template-columns: 1fr 1fr; }
.ac-card { background: var(--card); border: 2px solid var(--outline); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 6px;
  box-shadow: 0 3px 0 var(--paper-line); min-width: 0; }
.ac-h { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ac-ic { width: 30px; height: 30px; flex: none; border-radius: 9px; background: var(--steel-900); display: grid; place-items: center; color: var(--hz-yellow); }
.ac-ic .i { width: 22px; height: 22px; fill: var(--hz-yellow); }
.ac-n { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.1; }
.ac-n b { font-family: var(--font-display); font-weight: 400; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cond { align-self: flex-start; font-size: 12px; font-weight: 800; color: #fff; background: var(--cc); padding: 1px 7px; border-radius: 999px; border: 1.5px solid var(--outline); margin-top: 2px; }
.lot { flex: none; font-family: var(--font-display); font-size: 12px; color: var(--ink-2); background: var(--paper-2); border-radius: 6px; padding: 2px 6px; }
.ac-guide { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.ac-guide b, .rd-info b { color: var(--ink); font-family: var(--font-display); font-weight: 400; font-size: 16px; }
.ac-parts { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.ac-parts .i { width: 16px; height: 16px; }
.ac-card .b3.sm { min-height: 40px; font-size: 16px; padding: 0 10px; border-radius: 12px; }
.ac-insp { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; font-weight: 700; line-height: 1.25; padding: 6px 7px; border-radius: 10px;
  background: #eef3f6; border: 2px solid #c6d3dc; }
.ac-insp .i { width: 18px; height: 18px; margin-top: 1px; fill: var(--steel-700); }
.ac-insp.good { background: #e8fbe9; border-color: var(--buy); } .ac-insp.good .i { fill: #E5A800; }
.ac-insp.bad { background: #fdecea; border-color: var(--danger); } .ac-insp.bad .i { fill: var(--danger); }
.ac-insp b { font-family: var(--font-display); font-weight: 400; font-size: 15px; }

/* round */
.rd-top { display: flex; align-items: center; gap: 10px; }
.rd-top .ac-h { flex: 1; }
.rd-of { font-family: var(--font-display); font-size: 16px; color: var(--ink-2); }
.rd-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.rd-info .ac-insp { flex: 1; min-width: 200px; }
.rd-info .ni { font-size: 13px; color: var(--ink-2); opacity: .8; font-style: italic; }
.rd-bid { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 12px;
  background: var(--steel-900); color: #fff; border-radius: 14px; border: 2px solid var(--outline); padding: 6px 12px; }
.rd-bid .k { font-family: var(--font-display); font-size: 13px; color: #c9d3dc; letter-spacing: .6px; }
.rd-bid .v { grid-row: span 2; justify-self: end; font-family: var(--font-display); font-size: 40px; line-height: 1; color: var(--hz-yellow); }
.rd-bid .v.flash { animation: aucFlash .45s ease-out; }
@keyframes aucFlash { 0% { transform: scale(1.22); color: #fff; } 100% { transform: scale(1); } }
.rd-bid .who { font-size: 14px; font-weight: 700; color: #dfe6ec; }
.rd-bid .who .you { color: var(--buy-lt); font-family: var(--font-display); font-weight: 400; font-size: 17px; }
.rd-clock { display: flex; align-items: center; gap: 10px; }
.rd-clock .bar { flex: 1; height: 12px; border-radius: 6px; background: var(--paper-2); border: 2px solid var(--outline); overflow: hidden; }
.rd-clock .bar i { display: block; height: 100%; width: 100%; transform-origin: left center; transform: scaleX(0);
  background: linear-gradient(90deg, var(--buy), var(--hz-yellow) 60%, var(--danger)); }
.rd-clock .lbl { flex: none; min-width: 118px; text-align: center; font-family: var(--font-display); font-size: 17px; letter-spacing: .4px;
  border-radius: 8px; padding: 3px 8px; background: var(--paper-2); color: var(--ink-2); }
.rd-clock .lbl.ph1 { background: var(--hz-yellow); color: var(--hz-black); }
.rd-clock .lbl.ph2 { background: var(--hz-orange); color: #fff; }
.rd-clock .lbl.ph3 { background: var(--danger); color: #fff; }
.rv-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rv { border: 2px solid var(--outline); border-left: 7px solid var(--rc); border-radius: 10px; background: var(--card); padding: 4px 7px; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; transition: opacity .2s, transform .2s; }
.rv b { font-family: var(--font-display); font-weight: 400; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv .st { font-size: 11px; font-weight: 800; color: var(--ink-2); text-transform: uppercase; letter-spacing: .4px; }
.rv .s { font-size: 13px; font-weight: 800; }
.rv.lead { background: color-mix(in srgb, var(--rc) 18%, #fff); transform: translateY(-2px); }
.rv.lead .s { color: var(--rc); }
.rv.out { opacity: .5; }
.rd-btns { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.rd-btns .b3 { flex-direction: column; gap: 2px; min-height: 60px; padding: 0 10px; font-size: 19px; }
.rd-btns .b3 small { font-family: var(--font-body); font-weight: 800; font-size: 12px; opacity: .9; text-shadow: none; }
.rd-btns .b3.nocash { filter: grayscale(.7) brightness(.85); }
.rd-note { min-height: 18px; font-size: 14px; font-weight: 700; color: var(--ink-2); text-align: center; }
.rd-note.warn { color: var(--danger); }

/* results */
.rs-list { display: flex; flex-direction: column; gap: 8px; }
.rs-row { background: var(--card); border: 2px solid var(--outline); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.rs-n { font-size: 14px; font-weight: 700; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; }
.rs-n b { color: var(--ink); }
.rs-h { font-size: 13px; font-weight: 700; }
.rs-h .good { color: #1F8A2E; } .rs-h .bad { color: var(--danger); }
b.p { color: #1F8A2E !important; } b.m { color: var(--danger) !important; }
.rs-tot { font-size: 16px; font-weight: 700; text-align: center; }
.rs-lost { font-size: 13px; color: var(--ink-2); font-weight: 600; text-align: center; line-height: 1.4; }
.rs-empty { font-size: 15px; font-weight: 700; color: var(--ink-2); text-align: center; padding: 10px; }

/* tutorial banner (Coach look, own position) */
#auction .auc-tut { position: absolute; pointer-events: auto; left: 50%; transform: translateX(-50%); top: calc(var(--sa-t) + 70px);
  width: min(460px, calc(100vw - 24px)); background: var(--paper); border: var(--bw) solid var(--outline); border-radius: var(--r-md);
  box-shadow: 0 5px 0 var(--outline), 0 10px 22px rgba(10,14,20,.3); overflow: hidden; z-index: 3; }
#auction[data-layout="land"] .auc-tut { left: calc(var(--sa-l) + 12px); transform: none; width: min(400px, calc(52vw - 30px)); }

/* speech bubbles */
.auc-bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.auc-bub { position: absolute; left: 0; top: 0; max-width: 220px; padding: 5px 10px 6px; border-radius: 12px; background: #fff; border: 2px solid var(--outline);
  border-top: 5px solid var(--rc, var(--hz-yellow)); font-weight: 800; font-size: 14px; line-height: 1.2; text-align: center;
  box-shadow: 0 3px 0 var(--outline); opacity: 0; transition: opacity .18s; white-space: normal; width: max-content; }
.auc-bub i { display: block; font-style: normal; font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .4px; }
.auc-bub.on { opacity: 1; }
.auc-bub.host { background: var(--hz-yellow); font-family: var(--font-display); font-weight: 400; font-size: 16px; border-top-color: var(--outline); }
.auc-bub::after { content: ''; position: absolute; left: 50%; bottom: -9px; margin-left: -7px; border: 7px solid transparent; border-top-color: var(--outline); border-bottom: 0; }

/* phone tweaks */
#auction[data-layout="portrait"] .auc-title { font-size: 19px; }
#auction[data-layout="portrait"] .auc-title small { display: none; }
#auction[data-layout="portrait"] .rd-bid .v { font-size: 34px; }
#auction[data-layout="land"] .auc-top { padding-top: calc(var(--sa-t) + 5px); padding-bottom: 5px; }
#auction[data-layout="land"] .auc-title small { display: none; }
#auction[data-layout="land"] .rd-bid .v { font-size: 30px; }
#auction[data-layout="land"] .rd-btns .b3 { min-height: 52px; font-size: 17px; }
#auction[data-layout="land"] .rd-info .ac-insp { min-width: 0; }
#auction[data-layout="land"] .auc-h2 { font-size: 19px; }
.auc-sum-btn .i { width: 1.2em; height: 1.2em; }
.summary .auc-sum-btn { min-height: 54px; font-size: 21px; animation: aucPulse 1.6s ease-in-out infinite; }
.summary .auc-sum-note { font-size: 13px; font-weight: 700; color: var(--ink-2); text-align: center; margin: -2px 0 2px; }
@keyframes aucPulse { 0%, 100% { filter: none; } 50% { filter: brightness(1.15) saturate(1.2); } }
@media (prefers-reduced-motion: reduce) { .summary .auc-sum-btn { animation: none; } }
/* the primary action never scrolls out of a short panel */
.auc-panel .auc-actions { position: sticky; bottom: -14px; margin: 0 -14px -14px; padding: 8px 14px 14px; background: linear-gradient(180deg, rgba(255,244,220,0), var(--paper) 10px); z-index: 1; }
#auction[data-layout="portrait"] .auc-panel .auc-actions { bottom: calc(-12px - var(--sa-b)); padding-bottom: calc(12px + var(--sa-b)); margin-bottom: calc(-12px - var(--sa-b)); }
#auction[data-layout="land"] .auc-panel .auc-actions { bottom: calc(-10px - var(--sa-b)); padding-bottom: calc(10px + var(--sa-b)); margin-bottom: calc(-10px - var(--sa-b)); }
#auction[data-layout="portrait"] .auc-panel.ph-results { max-height: 74vh; }
/* landscape round: compact so the bid buttons fit without scrolling */
#auction[data-layout="land"] .ph-round .rv .st { display: none; }
#auction[data-layout="land"] .ph-round .rd-bid { padding: 3px 10px; }
#auction[data-layout="land"] .ph-round .rd-bid .v { font-size: 26px; }
#auction[data-layout="land"] .ph-round .rd-info { font-size: 12px; }
#auction[data-layout="land"] .ph-round .rd-info .ac-insp { padding: 3px 6px; font-size: 12px; }
#auction[data-layout="land"] .ph-round .rd-btns .b3 { min-height: 46px; }
#auction[data-layout="land"] .ph-round .rd-note { min-height: 0; }
#auction[data-layout="land"] .ph-round .rd-clock .bar { height: 10px; }
#auction[data-layout="land"] .ph-round .rd-clock .lbl { font-size: 15px; padding: 2px 6px; }
#auction[data-layout="land"] .ac-n b { font-size: 15px; }
