/* 하우스 성적표 (/picklab/house/) — styles.css 의 토큰만 빌려 쓰고 nav·뷰 클래스에는 기대지 않는다.
   본문 12px · 큰 숫자 18~22px · 라벨 10~11px 로 고정하고, 데스크톱도 720px 한 칸으로 읽는다. */

/* ── 페이지 크롬 ───────────────────────────────────────────── */
.house-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 16px 16px 10px;
}

.house-topbar-main h1 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.25;
}

.house-topbar-main p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.house-topbar-side {
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 10px;
}

.house-back {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.house-back:hover {
  color: var(--text);
  text-decoration: underline;
}

.house-lang {
  display: grid;
  grid-auto-flow: column;
  gap: 6px;
}

.house-lang button {
  height: var(--small-control-height);
  padding: 0 10px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--control);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.house-lang button.active {
  background: var(--button);
  color: var(--text);
  border-color: var(--line);
}

.house-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 0 16px 24px;
}

.house-panel,
.house-body {
  display: grid;
  gap: 14px;
  min-width: 0;
}

/* ── 이번 주 (첫 화면은 이 한 장) ─────────────────────────── */
.house-week {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: var(--panel);
}

.house-week > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.house-week > strong {
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.2;
}

.house-week > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.house-week.is-missed > strong {
  color: var(--muted);
}

/* ── 블록 공통 ───────────────────────────────────────────── */
.house-block {
  display: grid;
  gap: 0;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: var(--panel);
}

.house-block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 8px;
}

