:root {
  color-scheme: dark;
  --tg-stable-viewport-height: 100vh;
  --tg-safe-area-top: env(safe-area-inset-top, 0px);
  --tg-content-safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --bg: #07090d;
  --panel: rgba(19, 24, 32, 0.92);
  --panel-strong: rgba(26, 32, 43, 0.96);
  --ink: #f6f2e9;
  --muted: #a7adbb;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #f2b84b;
  --accent-ink: #1a1306;
  --blue: #5e9cff;
  --green: #39d49a;
  --red: #ff6473;
  --warning: #ffd166;
  --shadow: 0 22px 52px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  scrollbar-width: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body {
  min-height: var(--tg-stable-viewport-height);
  max-width: 100vw;
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 0%, rgba(242, 184, 75, 0.2), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(94, 156, 255, 0.16), transparent 30%),
    linear-gradient(180deg, #090b10 0%, #10141c 48%, #07090d 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  transition: transform 0.16s ease, opacity 0.16s ease, filter 0.16s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

input {
  width: 100%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px 15px;
  outline: none;
}

input::placeholder {
  color: rgba(246, 242, 233, 0.42);
}

input:focus {
  border-color: rgba(242, 184, 75, 0.48);
  box-shadow: 0 0 0 4px rgba(242, 184, 75, 0.12);
}

code {
  color: var(--accent);
}

.hidden {
  display: none !important;
}

.lot17-shell {
  width: min(780px, 100%);
  max-width: 100%;
  min-height: var(--tg-stable-viewport-height);
  margin: 0 auto;
  padding:
    calc(16px + var(--tg-safe-area-top))
    max(10px, var(--tg-content-safe-area-right))
    calc(24px + var(--tg-content-safe-area-bottom))
    max(10px, var(--tg-content-safe-area-left));
  display: grid;
  gap: 14px;
  overflow-x: hidden;
}

.lot17-header,
.lot17-system-panel,
.lot17-card,
.lot17-tab-panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  box-shadow: var(--shadow);
}

.lot17-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  width: 100%;
  max-width: 100%;
}

.lot17-brand {
  display: flex;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.lot17-brand > div {
  min-width: 0;
}

.lot17-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #ffe2a3);
  color: var(--accent-ink);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.lot17-eyebrow {
  width: max-content;
  max-width: 100%;
  margin-bottom: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(242, 184, 75, 0.12);
  border: 1px solid rgba(242, 184, 75, 0.24);
  font-size: 12px;
  font-weight: 800;
}

.lot17-header h1,
.lot17-section-head h2,
.auction-list-card h3,
.auction-section-card h3 {
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.lot17-header h1 {
  font-size: clamp(28px, 8vw, 42px);
  line-height: 0.95;
}

.lot17-header p,
.lot17-section-head p,
.auction-list-card p,
.auction-section-card p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.lot17-header-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 0;
}

.auction-session-chip {
  width: fit-content;
  max-width: 240px;
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.auction-session-chip.chip-accent {
  color: var(--accent);
  border-color: rgba(242, 184, 75, 0.3);
}

.auction-session-chip.chip-warning {
  color: var(--warning);
  border-color: rgba(255, 209, 102, 0.3);
}

.lot17-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  width: 100%;
  max-width: 100%;
}

.lot17-tab {
  min-height: 42px;
  min-width: 0;
  padding: 9px 6px;
  border-radius: 17px;
  color: var(--muted);
  background: transparent;
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 800;
  white-space: nowrap;
}

.lot17-tab.is-active {
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), #ffe2a3);
}

.lot17-system-panel,
.lot17-tab-panel,
.lot17-card,
.auction-section-card {
  padding: 16px;
}

.lot17-main,
.lot17-tab-panel,
.auction-section-stack {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 100%;
}

.lot17-tab-panel {
  display: none;
}

.lot17-tab-panel.is-active {
  display: grid;
}

.lot17-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  min-width: 0;
}

