/**
 * [INPUT]: 依赖 lore-ui.css、account-detail.css 与账号页的轶闻、樗蒲、背包和自动化状态类，并引用 app-assets 的 A7 骰面素材
 * [OUTPUT]: 提供账号页紧凑业务组件、A7 樗蒲结果态、常显背包、响应式布局、指针反馈与无障碍降级
 * [POS]: public 模块的账号详情组件层，以连续信息行承接轶闻、樗蒲、背包和自动化状态
 * [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
 */

/* ── 每日轶闻 ──────────────────────────────────── */
.lore-quality {
  min-height: 25px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.lore-title {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.18;
  letter-spacing: 0;
  font-weight: 720;
}

.lore-rewards {
  margin-top: 9px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.reward-badge {
  min-height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 620;
}

.reward-badge.exp { color: var(--info); background: var(--info-soft); }
.reward-badge.gem { color: var(--warning); background: var(--warning-soft); }
.reward-badge.prop { background: var(--purple-soft); }

.lore-time {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.lore-desc {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.7;
}

/* ── 樗蒲 ──────────────────────────────────────── */
.gamble-section .section-header > div {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.gamble-prize {
  margin-bottom: 16px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  text-align: center;
}

.gamble-result-workbench {
  width: min(100%, 540px);
  margin-inline: auto;
}

.gamble-leaderboard {
  padding: 15px 0 16px;
  display: grid;
  gap: 11px;
  border-top: 1px solid #ececf2;
  border-bottom: 1px solid #ececf2;
}

.gamble-rank-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 43px minmax(98px, auto) minmax(0, 1fr) max-content;
  align-items: baseline;
  gap: 8px;
  color: #5f6370;
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.35;
}

.gamble-rank-title,
.gamble-rank-score,
.gamble-rank-reward {
  white-space: nowrap;
}

.gamble-rank-title {
  color: #a99024;
}

.gamble-rank-item.is-rank-2 .gamble-rank-title {
  color: #8f809f;
}

.gamble-rank-item.is-rank-3 .gamble-rank-title {
  color: #a57b5b;
}

.gamble-rank-score {
  color: #9e5a98;
}

.gamble-rank-name {
  min-width: 0;
  overflow: hidden;
  color: #343640;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gamble-rank-reward {
  color: #666a76;
  text-align: right;
}

.gamble-leaderboard-empty {
  padding: 8px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 14px;
  text-align: center;
}

.dice-row {
  width: min(100%, 390px);
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 10px;
}

.gamble-die {
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid #6c6c7c;
  border-radius: 45% 55% 48% 52% / 56% 46% 54% 44%;
  background: #fcfcff;
  transform: rotate(-5deg);
}

.gamble-die:nth-child(2) {
  border-radius: 54% 46% 52% 48% / 47% 56% 44% 53%;
  transform: rotate(5deg);
}

.gamble-die:nth-child(3) {
  border-radius: 48% 52% 56% 44% / 52% 45% 55% 48%;
  transform: rotate(-2deg);
}

.gamble-die:nth-child(4) {
  border-radius: 52% 48% 45% 55% / 46% 54% 50% 50%;
  transform: rotate(3deg);
}

.gamble-die:nth-child(5) {
  border-radius: 46% 54% 51% 49% / 55% 44% 56% 45%;
  transform: rotate(-6deg);
}

.gamble-die.is-dark {
  border-color: #08090d;
  background: #08090d;
}

.gamble-die img {
  width: 68%;
  height: 68%;
  display: block;
  object-fit: contain;
}

.gamble-die.is-dark img {
  filter: invert(1);
}

.gamble-score {
  margin-top: 17px;
  color: #a5a4ac;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  text-align: center;
}

.gamble-window-state {
  margin-top: 7px;
  color: #7a7d88;
  font-family: var(--font-display);
  font-size: 14px;
  text-align: center;
}

.gamble-placement {
  width: 100%;
  min-height: 50px;
  margin-top: 20px;
  display: grid;
  place-items: center;
  border: 1px solid #e4e4ea;
  border-radius: 6px;
  color: #73757f;
  background: transparent;
  font-family: var(--font-display);
  font-size: 17px;
  text-align: center;
}

.gamble-placement.btn {
  color: #fff;
}

.gamble-empty {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ── 典当与背包 ────────────────────────────────── */
.pawn-special-banner {
  margin-bottom: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(166, 107, 8, 0.15);
  border-radius: 5px;
  background: var(--warning-soft);
}

.pawn-banner-label {
  color: var(--warning);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.06em;
}

.pawn-banner-name {
  font-size: 13px;
  font-weight: 700;
}

.pawn-state-message {
  margin: 0 0 12px;
}

.pawn-inventory {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.pawn-inventory-header {
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.pawn-inventory-title {
  font-size: 13px;
  font-weight: 690;
}

.pawn-inventory-meta {
  color: var(--muted);
  font-size: 11px;
}

.backpack-message {
  margin: 0;
  padding: 6px 0;
}

.pawn-material-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}

.pawn-material-item {
  min-height: 54px;
  padding: 8px 9px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), transform 120ms var(--ease-out);
}

.pawn-material-item:active:not(.is-readonly) {
  transform: scale(0.975);
}

.pawn-material-item.selected {
  border-color: rgba(198, 77, 33, 0.48);
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.pawn-material-item.is-readonly {
  cursor: default;
}

.pawn-material-item.is-protected {
  background: #f1f1ef;
}

.pawn-mat-info {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.pawn-mat-name {
  font-size: 12px;
  font-weight: 680;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.pawn-mat-qty {
  width: fit-content;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.pawn-select-indicator {
  width: 18px;
  height: 18px;
  align-self: flex-end;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}

.pawn-material-item.selected .pawn-select-indicator {
  border-color: var(--accent);
  background: var(--accent);
  transform: scale(1.05);
}

.pawn-material-item.selected .pawn-select-indicator::after {
  content: "";
  width: 6px;
  height: 3px;
  display: block;
  margin: 5px 0 0 4px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg);
}

.pawn-item-state {
  width: fit-content;
  align-self: flex-end;
  padding: 2px 7px;
  color: var(--muted);
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.05);
  font-size: 11px;
  font-weight: 620;
}

/* ── 自动化设置 ────────────────────────────────── */
.auto-pawn-settings {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.auto-pawn-row {
  min-height: 48px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.auto-pawn-row + .auto-pawn-row {
  border-top: 1px solid var(--line);
}

.auto-pawn-label {
  color: var(--ink-2);
  font-size: 12px;
}

.readtime-copy {
  flex: 1;
  color: var(--ink-2);
  text-align: right;
}

.pawn-select {
  max-width: 190px;
  height: 44px;
  padding: 0 30px 0 10px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
}

.pawn-count-stepper {
  height: 44px;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

.stepper-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  transition: color 140ms var(--ease-out), background-color 140ms var(--ease-out), transform 100ms var(--ease-out);
}

.stepper-btn:active {
  transform: scale(0.9);
}

.stepper-value {
  width: 32px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.auto-pawn-summary {
  padding: 10px 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.55;
}

/* ── 精细指针反馈 ──────────────────────────────── */
@media (hover: hover) and (pointer: fine) {
  .mini-link:hover {
    color: var(--accent-strong);
    border-color: rgba(198, 77, 33, 0.3);
    background: #ffe8dd;
  }

  .pawn-material-item:hover:not(.is-readonly) {
    border-color: rgba(198, 77, 33, 0.35);
    background: var(--surface-muted);
  }

  .stepper-btn:hover {
    color: var(--accent);
    background: var(--accent-soft);
  }

  .disclosure summary:hover {
    background: rgba(29, 29, 31, 0.025);
  }
}

/* ── 响应式 ────────────────────────────────────── */
@media (max-width: 760px) {
  .container {
    max-width: 820px;
    grid-template-columns: 1fr;
  }

  .topbar,
  .user-header,
  .wish-section,
  .lore-section,
  .gamble-section,
  .pawn-section,
  .automation-section,
  .readtime-section {
    grid-column: 1;
    grid-row: auto;
  }

  .user-header {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .user-resources {
    width: 100%;
  }

  .user-identity {
    grid-template-columns: 1fr;
  }

  .user-identity .eyebrow,
  .user-name,
  .user-email,
  .remark-editor {
    grid-column: 1;
    grid-row: auto;
  }

  .remark-editor {
    margin-top: 10px;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14px;
  }

  .container {
    padding: 0 12px 48px;
    gap: 12px;
  }

  .topbar {
    top: 0;
    min-height: 56px;
    padding: 4px 2px;
    border-radius: 0;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-copy small,
  .topbar-link:not(.topbar-link-primary) {
    display: none;
  }

  .topbar-link {
    min-height: 44px;
    padding: 0 12px;
  }

  .user-header {
    min-height: 0;
    padding: 14px 0;
    gap: 14px;
    border-radius: 0;
  }

  .user-name {
    font-size: 26px;
  }

  .remark-editor {
    margin-top: 10px;
  }

  .user-resources {
    border-radius: 0;
  }

  .res-item {
    padding: 10px 8px;
  }

  .res-value {
    font-size: 22px;
  }

  .section-card {
    padding: 14px;
    border-radius: 8px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--surface-solid);
  }

  .section-header {
    margin-bottom: 10px;
    padding-bottom: 9px;
    align-items: flex-start;
  }

  .section-actions {
    max-width: 64%;
  }

  .wish-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .wish-summary-item {
    min-height: 62px;
  }

  .wish-auto-row {
    padding: 10px 0;
  }

  .wish-actions,
  .section-footer-split,
  .wish-stats-split {
    grid-template-columns: 1fr;
  }

  .gamble-rank-item {
    grid-template-columns: 40px minmax(92px, auto) minmax(0, 1fr) max-content;
    gap: 6px;
    font-size: 14px;
  }

  .dice-row {
    gap: 8px;
  }

  .disclosure summary small {
    display: none;
  }

  .disclosure-content {
    padding: 12px;
  }

  .pawn-inventory {
    padding: 0;
  }

  .pawn-material-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pawn-select {
    max-width: 165px;
  }

  .auto-pawn-row {
    padding: 10px 12px;
  }

  .toast {
    bottom: 16px;
  }
}

@media (max-width: 390px) {
  .topbar-link-primary {
    font-size: 12px;
  }

  .user-name {
    font-size: 24px;
  }

  .res-label {
    white-space: normal;
  }

  .section-header {
    gap: 8px;
  }

  .section-actions {
    max-width: 68%;
  }

  .toggle-label-sm {
    display: none;
  }

  .gamble-rank-item {
    grid-template-columns: 36px minmax(78px, auto) minmax(0, 1fr) max-content;
    gap: 5px;
    font-size: 13px;
  }

  .dice-row {
    gap: 6px;
  }

  .pawn-material-list {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── 无障碍偏好 ────────────────────────────────── */
@media (prefers-reduced-transparency: reduce) {
  .section-card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .section-card {
    background: var(--surface-solid);
  }
}

@media (prefers-contrast: more) {
  .section-card,
  .user-header {
    border-color: var(--line-strong);
    background: #fff;
  }
}