.house-block-head span {
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.house-block-head small {
  color: var(--muted);
  font-size: 11px;
}

.house-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

/* ── 누적 요약 카드 3장 ───────────────────────────────────── */
.house-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.house-card {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: var(--panel);
}

.house-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.house-card strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.house-card small {
  color: var(--muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}

/* ── 등수별 실제 / 기대치 ─────────────────────────────────── */
.house-rank-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 72px 64px;
  align-items: center;
  gap: 8px;
  height: 40px;
  border-top: 1px solid var(--soft-line);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.house-rank-row strong {
  font-size: 12px;
  font-weight: 900;
}

.house-rank-expected {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.house-rank-actual {
  color: var(--text);
  font-weight: 900;
  text-align: right;
}

.house-rank-diff {
  color: var(--muted);
  font-weight: 900;
  text-align: right;
}

.house-rank-diff.is-over {
  color: var(--green);
}

.house-rank-diff.is-under {
  color: var(--red);
}

/* ── 회차 기록 (한 줄 = 한 회차) ─────────────────────────── */
.house-round-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 72px 16px;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border-top: 1px solid var(--soft-line);
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.house-round-row strong {
  font-weight: 900;
}

.house-round-desc {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.house-round-prize {
  color: var(--text);
  font-weight: 900;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.house-round-chev {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.house-round-chev svg {
  width: 14px;
  height: 14px;
  transition: transform 0.15s ease;
}

.house-round-row[role="button"] {
  cursor: pointer;
}

.house-round-row[role="button"]:hover,
.house-round-row[role="button"]:focus-visible {
  outline: none;
}

.house-round-row[role="button"]:hover strong,
.house-round-row[role="button"]:hover .house-round-desc,
.house-round-row[role="button"]:focus-visible strong,
.house-round-row[role="button"]:focus-visible .house-round-desc {
  color: var(--text);
}

.house-round-row[role="button"]:focus-visible {
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 6px;
}

.house-round-row.is-open .house-round-chev svg {
  transform: rotate(90deg);
}

.house-round-row.is-open strong {
  color: var(--text);
}

.house-round-row.is-missed {
  color: var(--muted);
  opacity: 0.72;
}

.house-round-row.is-missed strong,
.house-round-row.is-missed .house-round-desc,
.house-round-row.is-missed .house-round-prize {
  color: var(--muted);
  font-weight: 800;
}

@media (prefers-reduced-motion: reduce) {
  .house-round-chev svg {
    transition: none;
  }
}

/* ── 계산법 (맨 아래) ────────────────────────────────────── */
.house-method {
  min-width: 0;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: var(--panel);
}

.house-method > summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  list-style: none;
}

.house-method > summary::-webkit-details-marker {
  display: none;
}

.house-method > summary::after {
  content: "+";
  float: right;
  color: var(--muted);
  font-weight: 900;
}

.house-method[open] > summary::after {
  content: "−";
}

.house-method-body {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.house-method-part {
  display: grid;
  gap: 6px;
}

.house-method-part > strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.house-method-part p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.house-method-part .house-note {
  margin: 0;
}

.house-policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 4px;
  margin-top: 4px;
}

.house-policy-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--bg);
}

.house-policy-row span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.house-policy-row strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
  overflow-wrap: anywhere;
}

.house-odds-list {
  display: grid;
  gap: 4px;
}

.house-odds-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
}

.house-odds-row strong {
  font-size: 12px;
  font-weight: 900;
}

.house-odds-row span {
  color: var(--muted);
}

.house-odds-value {
  color: var(--text) !important;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.house-disclaimer {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--soft-line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

/* ── 100세트 상세 (회차 줄 자리에서 펼침) ───────────────── */
.house-detail {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 8px 0 10px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: var(--bg);
}

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

.house-detail-head strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.house-detail-head p {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.house-detail-meta {
  color: var(--muted) !important;
  font-size: 11px !important;
}

.house-detail-close {
  height: var(--small-control-height);
  min-width: var(--small-control-height);
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: var(--control);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.house-detail-close:hover {
  border-color: var(--line);
  color: var(--text);
}

/* ── 세트 표 ─────────────────────────────────────────────── */
.house-table {
  max-width: 100%;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--panel);
}

.house-table-head {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--soft-line);
  background: var(--control);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.house-table-body {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 4px;
}

/* 100행이라 세로·가로를 함께 굴린다 — 머리줄은 붙잡아 둔다 */
.house-pick-table {
  max-height: 460px;
  overflow: auto;
}

.house-pick-table .house-table-head {
  position: sticky;
  top: 0;
  z-index: 1;
}

.house-pick-table .house-table-head,
.house-pick-row {
  min-width: 440px;
  grid-template-columns: 40px 196px 60px minmax(96px, 1fr);
}

.house-pick-table.is-graded .house-table-head,
.house-pick-table.is-graded .house-pick-row {
  min-width: 620px;
  grid-template-columns: 40px 196px 60px 50px 56px 62px minmax(92px, 1fr);
}

.house-pick-row {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.house-pick-row.is-won {
  border-color: var(--line);
  background: var(--control);
}

.house-pick-lift {
  color: var(--muted);
  font-weight: 800;
}

.house-pick-balls {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
}

.house-ball {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: var(--ball-color);
  /* 공 색은 두 테마에서 모두 밝다 — 숫자는 어두운 잉크로 고정해야 읽힌다 */
  color: #10151c;
  font-size: 10px;
  font-weight: 900;
  opacity: 0.75;
}

/* 채점 전에는 전부 같은 무게로 보여준다 */
.house-pick-table:not(.is-graded) .house-ball {
  opacity: 1;
}

.house-ball.is-hit {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--text);
}

.house-ball.is-bonus {
  opacity: 1;
  border-style: dashed;
  border-color: var(--text);
}

/* ── loading / empty / error ─────────────────────────────── */
.house-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 26px 16px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: var(--panel);
  text-align: center;
}

.house-state p {
  margin: 0;
  max-width: 42em;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.house-state.is-error p {
  color: var(--text);
}

.house-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--soft-line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: house-spin 0.7s linear infinite;
}

@keyframes house-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .house-spinner {
    animation-duration: 2.4s;
  }
}

.house-retry {
  height: var(--action-height);
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--button);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.house-retry:hover {
  border-color: var(--text);
}

/* ── 좁은 화면 ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .house-topbar {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 16px 8px;
  }

  .house-topbar-side {
    justify-content: start;
  }

  .house-block {
    padding: 14px 12px;
  }

  .house-card {
    padding: 10px;
  }

  .house-rank-row {
    grid-template-columns: 32px minmax(0, 1fr) 56px 54px;
    gap: 6px;
  }

  .house-round-row {
    grid-template-columns: 46px minmax(0, 1fr) 60px 14px;
    gap: 6px;
  }

  .house-method > summary,
  .house-method-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .house-pick-table {
    max-height: 400px;
  }
}
