:root {
  color-scheme: light;
  font-family: system-ui, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  color: #172a3b;
  background: #f3f6fa;
  --muted: #546a7d;
  --line: #dce5ed;
  --surface: #fff;
  --ink: #123b52;
  --accent: #086e60;
}

* { box-sizing: border-box; }
body, p, h1, h2 { margin: 0; }
[hidden] { display: none !important; }

.frame { width: min(66rem, calc(100% - 3.5rem)); margin-inline: auto; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, .page-header, .panel-header, .record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.topbar-inner { min-height: 4.125rem; }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-weight: 750; letter-spacing: -0.035em; }
.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 2rem;
  height: 2rem;
  padding-bottom: 0.55rem;
  border-radius: 0.55rem;
  background: var(--ink);
  color: #aeead8;
}
.brand-mark i { width: 3px; border-radius: 3px; background: currentColor; }
.brand-mark i:nth-child(1) { height: 6px; }
.brand-mark i:nth-child(2) { height: 10px; }
.brand-mark i:nth-child(3) { height: 14px; }
.venue { color: var(--muted); font-size: 0.875rem; font-weight: 650; }

main { padding-block: 2.4rem 3.75rem; }
.page-header { margin-bottom: 1.25rem; }
h1 { font-size: clamp(1.8rem, 4vw, 2.45rem); line-height: 1.2; letter-spacing: -0.055em; }
h2 { font-size: 1.08rem; line-height: 1.4; letter-spacing: -0.035em; }
.refresh-button {
  min-height: 2.85rem;
  min-width: 6.5rem;
  padding: 0.65rem 1.1rem;
  border: 0;
  border-radius: 0.6rem;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.refresh-button:hover { background: #065e52; }
.refresh-button:disabled { background: #4f7974; cursor: wait; }
button:focus-visible, a:focus-visible { outline: 3px solid #229887; outline-offset: 3px; }

.dashboard, .overview-grid, .detail-grid { display: grid; gap: 1rem; }
.overview-grid { grid-template-columns: 1.45fr 1fr; }
.detail-grid { grid-template-columns: 1.1fr 1fr; align-items: start; }
.overview-grid > *, .detail-grid > *, .record-primary { min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 0.9rem; overflow: hidden; }
.panel-header { padding: 1rem 1.25rem; flex-wrap: wrap; }
.panel-meta, .muted, .record-meta { color: var(--muted); font-size: 0.875rem; line-height: 1.5; }
.panel-meta { font-variant-numeric: tabular-nums; }

.asset-card {
  padding: 1.2rem 1.35rem;
  border-radius: 0.9rem;
  background: #15364d;
  color: #f5f9fd;
}
.asset-value { margin-block: 0.5rem; font-size: clamp(1.85rem, 5vw, 2.65rem); font-weight: 750; overflow-wrap: anywhere; line-height: 1.25; font-variant-numeric: tabular-nums; }
.asset-value span { font-size: 0.875rem; color: #d1e5ed; }
.asset-meta, .asset-error { color: #d1e5ed; font-size: 0.875rem; line-height: 1.5; }
.asset-error { color: #ffdfda; }
.heartbeat-card { padding: 1.2rem 1.35rem; }
.heartbeat-state { display: flex; align-items: center; gap: 0.5rem; margin-block: 0.55rem 0.7rem; font-weight: 750; }
.heartbeat-state > span { width: 0.5rem; height: 0.5rem; flex: none; border-radius: 50%; background: currentColor; }
.heartbeat-time { margin-top: 0.125rem; font-size: 0.92rem; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.heartbeat-time span { color: var(--muted); font-size: 0.85rem; }

.position-table { width: 100%; border-collapse: collapse; }
.position-table thead { background: #f0f5fa; color: #364e64; font-size: 0.875rem; }
.position-table th, .position-table td { padding: 0.72rem 1.25rem; text-align: left; overflow-wrap: anywhere; }
.position-table th:last-child, .position-table td:last-child { text-align: right; }
.position-table tbody tr + tr { border-top: 1px solid #edf1f5; }
.number { font-variant-numeric: tabular-nums; font-weight: 680; }
.unit { font-size: 0.75rem; color: var(--muted); font-weight: 600; }

.record-list { margin: 0; padding: 0; list-style: none; }
.record { min-height: 4.25rem; padding: 0.65rem 1.25rem; border-top: 1px solid #eaf0f5; }
.record-primary p + p { margin-top: 0.15rem; }
.record-title { font-weight: 720; overflow-wrap: anywhere; }
.record > strong { text-align: right; white-space: nowrap; }
.result-mark { display: inline-block; margin-left: 0.25rem; padding: 0.13rem 0.35rem; border-radius: 0.3rem; font-size: 0.75rem; }
.result-mark.win { color: #086452; background: #e0f1ea; }
.result-mark.loss { color: #943b35; background: #faeeec; }
.positive { color: #086452; }
.negative { color: #a33730; }
.neutral { color: var(--muted); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem; margin: 0 1.25rem 0.65rem; padding: 0.2rem; border-radius: 0.65rem; background: #edf2f7; }
.tabs a { padding: 0.5rem 0.65rem; color: var(--muted); border-radius: 0.48rem; font-weight: 700; text-align: center; text-decoration: none; font-size: 0.9rem; }
.tabs a[aria-current] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px #15364d15; }
.empty, .inline-error, .request-error { padding: 0.9rem 1.25rem; line-height: 1.55; font-size: 0.9rem; }
.empty { border-top: 1px solid #edf1f5; color: var(--muted); }
.inline-error, .request-error { background: #fff1ef; color: #922d26; }
.request-error { margin-bottom: 0.8rem; border-radius: 0.6rem; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 42rem) {
  .frame { width: calc(100% - 1.75rem); }
  .topbar-inner { min-height: 3.55rem; }
  main { padding-top: 1.35rem; }
  .overview-grid, .detail-grid { grid-template-columns: 1fr; }
  .dashboard, .overview-grid, .detail-grid { gap: 0.8rem; }
  .asset-card, .heartbeat-card { padding: 1rem; }
  .panel-header, .record, .empty, .inline-error, .request-error { padding-inline: 0.9rem; }
  .tabs { margin-inline: 0.9rem; }
  .position-table th, .position-table td { padding-inline: 0.5rem; font-size: 0.8rem; }
  .position-table th:first-child { padding-left: 0.9rem; }
  .position-table th:last-child, .position-table td:last-child { padding-right: 0.9rem; }
  .position-table .unit { display: block; }
}
