* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

html,
body {
  position: relative;
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  min-height: -webkit-fill-available;
  font-family: "Arial Black", Arial, sans-serif;
  color: white;
  background:
    radial-gradient(circle at top left, rgba(255, 45, 45, .35), transparent 34%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, .16), transparent 30%),
    linear-gradient(135deg, #080808 0%, #171717 46%, #2b0505 100%);
  overscroll-behavior: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 34px 34px;
  pointer-events: none;
}

.app {
  width: min(100%, 760px);
  min-height: 100vh;
  min-height: 100svh;
  min-height: -webkit-fill-available;
  margin: 0 auto;
  padding: 22px 12px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.hero {
  text-align: center;
  margin-bottom: 8px;
}

.logo {
  display: inline-block;
  font-size: 14px;
  letter-spacing: 2.3px;
  margin-bottom: 8px;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  background: rgba(0,0,0,.3);
}

h1 {
  margin: 0;
  padding: 12px 16px;
  font-size: 34px;
  line-height: 1.05;
  text-shadow: 0 5px 0 rgba(0, 0, 0, .55);
  background: linear-gradient(135deg, #ff1d1d, #b90000);
  border-radius: 999px;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}

.hero p {
  margin: 7px 0 0;
  font-family: Arial, sans-serif;
  font-weight: 800;
  font-size: 14px;
  opacity: .86;
}

.panel {
  padding: 12px;
  border-radius: 26px;
  background: rgba(0, 0, 0, .62);
  border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 20px 70px rgba(0,0,0,.45);
  display: grid;
  gap: 8px;
  align-content: start;
}

.hidden {
  display: none !important;
}

button {
  -webkit-appearance: none;
  appearance: none;
}

.option {
  border: 0;
  background: rgba(255,255,255,.04);
  color: white;
  font: inherit;
  display: flex;
  align-items: center;
  border-radius: 16px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
  text-align: left;
  overflow: hidden;
}

.option:hover,
.option:focus {
  background: rgba(255, 255, 255, .14);
  outline: none;
}

.option:active {
  transform: scale(.98);
}

.logoIcon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex: 0 0 auto;
}

.googleLogo {
  background: transparent;
}

.facebookLogo {
  background: white;
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

.tiktokLogo {
  background: #000;
  border-radius: 10px;
  padding: 6px;
}

.naverLogo {
  background: #03c75a;
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

.kakaoLogo {
  background: #fee500;
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

.raLogo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.raFallback {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  place-items: center;
  flex: 0 0 auto;
  background: #111;
  color: white;
  font-size: 15px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,.25);
}

.emojiIcon,
.otherIcon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.emojiIcon {
  font-size: 25px;
}

.otherIcon {
  background: rgba(255,255,255,.15);
  font-size: 23px;
}

#platformScreen {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 58px;
  align-content: start;
  align-items: center;
  max-height: calc(100svh - 128px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#platformScreen .platform {
  height: 58px;
  min-height: 58px;
  max-height: 58px;
  padding: 8px 9px;
  gap: 9px;
}

#platformScreen .platform span:last-child {
  font-size: 19px;
  line-height: 1.05;
  white-space: normal;
  overflow-wrap: anywhere;
}

.regionPanel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 58px;
  align-content: start;
  max-height: calc(100svh - 128px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mapRegion {
  height: 58px;
  min-height: 58px;
  max-height: 58px;
  padding: 8px;
  justify-content: center;
  text-align: center;
  background: rgba(255,255,255,.08);
  display: grid;
  place-items: center;
}

.mapRegion strong {
  font-size: 18px;
  line-height: 1.05;
}

.countryPanel {
  max-height: calc(100svh - 128px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#countryButtons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 48px;
  align-content: start;
  gap: 8px;
}

.country {
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  padding: 6px 6px;
  justify-content: center;
  text-align: center;
  font-size: 15px;
  line-height: 1.08;
  background: rgba(255,255,255,.1);
  border-radius: 14px;
  word-break: keep-all;
  white-space: normal;
}

.genderPanel,
.peoplePanel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 56px;
  align-content: start;
  max-height: calc(100svh - 128px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.gender,
.people {
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  padding: 8px;
  justify-content: center;
  text-align: center;
  font-size: 20px;
  line-height: 1.1;
  background: rgba(255,255,255,.08);
}

.backBtn {
  grid-column: 1 / -1;
  width: 220px;
  height: 42px;
  min-height: 42px;
  max-height: 42px;
  justify-self: center;
  margin-top: 6px;
  padding: 0 16px;
  background: rgba(255,255,255,.2);
  color: white;
  font-size: 14px;
}

.backBtn,
.adminOpen,
#closeAdmin,
.danger,
.exportBtn {
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
}

.thankyou {
  text-align: center;
  padding: 34px 22px;
  border-radius: 28px;
  background: rgba(0,0,0,.72);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 20px 70px rgba(0,0,0,.45);
}

.thankyou h2 {
  margin: 0 0 12px;
  font-size: 42px;
}

.thankyou p {
  font-family: Arial, sans-serif;
  font-size: 20px;
}

.adminOpen {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: 80px;
  height: 40px;
  opacity: .36;
  background: white;
  color: black;
  z-index: 2;
}

.adminOpen:hover {
  opacity: .9;
}

.admin {
  position: fixed;
  inset: 0;
  overflow: auto;
  padding: 28px clamp(16px, 4vw, 56px) 48px;
  background:
    radial-gradient(circle at top left, rgba(255, 34, 34, .16), transparent 30%),
    #0b0b0d;
  color: white;
  z-index: 10;
  font-family: Arial, sans-serif;
}

.liveToolbar {
  display: none;
}

.livePage .liveToolbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto 28px;
  padding: 12px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 18px;
}

.liveToolbarMain,
.liveDateControls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.liveToolbarMain .adminEyebrow {
  margin-bottom: 2px;
}

.liveToolbarTitle {
  display: block;
  font-size: 18px;
}

.liveMenuButton {
  width: 44px;
  height: 44px;
  padding: 11px 10px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  cursor: pointer;
}

.liveMenuButton span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: white;
}

.liveDatePicker {
  min-height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  color: #111;
  border-radius: 12px;
  font-weight: 800;
}

.liveDatePicker input {
  min-width: 130px;
  border: 0;
  outline: none;
  background: transparent;
  color: #111;
  font: inherit;
  cursor: pointer;
}

#todayButton {
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

#todayButton:disabled {
  opacity: .38;
  cursor: default;
}

.liveBadge {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(42, 210, 129, .13);
  color: #55e6a0;
  border: 1px solid rgba(85, 230, 160, .22);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.2px;
}

.liveBadge.isArchive {
  background: rgba(255,255,255,.07);
  color: #aaaab2;
  border-color: rgba(255,255,255,.1);
}

.liveMenu {
  position: absolute;
  top: 66px;
  left: 12px;
  width: min(280px, calc(100vw - 48px));
  padding: 10px;
  background: #18181c;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  z-index: 30;
}

.liveMenu button {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: white;
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.liveMenu button:hover,
.liveMenu button:focus-visible {
  background: rgba(255,255,255,.08);
  outline: none;
}

.liveMenu hr {
  margin: 7px 4px;
  border: 0;
  border-top: 1px solid rgba(255,255,255,.1);
}

.liveMenu .menuDanger {
  color: #ff7d7d;
}

.viewerPage .adminOnly {
  display: none;
}

.adminPageOnly {
  display: none;
}

.adminPage .adminPageOnly {
  display: block;
}

.selectedDateLabel {
  margin: 12px 0 0;
  color: white;
  font-size: 14px;
  font-weight: 800;
}

.adminHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
}

.adminEyebrow {
  display: block;
  margin-bottom: 8px;
  color: #ff4b4b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.8px;
}

.adminIntro {
  margin: -10px 0 0;
  color: #9b9ba2;
  font-size: 14px;
}

.adminHeaderActions {
  display: flex;
  gap: 8px;
}

.storageStatus {
  margin: 0;
  padding: 8px 12px;
  color: #9b9ba2;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.storageStatus.isOnline {
  color: #53d89b;
  background: rgba(44, 184, 121, .1);
  border-color: rgba(83, 216, 155, .2);
}

.storageStatus.isOffline {
  color: #ff8170;
  background: rgba(255, 80, 60, .1);
  border-color: rgba(255, 129, 112, .2);
}

.adminStatusRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 1440px;
  margin: 24px auto 14px;
}

.lastUpdated {
  margin: 0;
  color: #73737b;
  font-size: 12px;
}

.adminHeaderActions button {
  min-width: 86px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

#closeAdmin {
  background: white;
  color: #111;
}

.adminHeaderActions button:disabled {
  opacity: .5;
  cursor: wait;
}

.admin h2 {
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1;
  margin: 0 0 20px;
}

.admin h3 {
  margin: 0;
  font-size: 18px;
}

.statCards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  max-width: 1440px;
  margin: 0 auto 14px;
}

