:root {
  --navy: #142B46;
  --navy-2: #24405E;
  --navy-3: #2C4868;
  --bg: #F3F5F8;
  --card: #FFFFFF;
  --gold: #C9A227;
  --gold-soft: #FBF3DA;
  --gold-text: #8E6F0C;
  --silver-soft: #EEF1F5;
  --silver-text: #677386;
  --bronze-soft: #F7ECE4;
  --bronze-text: #98603A;
  --teal: #0E7C7B;
  --text: #182434;
  --muted: #626D7B;
  --line: #E3E8EF;
  --radius: 14px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-x: hidden;
}

button, select { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- header */
.site-header {
  background: var(--navy);
  color: #FFFFFF;
  padding: calc(12px + env(safe-area-inset-top)) 0 13px;
}

.header-inner {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #FFFFFF;
  text-decoration: none;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand svg {
  width: 36px;
  height: 22px;
  flex: none;
}

.latest {
  font-size: 11.5px;
  color: #BFD0E2;
  text-align: right;
  white-space: nowrap;
}

.region { margin-top: 13px; }

.region-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: #A9BDD3;
}

.region-label .pin {
  width: 14px;
  height: 14px;
  flex: none;
}

.region-name {
  min-height: 32px;
  margin-top: 2px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.title {
  margin: 11px 0 10px;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.tab {
  appearance: none;
  border: 0;
  border-radius: 9px;
  padding: 9px 2px;
  background: var(--navy-2);
  color: #D7E2EE;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
}

.tab[aria-pressed="true"] {
  background: #FFFFFF;
  color: var(--navy);
  font-weight: 800;
}

/* ---------------------------------------------------------------- main */
.main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 14px 36px;
}

.rank-view { width: 100%; }

/* ---------------------------------------------------------------- period */
.periods {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.period {
  appearance: none;
  border: 1px solid #DEE4EC;
  border-radius: 9px;
  padding: 9px 2px;
  background: var(--card);
  color: #5C6979;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.period[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #FFFFFF;
  font-weight: 700;
}

/* ---------------------------------------------------------------- list head */
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 2px 4px;
}

.list-head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.list-note {
  margin: 0 2px 9px;
  font-size: 11.5px;
  color: #626D7B;
}

.scope {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  background: #E7EBF1;
  border-radius: 999px;
}

.scope button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 5px 9px;
  background: transparent;
  color: #556270;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.scope button[aria-pressed="true"] {
  background: var(--navy);
  color: #FFFFFF;
  font-weight: 800;
}

/* ---------------------------------------------------------------- cards */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.store-card {
  background: var(--card);
  border: 1px solid #E8ECF2;
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(20, 43, 70, 0.04);
  overflow: hidden;
}

.store-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 12px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.rank {
  flex: none;
  width: 38px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #626D7B;
  font-size: 14.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.rank.r1 { background: var(--gold-soft); color: var(--gold-text); font-size: 17px; }
.rank.r2 { background: var(--silver-soft); color: var(--silver-text); font-size: 17px; }
.rank.r3 { background: var(--bronze-soft); color: var(--bronze-text); font-size: 17px; }

.store-main {
  flex: 1;
  min-width: 0;
}

.store-name {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-addr {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: #EEF1F5;
  color: var(--silver-text);
  font-size: 10px;
  font-weight: 700;
  vertical-align: 1px;
  letter-spacing: 0;
}

.badge.closed { background: #FBEAEA; color: #B04A4A; }
.badge.unknown { background: #EEF1F5; color: #556270; }

.games {
  flex: none;
  min-width: 46px;
  color: var(--navy);
  text-align: right;
  white-space: nowrap;
}

.games b {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.games span {
  margin-left: 2px;
  color: #4B5868;
  font-size: 12px;
  font-weight: 600;
}

.chev {
  flex: none;
  width: 15px;
  height: 15px;
  color: #9AA4B2;
}

.store-summary[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* ---------------------------------------------------------------- detail */
.store-detail {
  padding: 14px 14px 15px;
  border-top: 1px solid #EDF0F4;
  background: #FCFDFE;
}

.detail-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-title strong {
  font-size: 14.5px;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.status {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
}

.status.open { background: #E9F4EE; color: #2F7A53; }
.status.closed { background: #FBEAEA; color: #B04A4A; }
.status.unknown { background: #EEF1F5; color: #556270; }

.detail-addr {
  margin: 5px 0 0;
  color: #5E6A7A;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 12px 0 14px;
}

.stat {
  padding: 7px 3px;
  border-radius: 10px;
  background: #F3F5F8;
  text-align: center;
}

.stat b {
  display: block;
  color: var(--navy);
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10.5px;
}

.history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.history-head h3 {
  margin: 0;
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 800;
}

.history-head span {
  color: #626D7B;
  font-size: 11px;
}

.history-list {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid #EDF0F4;
  border-radius: 10px;
  background: #FFFFFF;
  -webkit-overflow-scrolling: touch;
}

.hrow {
  display: grid;
  grid-template-columns: 52px 74px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid #F0F3F7;
  font-size: 11.5px;
}

.hrow:last-child { border-bottom: 0; }

.hdraw { color: var(--navy); font-weight: 700; }
.hdate { color: #626D7B; }

.htype {
  justify-self: start;
  padding: 2px 6px;
  border-radius: 6px;
  background: #EEF1F5;
  color: #5F6B7B;
  font-size: 10.5px;
  font-weight: 700;
}

.htype.t-Q { background: #E5F3F2; color: #0A6A69; }
.htype.t-B { background: #F8F0DA; color: #7A5D0F; }

.hgames {
  color: var(--navy);
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- more */
.more {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #DEE4EC;
  border-radius: 12px;
  background: var(--card);
  color: var(--navy);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

/* ---------------------------------------------------------------- loader / error */
.inline-note {
  margin: 0;
  padding: 14px;
  color: #626D7B;
  font-size: 12.5px;
}

.inline-note.error { color: #B04A4A; }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--navy);
  font-size: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.state-box {
  margin-top: 8px;
  padding: 32px 18px;
  border: 1px solid #E4E9F0;
  border-radius: var(--radius);
  background: var(--card);
  text-align: center;
}

.state-box p {
  margin: 0;
  color: #677386;
  font-size: 13px;
}

.state-box .state-title {
  margin-bottom: 6px;
  color: var(--navy);
  font-size: 15px;
  font-weight: 800;
}

.retry {
  margin-top: 14px;
  padding: 9px 16px;
  border: 0;
  border-radius: 9px;
  background: var(--navy);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* ---------------------------------------------------------------- round */
.round-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 9px 11px;
  border: 1px solid #E4E9F0;
  border-radius: 12px;
  background: var(--card);
}

.round-label {
  color: #5C6979;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.round-select {
  flex: 1;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
  padding: 4px 24px 4px 2px;
  border: 0;
  background: transparent url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23142B46' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right center;
  background-size: 14px 14px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.round-date {
  color: #626D7B;
  font-size: 11.5px;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- region picker */
.picker-block + .picker-block { margin-top: 20px; }

.section-title {
  margin: 0 2px 9px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
}

.picker-hint {
  margin: 0 2px 9px;
  color: #626D7B;
  font-size: 11.5px;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.chip-grid.sgg { grid-template-columns: repeat(2, 1fr); }

.chip {
  appearance: none;
  overflow: hidden;
  padding: 10px 4px;
  border: 1px solid #DEE4EC;
  border-radius: 9px;
  background: var(--card);
  color: #435063;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.chip.active {
  border-color: var(--navy);
  background: var(--navy);
  color: #FFFFFF;
  font-weight: 800;
}

/* ---------------------------------------------------------------- footer */
.site-footer {
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid #E5E9EF;
  background: #ECF0F5;
}

.footer-inner {
  max-width: 760px;
  margin: 0 auto;
  color: #5F6B7B;
  font-size: 11.5px;
  line-height: 1.6;
}

.footer-inner p { margin: 0 0 3px; }

.footer-inner .coverage {
  margin-bottom: 7px;
  color: #45536A;
  font-weight: 700;
  font-size: 12px;
}

.footer-inner .disclaimer {
  margin-top: 7px;
  color: #626D7B;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 9px 0 8px;
  padding-top: 9px;
  border-top: 1px solid #DCE2EA;
}

.footer-links a {
  color: #3A4A60;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
}

.footer-links a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- ads
   광고가 꺼져 있으면 이 요소 자체를 출력하지 않는다(빈 공간 없음).
   켜졌을 때만 .ad-slot 이 그려지며, 카드/메뉴와 구분되도록 점선 테두리를 쓴다. */
.ad-slot-wrap { margin: 0 0 14px; }

.ad-slot {
  position: relative;
  padding: 14px 10px 10px;
  border: 1px dashed #C9D2DE;
  border-radius: 12px;
  background: #FAFBFD;
  text-align: center;
  overflow: hidden;
}

.ad-slot .ad-label {
  position: absolute;
  top: 3px;
  left: 8px;
  color: #8A94A3;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ad-slot .adsbygoogle { min-height: 50px; }

.list .ad-slot { margin: 2px 0; }

/* PC 우측 세로 광고: 본문 폭(760px)을 줄이지 않도록 fixed 로 띄운다. */
.ad-rail {
  position: fixed;
  top: 190px;
  right: 20px;
  width: 160px;
  z-index: 5;
}

.ad-rail .ad-slot { padding: 14px 6px 8px; }
.ad-rail .adsbygoogle { min-height: 600px; }

@media (min-width: 720px) and (max-width: 1179px) {
  .ad-rail { display: none; }
}

/* ---------------------------------------------------------------- docs */
.doc-header {
  background: var(--navy);
  color: #FFFFFF;
  padding: calc(12px + env(safe-area-inset-top)) 0 13px;
}

.doc-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.doc-header .back {
  color: #C7D6E7;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.doc {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 14px 36px;
}

.doc h1 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 21px;
  letter-spacing: -0.02em;
}

.doc .doc-lead {
  margin: 0 0 14px;
  color: #5F6B7B;
  font-size: 12.5px;
}

.doc section {
  margin-top: 10px;
  padding: 14px 15px;
  border: 1px solid #E4E9F0;
  border-radius: var(--radius);
  background: var(--card);
}

.doc h2 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 14.5px;
  letter-spacing: -0.02em;
}

.doc p,
.doc li {
  color: #3F4C5F;
  font-size: 12.5px;
  line-height: 1.65;
}

.doc p { margin: 0 0 7px; }
.doc p:last-child { margin-bottom: 0; }

.doc ul {
  margin: 0;
  padding-left: 17px;
}

.doc li + li { margin-top: 3px; }

.doc .note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #F3F6FA;
  color: #526073;
  font-size: 11.5px;
}

.doc a { color: #0E6E6D; }

.noscript {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  padding: 12px;
  border-radius: 10px;
  background: #FFFFFF;
  box-shadow: 0 4px 14px rgba(20, 43, 70, 0.16);
  color: var(--navy);
  font-size: 12.5px;
  text-align: center;
}

/* ---------------------------------------------------------------- wide screens */
@media (min-width: 720px) {
  .main { padding-top: 19px; }
  .header-inner { padding: 0 24px; }
  .site-header { padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: 17px; }
  .region-name { font-size: 25px; }
  .title { font-size: 21px; }
  .tab { font-size: 14px; padding: 10px 4px; }
  .store-summary { padding: 13px 15px; }
  .store-name { font-size: 15.5px; }
  .games b { font-size: 19px; }
  .chip-grid.sgg { grid-template-columns: repeat(3, 1fr); }
}
