.player-page {
  max-width: none;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.player-page > .site-header {
  display: block;
  margin: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
  overflow: visible;
  border: 0;
  border-bottom: 1px solid #2d4260;
  border-radius: 0;
  background: #0b1729;
}

.player-page > .site-header::before, .player-icons { display: none; }
.player-page .site-header small { color: inherit; }
.player-page .site-header details { border: 0; background: transparent; overflow: visible; }
.player-page .site-header details > summary::after { content: none; }
.player-page .mobile-menu:not([open]) nav { display: none; }

.player-identity, #player-main {
  width: min(100%, 1234px);
  margin: auto;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
}

.player-page > .player-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-block: 20px 12px;
  border: 0;
  border-radius: 0;
  background: none;
}

.player-identity::before { display: none; }
.player-identity img { border-radius: 11px; }
.player-identity h1 { font-size: clamp(23px, 4vw, 36px); }
.player-identity nav { display: flex; gap: 8px; margin-left: auto; }
.player-identity .btn { min-height: 40px; padding: 8px 14px; }
#player-main { display: block; padding-bottom: 24px; }

.player-page #player-card { min-width: 0; margin: 0; padding: clamp(7px, 1.25vw, 16px); }
.player-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.player-tools { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.player-tools:last-child { margin-left: auto; }
.player-tools select { min-height: 44px; max-width: clamp(100px, 32vw, 220px); padding: 6px 8px; font-size: 14px; }

.player-page .tool-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #52749a;
  border-radius: 9px;
  background: #1b3554;
  color: #edf5ff;
  font-size: 14px;
  font-weight: 850;
}