.card {
  min-height: 154px;
  padding: 20px;
  background: linear-gradient(145deg, rgba(255,255,255,.095), rgba(255,255,255,.035));
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
}

.cardPrimary {
  background: linear-gradient(145deg, #f52b2b, #a90000);
  border-color: transparent;
  box-shadow: 0 16px 40px rgba(190, 0, 0, .18);
}

.card span {
  display: block;
  color: #aaaab2;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.cardPrimary span,
.cardPrimary small {
  color: rgba(255,255,255,.78);
}

.card strong {
  display: block;
  margin: 14px 0 5px;
  font-size: 46px;
  line-height: 1;
}

.card strong.cardLabel {
  font-size: clamp(23px, 3vw, 32px);
  overflow-wrap: anywhere;
}

.card small {
  color: #7f7f88;
  font-size: 12px;
  font-weight: 700;
}

.outsideHoursPanel {
  max-width: 1440px;
  margin: 0 auto 14px;
  padding: 20px;
  background: linear-gradient(145deg, rgba(255, 179, 71, .12), rgba(255,255,255,.035));
  border: 1px solid rgba(255, 179, 71, .28);
  border-radius: 20px;
}

.outsideHoursHeading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.outsideHoursHeading p {
  max-width: 720px;
  margin: 8px 0 0;
  color: #9b9ba3;
  font-size: 13px;
  line-height: 1.55;
}

.outsideHoursTotal {
  min-width: 190px;
  text-align: right;
}

.outsideHoursTotal strong {
  display: block;
  color: #ffb347;
  font-size: 42px;
  line-height: 1;
}

.outsideHoursTotal span,
.outsideHoursTotal small {
  display: block;
  margin-top: 6px;
  color: #8b8b94;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .7px;
}

.outsideHoursTotal small {
  text-transform: none;
  letter-spacing: 0;
}

.outsideHoursStats {
  margin-top: 18px;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.analyticsGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 1440px;
  margin: 0 auto;
}

.dashboardPanel {
  min-width: 0;
  padding: 20px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.085);
  border-radius: 20px;
}

.dashboardPanelWide {
  grid-column: 1 / -1;
}

.panelHeading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.panelHeading span {
  color: #74747c;
  font-size: 11px;
  font-weight: 700;
}

.statRow {
  margin: 14px 0;
}

.statTop {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.bar {
  height: 8px;
  margin-top: 8px;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  overflow: hidden;
}

.barFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff2020, #ff6b55);
  border-radius: 999px;
}

.crossItem {
  background: rgba(255,255,255,.05);
  padding: 14px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  margin-bottom: 10px;
}

.crossItem strong {
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
}

.crossItem ul {
  margin: 0;
  padding-left: 20px;
}

.crossNested {
  margin-top: 10px;
}

.crossNested strong {
  font-size: 15px;
  margin-bottom: 4px;
}

.detailSection {
  max-width: 1440px;
  margin: 34px auto 0;
}

.detailSectionHeading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 12px;
}