.lot17-debug-row,
.auction-bid-actions,
.auction-card-actions,
.auction-list-meta,
.auction-detail-meta,
.auction-result-meta,
.auction-post-meta,
.auction-wallet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lot17-debug-row {
  margin-top: 10px;
  align-items: end;
}

.control-field {
  display: grid;
  gap: 7px;
}

.field-label,
.auction-stat-label,
.auction-kv-row dt {
  color: var(--muted);
  font-size: 13px;
}

.auction-kv-row dt {
  flex: 0 0 clamp(112px, 34vw, 150px);
  max-width: 46%;
  white-space: nowrap;
  overflow-wrap: normal;
}

.lot17-button,
.btn {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 16px;
  font-weight: 850;
  max-width: 100%;
  white-space: normal;
}

.lot17-button-primary,
.btn-primary {
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), #ffe2a3);
}

.lot17-button-secondary,
.btn-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.lot17-button-ghost,
.btn-ghost {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.banner {
  display: none;
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  color: var(--ink);
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.banner.visible {
  display: block;
}

.banner-info {
  background: rgba(94, 156, 255, 0.12);
  border-color: rgba(94, 156, 255, 0.25);
}

.banner-success {
  background: rgba(57, 212, 154, 0.12);
  border-color: rgba(57, 212, 154, 0.25);
}

.banner-warning {
  background: rgba(255, 209, 102, 0.12);
  border-color: rgba(255, 209, 102, 0.25);
}

.banner-error {
  background: rgba(255, 100, 115, 0.12);
  border-color: rgba(255, 100, 115, 0.28);
}

.auction-empty {
  padding: 18px;
  border-radius: 20px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#auction-wallet-card {
  min-width: 0;
  padding-bottom: 18px;
}

.auction-list,
.auction-history-list,
.auction-bid-form,
.auction-kv,
.auction-wallet-grid,
.auction-summary-grid {
  display: grid;
  gap: 12px;
}

.auction-list-card,
.auction-section-card,
.auction-stat,
.auction-history-item {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.045);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.auction-list-card {
  width: 100%;
  max-width: 100%;
  text-align: left;
  padding: 16px;
  color: var(--ink);
  overflow: hidden;
}

.auction-list-card.is-selected {
  border-color: rgba(242, 184, 75, 0.5);
  box-shadow: 0 0 0 4px rgba(242, 184, 75, 0.11);
}

.auction-section-card,
.auction-stat,
.auction-history-item {
  padding: 14px;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 27px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

.metric-pill.tone-accent {
  color: var(--accent);
  border-color: rgba(242, 184, 75, 0.28);
}

.metric-pill.tone-success {
  color: var(--green);
  border-color: rgba(57, 212, 154, 0.28);
}

.metric-pill.tone-warning {
  color: var(--warning);
  border-color: rgba(255, 209, 102, 0.28);
}

.auction-inline-note,
.auction-subtle,
.auction-history-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auction-stat-value {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.auction-history-result-action {
  min-height: 46px;
  padding: 11px 16px;
  border-color: rgba(242, 184, 75, 0.34);
  color: var(--accent);
  background: rgba(242, 184, 75, 0.1);
  box-shadow: inset 0 0 0 1px rgba(242, 184, 75, 0.08);
}

.auction-history-result-action:active {
  transform: translateY(1px);
}

.auction-history-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.auction-history-filter {
  min-width: 0;
  min-height: 44px;
  padding: 8px 7px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.auction-history-filter.is-active {
  color: #18221e;
  background: var(--accent);
  box-shadow: 0 6px 16px rgba(242, 184, 75, 0.17);
}

.auction-history-list-view,
.auction-previous-disputes {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.auction-history-card {
  position: relative;
  min-width: 0;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid rgba(255, 255, 255, 0.18);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.04);
}

.auction-history-card.needs-action {
  border-left-color: var(--accent);
}

.auction-history-card.has-open-dispute {
  border-left-color: var(--warning);
}

.auction-history-card.is-adjusted,
.auction-history-card.is-complete {
  border-left-color: var(--green);
}

.auction-history-card.is-loss {
  border-left-color: rgba(167, 173, 187, 0.62);
}

.auction-history-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.auction-history-card h3,
.auction-detail-section h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.auction-history-result,
.auction-history-status,
.auction-history-adjustment {
  margin: 5px 0 0;
  line-height: 1.4;
}

.auction-history-result,
.auction-detail-result {
  color: var(--ink);
  font-weight: 900;
}

.auction-history-status {
  color: var(--muted);
}

.auction-history-adjustment {
  color: var(--green);
  font-weight: 850;
}

.auction-history-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.auction-history-back {
  min-height: 44px;
  margin-bottom: 10px;
  padding: 8px 2px;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-weight: 850;
  text-align: left;
}

.auction-detail-section {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.04);
}

.auction-detail-summary {
  background: linear-gradient(145deg, rgba(242, 184, 75, 0.1), rgba(255, 255, 255, 0.035));
}

.auction-detail-eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auction-detail-result {
  margin: 6px 0 0;
  font-size: 18px;
}

.auction-current-dispute {
  border-color: rgba(255, 209, 102, 0.38);
  background: rgba(255, 209, 102, 0.06);
}

.auction-final-resolution {
  border-color: rgba(57, 212, 154, 0.35);
}

.auction-detail-section .auction-card-actions [data-dispute-show-form] {
  border-color: rgba(255, 209, 102, 0.46);
  color: var(--warning);
  background: rgba(255, 209, 102, 0.09);
}

.auction-history-details {
  min-width: 0;
}

.auction-history-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  gap: 10px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 850;
  list-style: none;
}

.auction-history-details > summary::-webkit-details-marker {
  display: none;
}

.auction-details-icon {
  flex: none;
  transition: transform 0.16s ease;
}

.auction-history-details[open] .auction-details-icon {
  transform: rotate(180deg);
}

.auction-previous-dispute-card {
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.auction-previous-dispute-card dl {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
}

.auction-previous-dispute-card dl > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.auction-previous-dispute-card dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.auction-previous-dispute-card dd {
  min-width: 0;
  margin: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.auction-kv-row-stacked {
  display: grid;
  gap: 5px;
}

.auction-kv-row-stacked dd {
  text-align: left;
  white-space: pre-wrap;
}

.auction-kv-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  min-width: 0;
}

.auction-kv-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.auction-kv-row dd {
  flex: 1 1 auto;
  margin: 0;
  text-align: right;
  color: var(--ink);
  font-weight: 800;
  min-width: 0;
  overflow-wrap: anywhere;
}

.auction-kv-row dd.auction-kv-value-compact {
  flex: 0 0 auto;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.auction-history-item.is-current-highest {
  border-color: rgba(242, 184, 75, 0.46);
}

.auction-history-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.lot17-ui-debug-panel {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 999999;
  max-height: min(46vh, 360px);
  overflow: auto;
  padding: 10px;
  border: 2px solid #39d49a;
  border-radius: 14px;
  background: rgba(3, 8, 12, 0.94);
  color: #f6f2e9;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 11px;
  line-height: 1.35;
  pointer-events: auto;
}

.lot17-ui-debug-panel-title {
  margin-bottom: 8px;
  color: #39d49a;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lot17-ui-debug-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.6fr) minmax(0, 1.4fr);
  gap: 8px;
  padding: 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.lot17-ui-debug-row span {
  color: #a7adbb;
}

.lot17-ui-debug-row strong {
  color: #f6f2e9;
  font-weight: 700;
  overflow-wrap: anywhere;
}

body.lot17-ui-debug .lot17-shell,
body.lot17-ui-debug .lot17-main,
body.lot17-ui-debug .auction-list,
body.lot17-ui-debug .auction-list-card,
body.lot17-ui-debug .auction-card-actions,
body.lot17-ui-debug #auction-bid-form {
  outline: 1px dashed rgba(94, 156, 255, 0.72);
  outline-offset: 2px;
}

body.lot17-ui-debug [data-action],
body.lot17-ui-debug [data-lot17-tab],
body.lot17-ui-debug [data-dispute-show-form],
body.lot17-ui-debug [data-dispute-submit],
body.lot17-ui-debug [data-dispute-cancel],
body.lot17-ui-debug [data-delivery-confirm] {
  outline: 2px solid rgba(57, 212, 154, 0.86);
  outline-offset: 3px;
}

.auction-dispute-form {
  display: grid;
  gap: 12px;
  width: 100%;
}

.auction-dispute-form fieldset {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.auction-dispute-form legend {
  font-weight: 700;
}

.auction-dispute-reasons,
.auction-field-stack {
  display: grid;
  gap: 8px;
}

.auction-dispute-reason {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-height: 52px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.auction-dispute-reason input[type="radio"] {
  width: 20px;
  min-width: 20px;
  height: 20px;
  margin: 1px 0 0;
  padding: 0;
  border-radius: 50%;
  accent-color: var(--accent);
}

.auction-dispute-reason span {
  min-width: 0;
  line-height: 1.45;
  overflow-wrap: normal;
  word-break: normal;
}

.auction-dispute-reason:focus-within {
  border-color: rgba(242, 184, 75, 0.62);
  box-shadow: 0 0 0 3px rgba(242, 184, 75, 0.12);
}

.auction-dispute-reason:has(input:checked) {
  border-color: rgba(242, 184, 75, 0.72);
  background: rgba(242, 184, 75, 0.1);
}

.auction-field-stack textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  resize: vertical;
}

@media (max-width: 680px) {
  .lot17-shell {
    padding:
      calc(12px + var(--tg-safe-area-top))
      max(10px, var(--tg-content-safe-area-right))
      calc(18px + var(--tg-content-safe-area-bottom))
      max(10px, var(--tg-content-safe-area-left));
    gap: 12px;
  }

  .lot17-header,
  .lot17-system-panel,
  .lot17-card,
  .lot17-tab-panel {
    border-radius: 22px;
  }

  .lot17-header {
    display: grid;
    padding: 14px;
  }

  .lot17-mark {
    width: 42px;
    height: 42px;
    border-radius: 15px;
  }

  .lot17-header-actions {
    justify-items: stretch;
    width: 100%;
  }

  .auction-session-chip {
    width: 100%;
    max-width: none;
  }

  .lot17-system-panel,
  .lot17-tab-panel,
  .lot17-card,
  .auction-section-card {
    padding: 14px;
  }

  .auction-list-card {
    padding: 14px;
  }

  .auction-list-meta,
  .auction-detail-meta,
  .auction-result-meta,
  .auction-post-meta,
  .auction-wallet-meta {
    gap: 6px;
  }
}

@media (max-width: 390px) {
  .lot17-shell {
    padding-left: max(8px, var(--tg-content-safe-area-left));
    padding-right: max(8px, var(--tg-content-safe-area-right));
  }

  .lot17-brand {
    gap: 10px;
    width: 100%;
  }

  .lot17-header h1 {
    font-size: clamp(25px, 8vw, 32px);
  }

  .lot17-header p {
    max-width: 20ch;
    font-size: 13px;
  }

  .lot17-tab {
    min-height: 40px;
    padding-left: 2px;
    padding-right: 2px;
    font-size: 12px;
  }

  .lot17-tabs {
    gap: 4px;
    padding: 4px;
  }

  .metric-pill {
    font-size: 11px;
  }

  .auction-history-filter {
    padding-inline: 4px;
    font-size: 11px;
  }

  .auction-history-card-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .auction-history-card-head .metric-pill {
    justify-self: start;
  }

  .auction-kv-row {
    display: grid;
    grid-template-columns: minmax(112px, 0.4fr) minmax(0, 1fr);
    align-items: start;
    gap: 8px;
  }

  .auction-kv-row dt {
    max-width: none;
  }

  .auction-kv-row dd {
    text-align: right;
  }
}

@media (min-width: 720px) {
  .auction-wallet-grid,
  .auction-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