.tool-button svg, .center-play svg, #map-profile-sync svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.player-page .tool-button:hover:not(:disabled) { background: #294972; }
.player-page .tool-button[data-apk-state="missing"], .player-page .play-tool {
  border-color: #ee7084;
  background: linear-gradient(110deg, #c13851, #a32646);
  color: #fff;
}
.player-page .tool-button[data-apk-state="missing"]:hover, .player-page .play-tool:hover:not(:disabled) { background: #b92e4e; }
.player-page .tool-button[data-apk-state="checking"] { background: #26364e; }
.player-page [hidden] { display: none !important; }

.player-page .screen-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  overflow: visible;
  border-radius: 10px;
  background: #030915;
}
.screen-frame:has(.apk-overlay:not([hidden])) { min-height: 320px; }
.player-page #play-stage:not(.immersive) { width: min(100%, 960px); margin: 0 auto; }
.player-page :not(.immersive) > #game-wrap { margin: 0 auto; max-width: 960px; }

.center-play, .apk-overlay { position: absolute; z-index: 21; }
.player-page .center-play {
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 76px;
  height: 58px;
  padding: 0;
  transform: translate(-50%, -50%);
  border-radius: 14px;
}
.center-play svg { width: 31px; height: 31px; }
.apk-overlay {
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  overflow: auto;
  background: #060c19bf;
  border-radius: 9px;
}
.apk-panel {
  display: grid;
  gap: 10px;
  width: min(100%, 420px);
  padding: clamp(10px, 3vw, 20px);
  border: 1px solid #42658c;
  border-radius: 13px;
  background: #13243c;
}
.apk-panel p, .apk-panel label { margin: 0; }
.apk-panel #forget-game { justify-self: start; }

.player-page .player-status { margin: 9px 3px 0; font-size: 13px; }
.player-page #store-status:empty { display: none; }
.player-page .player-stats {
  position: absolute;
  z-index: 8;
  top: 7px;
  left: 7px;
  max-width: calc(100% - 14px);
  padding: 5px 8px;
  border: 1px solid #486890;
  border-radius: 7px;
  color: #ebf4ff;
  background: #061326e6;
  font-size: 11px;
  pointer-events: none;
}
.player-page .player-stats dl, .player-page .player-stats dd { margin: 0; }
.player-stats dl { display: grid; grid-template-columns: repeat(2, auto); gap: 2px 11px; }
.player-stats dl div { display: flex; gap: 5px; }
.player-stats dt { color: #b1c9e7; }
#play-stage.immersive #player-stats { display: none; }

.player-dialog {
  position: fixed;
  inset: 0;
  width: min(calc(100% - 24px), 700px);
  max-height: min(85dvh, 800px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #4b6c93;
  border-radius: 16px;
  background: #132238;
  color: #eaf3ff;
  box-shadow: 0 18px 70px #020610c9;
}
.player-dialog[open] { display: flex; flex-direction: column; }
.player-dialog::backdrop { background: #050b19b8; }
.panel-heading { display: flex; align-items: center; gap: 7px; }
.panel-heading h2 { flex: 1; margin: 0; font-size: clamp(18px, 4vw, 24px); }
.player-dialog > .panel-heading { padding: 12px clamp(10px, 3vw, 22px); border-bottom: 1px solid #345173; }
.panel-body { min-height: 0; padding: clamp(12px, 3vw, 22px); overflow: auto; overscroll-behavior: contain; }
.panel-body > :first-child { margin-top: 0; }
.panel-body p:empty { display: none; }
.player-page .file-button, .player-page .save-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 7px;
  text-align: center;
  font-size: 13px;
}
.player-page .file-button { position: relative; border: 1px solid #52749a; border-radius: 8px; background: #294663; font-weight: 800; cursor: pointer; }
.player-page .file-button input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.file-button:focus-within { outline: 2px solid #aacfff; outline-offset: 2px; }
.file-button:has(input:disabled) { opacity: .52; }
.player-page .check-setting { display: flex; align-items: center; gap: 8px; margin: 0; }
.check-setting input { inline-size: 17px; block-size: 17px; flex: 0 0 auto; }
.save-list {
  max-height: min(42dvh, 320px);
  min-height: 62px;
  overflow-y: auto;
  padding: 8px 9px;
  scrollbar-gutter: stable;
  scrollbar-color: #7a9abb #0b182b;
  border: 1px solid #3c597e;
  border-radius: 9px;
  background: #0b182b;
  touch-action: pan-y;
}
.save-list::-webkit-scrollbar { width: 16px; }
.save-list::-webkit-scrollbar-thumb { border: 3px solid #0b182b; border-radius: 10px; background: #7a9abb; }
.save-list .save-row { margin: 0; padding: 8px 0; flex-wrap: wrap; }
.save-list .save-row:last-child { border-bottom: 0; }
.save-list .save-row > span { flex: 1 1 115px; overflow-wrap: anywhere; }
.save-row-detail { display: block; }
.save-list .save-row button { min-height: 40px; }
.save-list .save-row .tool-button { width: 40px; height: 40px; }
.save-toolbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.save-secondary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.save-secondary button { padding: 7px 9px; font-size: 12px; }
.save-conflict { border: 1px solid #bd975f; border-radius: 9px; padding: 12px; background: #322b24; }
.save-conflict h3 { margin: 0; }

.settings-layout { display: grid; grid-template-columns: minmax(145px, 190px) minmax(0, 1fr); min-height: 0; }
.settings-selector { display: flex; flex-direction: column; gap: 5px; overflow-y: auto; padding: 10px; background: #0b192c; }
.player-page .settings-selector button { padding: 10px 8px; border-color: transparent; background: transparent; text-align: left; }
.player-page .settings-selector button[aria-pressed="true"] { border-color: #527baa; background: #24446b; }
.settings-fields { display: grid; gap: 13px; margin-bottom: 12px; }
.settings-fields > label:not(.check-setting) { display: grid; gap: 6px; margin: 0; }
.settings-fields > button { justify-self: start; }
.settings-page { border: 0; background: none; padding: 0; margin: 0; }
.settings-page h3 { margin: 0 0 14px; }
.settings-page .game-settings { max-width: none; border: 0; background: transparent; }
.settings-page .game-settings-row { margin: 0; }
.repair-warning { margin-top: 18px; padding: 12px; border: 1px solid #a85669; border-radius: 9px; background: #38212d; }
.repair-warning h4 { margin: 0; color: #ffc0cb; }
.player-page .repair-link, .player-page button.danger { border: 1px solid #bd566c; color: #ffe5e9; background: #772b43; }
.player-page .repair-link:hover, .player-page button.danger:hover { background: #96364f; }
.map-profile-row { display: flex; align-items: end; gap: 8px; }
.map-profile-row label { flex: 1; min-width: 0; }
#map-cloud-status:empty { display: none; }

@media (max-width: 560px) {
  .player-page > .player-identity { gap: 8px; padding-block: 12px 9px; }
  .player-identity img { width: 38px; height: 38px; }
  .player-identity nav { gap: 4px; }
  .player-identity .btn { min-height: 38px; padding: 5px 7px; font-size: 11px; }
  .settings-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .settings-selector { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 5px; }
  .settings-selector button:first-child { grid-column: span 2; }
  .player-page .settings-selector button { min-height: 42px; padding: 6px; }
  .settings-body { min-height: 130px; }
  .save-list .save-row { gap: 5px; }
}