.detailSectionHeading p {
  margin: 0;
  color: #73737b;
  font-size: 12px;
}

.detailPanel {
  margin-bottom: 10px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.085);
  border-radius: 14px;
  overflow: hidden;
}

.detailPanel summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.detailPanel summary::-webkit-details-marker {
  display: none;
}

.detailPanel summary span {
  color: #8a8a92;
  font-size: 12px;
}

.detailPanel[open] summary {
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.detailPanelBody {
  padding: 16px 18px;
}

.adminActions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 1440px;
  margin: 28px auto 0;
}

.livePage .adminOpen {
  display: none;
}

.livePage .adminHeaderActions,
.livePage .adminActions {
  display: none;
}

.exportBtn {
  width: 100%;
  height: 46px;
  margin: 0;
  background: white;
  color: black;
  font-size: 15px;
}

.danger {
  grid-column: 1 / -1;
  width: min(100%, 320px);
  height: 46px;
  margin: 10px auto 0;
  background: transparent;
  color: #ff6969;
  border: 1px solid rgba(255, 77, 77, .35);
  font-size: 15px;
}

.country,
.mapRegion,
.gender,
.people,
.platform,
.backBtn,
.option,
.adminOpen,
.exportBtn,
.danger {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

@media (hover: none) {
  .option:hover,
  .option:focus,
  .mapRegion:hover,
  .mapRegion:focus,
  .country:hover,
  .country:focus {
    transform: none;
  }
}

@media (max-width: 430px) {
  .app {
    width: 100%;
    padding: 10px;
  }

  h1 {
    font-size: 26px;
    padding: 10px 12px;
  }

  .logo {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .hero p {
    font-size: 13px;
  }

  #platformScreen .platform {
    height: 54px;
    min-height: 54px;
    max-height: 54px;
    padding: 7px;
    gap: 7px;
  }

  #platformScreen .platform span:last-child {
    font-size: 15px;
  }

  .logoIcon,
  .raLogo,
  .raFallback,
  .emojiIcon,
  .otherIcon {
    width: 32px;
    height: 32px;
  }

  .emojiIcon {
    font-size: 22px;
  }

  .otherIcon {
    font-size: 20px;
  }

  .mapRegion {
    height: 52px;
    min-height: 52px;
    max-height: 52px;
  }

  .mapRegion strong {
    font-size: 15px;
  }

  .country {
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    font-size: 13px;
  }

  .gender,
  .people {
    height: 52px;
    min-height: 52px;
    max-height: 52px;
    font-size: 17px;
  }

  .backBtn {
    width: 180px;
    height: 38px;
    min-height: 38px;
    max-height: 38px;
    font-size: 13px;
  }

  .admin {
    padding: 18px 12px 36px;
  }

  .livePage .liveToolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
  }

  .liveDateControls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
  }

  .liveDatePicker {
    min-width: 0;
    padding: 0 10px;
  }

  .liveDatePicker input {
    width: 100%;
    min-width: 0;
    font-size: 14px;
  }

  #todayButton {
    padding: 0 12px;
  }

  .liveMenu {
    top: 66px;
  }

  .adminHeader {
    align-items: flex-start;
    gap: 12px;
  }

  .adminHeaderActions {
    flex-direction: column-reverse;
  }

  .adminHeaderActions button {
    min-width: 74px;
    height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }

  .adminIntro {
    max-width: 190px;
    font-size: 12px;
    line-height: 1.35;
  }

  .adminStatusRow {
    align-items: flex-start;
    flex-direction: column;
    margin-top: 18px;
  }

  .statCards,
  .analyticsGrid,
  .adminActions {
    grid-template-columns: 1fr;
  }

  .statCards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card {
    min-height: 130px;
    padding: 16px;
  }

  .card strong {
    font-size: 38px;
  }

  .card strong.cardLabel {
    font-size: 21px;
  }

  .outsideHoursHeading {
    flex-direction: column;
  }

  .outsideHoursTotal {
    min-width: 0;
    text-align: left;
  }

  .dashboardPanel,
  .detailPanelBody {
    padding: 16px;
  }

  .dashboardPanelWide,
  .danger {
    grid-column: 1;
  }

  .panelHeading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .statTop {
    font-size: 13px;
  }

  .detailSectionHeading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .detailPanel summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 15px 16px;
    font-size: 14px;
  }
}

@media (min-width: 431px) and (max-width: 900px) {
  .statCards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 340px) {
  #platformScreen,
  .regionPanel,
  #countryButtons,
  .genderPanel,
  .peoplePanel {
    grid-template-columns: 1fr;
  }
}


/* iPad landscape / Safari tab bar対策：余白と行間を詰める */
@media (orientation: landscape) and (max-height: 700px) {
  .app {
    padding-top: 10px;
    gap: 6px;
  }

  .hero {
    margin-bottom: 6px;
  }

  .logo {
    font-size: 12px;
    margin-bottom: 6px;
    padding: 5px 12px;
  }

  h1 {
    font-size: 30px;
    padding: 10px 14px;
  }

  .hero p {
    margin-top: 5px;
    font-size: 13px;
  }

  .panel {
    padding: 10px;
  }

  #platformScreen {
    grid-auto-rows: 54px;
    max-height: calc(100svh - 112px);
  }

  #platformScreen .platform {
    height: 54px;
    min-height: 54px;
    max-height: 54px;
  }

  .regionPanel {
    grid-auto-rows: 54px;
  }

  .mapRegion {
    height: 54px;
    min-height: 54px;
    max-height: 54px;
  }

  .genderPanel,
  .peoplePanel {
    grid-auto-rows: 52px;
  }

  .gender,
  .people {
    height: 52px;
    min-height: 52px;
    max-height: 52px;
  }
}

@media (min-width: 901px) {
  .app {
    width: min(100%, 860px);
  }

  .regionPanel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #countryButtons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  h1 {
    font-size: 38px;
  }
}

/* =========================================================
   iPad / Safari vertical centering fix
   - ボタン行間は固定したまま、画面全体を中央寄せ
   - Safariの表示領域をJSの --app-height で安定化
========================================================= */
:root {
  --app-height: 100vh;
}

body {
  min-height: var(--app-height);
}

.app {
  height: var(--app-height);
  min-height: var(--app-height);
  justify-content: center;
  overflow-y: auto;
  padding-top: 12px;
  padding-bottom: 12px;
}

#platformScreen,
.regionPanel,
.countryPanel,
.genderPanel,
.peoplePanel {
  max-height: calc(var(--app-height) - 145px);
}

/* 画面がかなり低い時だけ上寄せに逃がす */
@media (max-height: 620px) {
  .app {
    justify-content: flex-start;
  }

  #platformScreen,
  .regionPanel,
  .countryPanel,
  .genderPanel,
  .peoplePanel {
    max-height: calc(var(--app-height) - 118px);
  }
}
