/* MYnecraft: EC Edition start menu.
   Link this after the game's own style block:
   <link rel="stylesheet" href="start-menu.css">
   Parent markup wraps #start in .start-shell and uses the section classes below.
   Control IDs stay #mode, #macekOutfit, #graphics, #modeHelp, #enter,
   #visitSchool, #overview, #travelForm, #travelX, #travelY, #travelZ,
   #travelStatus, #downloadWorld, #loadWorld, #worldFile, #backupStatus.
   Outfit previews: ./assets/macek-avatar-lanyard.png and ./assets/macek-avatar-black.png. */
@font-face {
  font-family: Bungee;
  src: url("assets/bungee/Bungee-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

html body #start {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-sizing: border-box;
  margin: 0;
  padding:
    max(16px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  background: #171615;
  color: #f8f6f2;
  cursor: default;
  text-align: left;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  transition: opacity .3s;
}

html body #start * { box-sizing: border-box; }
html body #start .area-label-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
html body #start .area-label-form label { display: flex; flex-direction: column; gap: 6px; flex: 1 1 220px; }
html body #start .area-label-form input { width: 100%; min-height: 44px; padding: 10px; font: inherit; border: 2px solid #888; border-radius: 4px; background: #fff; color: #171615; }
html body #start .area-label-form select { width: 100%; }

html body #start.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

html body #start .start-home { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 8px; color: #71b7e4; text-decoration: none; font-size: 14px; }
html body #start .start-home:hover { text-decoration: underline; }
html body #start .start-wide { flex-basis: 100%; }
html body #start .character-note { margin-bottom: 12px; }
html body #start .outfit-option span { display: flex; gap: 7px; align-items: center; }
html body #start .outfit-option small { font-weight: 400; color: #c4c0bc; }
html body #start #macekOutfit[hidden] { display: none; }
html body #start .start-settings #modeHelp { margin: 0 0 14px; }
html body #start #identityStatus { color: #a7d4f0; font-size: 12px; }
html body #start #worldClock { color: #a7d4f0; }

html body #start > h1,
html body #start > :last-child {
  margin-top: 0;
  margin-bottom: 0;
}

html body #start .start-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

html body #start .start-header,
html body #start .start-brand {
  min-width: 0;
}

html body #start h1,
html body #start .start-brand {
  font-family: Bungee, Impact, sans-serif;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.05;
}

html body #start h1 {
  margin: 0;
  font-size: clamp(28px, 8vw, 52px);
  color: #f8f6f2;
  text-shadow: 4px 4px 0 #070707;
  overflow-wrap: anywhere;
}

html body #start .edition {
  margin: 6px 0 0;
  color: #71b7e4;
  font-family: Bungee, Impact, sans-serif;
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 400;
  letter-spacing: 0.14em;
  opacity: 1;
}

html body #start .start-header p:not(.edition) {
  max-width: 62ch;
  margin: 10px 0 0;
  color: #c4c0bc;
  font-size: 14px;
  text-align: left;
}

html body #start .start-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}

html body #start .start-character-panel,
html body #start .start-settings,
html body #start .start-actions,
html body #start .start-save,
html body #start .start-advanced,
html body #start .travel {
  min-width: 0;
  background: #272524;
  border: 3px solid #4a4643;
  border-left-color: #070707;
  border-bottom-color: #070707;
  box-shadow: 2px 2px 0 #070707;
  padding: 14px;
}

html body #start .start-character-panel h2,
html body #start .start-settings h2,
html body #start .start-save h2 {
  margin: 0 0 10px;
  font-family: Bungee, Impact, sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

html body #start .outfit-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

html body #start .outfit-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  padding: 8px;
  background: #34312f;
  border: 3px solid #4a4643;
  color: #f8f6f2;
  cursor: pointer;
}

html body #start .outfit-option:has(input:checked),
html body #start .outfit-option:has(input:focus-visible) {
  border-color: #71b7e4;
}

html body #start .outfit-preview {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: contain;
  object-position: center bottom;
  background: #1d1b1a;
}

html body #start .outfit-option input {
  width: 21px;
  height: 21px;
  min-height: 21px;
  accent-color: #71b7e4;
}

html body #start label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  margin: 0 0 12px;
  color: #f8f6f2;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
}

html body #start .outfit-option {
  margin-bottom: 0;
  font-weight: 700;
}

html body #start .start-settings label:last-child,
html body #start label:last-child {
  margin-bottom: 0;
}

html body #start select,
html body #start button,
html body #start summary,
html body #start input[type="number"] {
  box-sizing: border-box;
  min-height: 44px;
  border-radius: 0;
  font-size: 16px;
}

html body #start select,
html body #start input[type="number"] {
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  background: #171615;
  color: #f8f6f2;
  border: 2px solid #4a4643;
}

html body #start button {
  padding: 10px 14px;
  background: #34312f;
  color: #f8f6f2;
  border: 2px solid #a7d4f0;
  border-bottom: 4px solid #376884;
  font-family: Bungee, Impact, sans-serif;
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.2;
  cursor: pointer;
}

html body #start button:hover {
  background: #3d3a37;
}

html body #start button:active {
  transform: translateY(1px);
}

html body #start #enter {
  width: 100%;
  min-height: 52px;
  background: #71b7e4;
  color: #102431;
  border: 2px solid #a7d4f0;
  border-bottom: 5px solid #376884;
  font-size: clamp(16px, 4vw, 22px);
}

html body #start #enter:hover {
  background: #9ed1f1;
}

html body #start .start-actions,
html body #start .start-save,
html body #start > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

html body #start .start-actions button,
html body #start .start-save button,
html body #start > div button {
  flex: 1 1 180px;
}

html body #start #modeHelp,
html body #start #backupStatus,
html body #start #travelStatus,
html body #start p {
  margin: 8px 0 0;
  color: #c4c0bc;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  opacity: 1;
  overflow-wrap: anywhere;
}

html body #start .start-save #backupStatus,
html body #start #backupStatus {
  flex: 1 1 100%;
  max-width: none;
}

html body #start #worldFile {
  display: none;
  min-height: 0;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
}

html body #start .travel,
html body #start .start-advanced {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-width: none;
  margin: 0;
}

html body #start .travel summary,
html body #start .start-advanced summary {
  color: #71b7e4;
  font-weight: 750;
  cursor: pointer;
}

html body #start #travelForm {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

html body #start #travelForm label {
  flex: 1 1 90px;
  width: auto;
  margin: 0;
}

html body #start #travelForm input {
  width: 100%;
  max-width: none;
}

html body #start button:focus-visible,
html body #start select:focus-visible,
html body #start input:focus-visible,
html body #start summary:focus-visible,
html body #start .outfit-option:focus-within {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

@media (max-width: 800px) {
  html body #start .start-grid {
    grid-template-columns: 1fr;
  }
  html body #start .outfit-preview {
    height: 140px;
  }
}

@media (max-width: 390px) {
  html body #start {
    padding-right: 10px;
    padding-left: 10px;
  }
  html body #start .start-actions button,
  html body #start .start-save button,
  html body #start > div button {
    flex-basis: 100%;
  }
}

@media (max-height: 700px) and (orientation: landscape) {
  html body #start .outfit-preview {
    height: 96px;
  }
  html body #start .start-grid {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html body #start,
  html body #start button {
    transition: none;
  }
}

/* Challenge progress sits under the status line. The old bottom anchor on a
   phone sat on top of the coordinate readout. */
#challengeProgress {
  position: fixed; z-index: 8;
  left: max(12px, env(safe-area-inset-left));
  top: 148px; bottom: auto;
  max-width: min(440px, calc(100vw - 24px));
  padding: 8px 12px; background: #171615dc; color: #fff;
  font: 12px/1.5 ui-monospace, monospace; pointer-events: none;
}
#challengeProgress[hidden] { display: none; }
/* The control bar occupies the top-left on a desktop window. Keep the keyboard
   reminder below the challenge line so it does not cover Menu or the status. */
#info { top: 196px; max-width: min(560px, calc(100vw - 24px)); }
@media (max-width: 1250px) {
  #info { display: none; }
  #status { top: 74px; max-width: calc(100vw - 40px); }
  #challengeProgress { top: 132px; }
}
@media (max-width: 600px) {
  #challengeProgress { top: 128px; bottom: auto; font-size: 11px; max-width: calc(100vw - 24px); }
  #controls { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); gap: 4px !important; }
  #controls > div { display: none; }
  #controls button, #controls a, #controls select { font-size: 12px; padding: 8px !important; min-height: 44px; }
  #status { top: 58px; font-size: 11px; max-width: calc(100vw - 24px); }
}
@media (max-height: 520px) {
  html body #start .outfit-preview { height: 72px; }
  html body #start .start-shell { gap: 8px; }
  #challengeProgress {
    top: 120px; bottom: auto;
    left: max(8px, env(safe-area-inset-left));
    box-sizing: border-box;
    max-width: min(52vw, 360px);
    font-size: 11px;
  }
  #mouseHint { display: none; }
}

/* Staff choices show the same voxel models used by the playable avatars. */
html body #start:has(#staffChoices) .start-shell { width: min(1180px, 100%); }
html body #start:has(#staffChoices) .start-grid {
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
}
html body #start #staffChoices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
html body #start .staff-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 8px;
  color: #f8f6f2;
  background: #1c222b;
  border: 2px solid #4a515d;
  border-radius: 8px;
  cursor: pointer;
}
html body #start .staff-choice:hover { border-color: #a7d4f0; background: #252e3b; }
html body #start .staff-choice:has(input:checked) {
  border-color: #86d5ff;
  background: #213448;
  box-shadow: inset 0 0 0 1px #86d5ff;
}
html body #start .staff-choice:focus-within {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
html body #start .staff-choice span {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
}
html body #start .staff-choice small {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  color: #c6d4e2;
}
html body #start .staff-choice input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: #86d5ff;
}
html body #start .staff-preview {
  display: block;
  width: 100%;
  height: 152px;
  border-radius: 4px;
  object-fit: contain;
  background: radial-gradient(ellipse at 50% 45%, #405268, #18202a 78%);
}
html body #start .staff-choice[data-character="eriksen"] .staff-preview {
  background: radial-gradient(ellipse at 50% 45%, #634b78, #261d35 78%);
}
html body #start .staff-choice[data-character="mullet"] .staff-preview {
  background: radial-gradient(ellipse at 50% 45%, #465f50, #1a2a24 78%);
}
html body #start .staff-choice[data-character="mcmichael"] .staff-preview {
  background: radial-gradient(ellipse at 50% 45%, #776651, #332921 78%);
}
html body #start:has(#staffChoices) #identityStatus { margin-bottom: 0; min-height: 36px; }
/* A visible first-minute guide keeps the essential controls above the options. */
html body #start .first-minute {
  padding: 22px;
  border: 1px solid #587690;
  border-radius: 16px;
  background: linear-gradient(135deg, #22394b, #19252f 68%);
  box-shadow: 0 12px 34px #0004;
}
html body #start .first-minute-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
html body #start .guide-eyebrow { color: #9bdfbc; font-size: 11px; font-weight: 800; letter-spacing: .16em; }
html body #start .first-minute h2 { margin: 3px 0 0; font-size: clamp(21px, 3vw, 29px); line-height: 1.15; }
html body #start .guide-mode { flex: 0 0 auto; padding: 8px 12px; border: 1px solid #77ba98; border-radius: 20px; color: #d0f3dc; font-size: 12px; font-weight: 700; }
html body #start .play-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; list-style: none; padding: 0; margin: 0; }
html body #start .play-steps li { display: flex; gap: 10px; min-width: 0; }
html body #start .step-number { flex: 0 0 27px; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; background: #aedcfa; color: #152c40; font-weight: 900; }
html body #start .play-steps h3 { margin: 2px 0 7px; font-size: 16px; line-height: 1.25; color: #fff; }
html body #start .play-steps p { margin: 0 0 5px; color: #d6e1e9; font-size: 13px; line-height: 1.6; }
html body #start kbd { display: inline-block; padding: 0 5px; border: 1px solid #68869b; border-bottom-width: 2px; border-radius: 4px; background: #102330; color: #eff8ff; font: 700 12px/1.6 system-ui, sans-serif; }
html body #start .flight-guide { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 18px; padding: 12px 14px; border: 1px solid #657b90; border-radius: 9px; background: #0c1d2a99; }
html body #start .flight-guide > strong { color: #f8dca2; font-size: 14px; }
html body #start .flight-guide p { margin: 0; color: #e1eaf1; font-size: 13px; }
html body #start .flight-guide p > span { padding: 0 5px; color: #96aab9; }
html body #start .flight-guide small { width: 100%; color: #b5c9d7; font-size: 12px; }
html body #start .class-reminder { margin: 12px 0 0; color: #bfd1dd; font-size: 12px; }
html body #start .touch-help { display: none; }
html body.touch-device #start .touch-help { display: block; }
html body.touch-device #start .desktop-help { display: none; }
html body #start .play-options { margin-top: 18px; border-top: 1px solid #58616b; padding-top: 10px; }
html body #start .play-options > summary { padding: 7px 0; cursor: pointer; font-size: 14px; color: #bde3ff; font-weight: 700; }
html body #start .play-options[open] > summary { margin-bottom: 10px; }
html body #start .start-settings { align-self: start; }
@media (max-width: 900px) {
  html body #start .play-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  html body #start .first-minute { padding: 16px; }
  html body #start .first-minute-heading { display: block; }
  html body #start .guide-mode { display: inline-block; margin-top: 10px; }
  html body #start .play-steps { grid-template-columns: 1fr; gap: 15px; }
}
@media (max-width: 900px) {
  html body #start:has(#staffChoices) .start-grid { grid-template-columns: 1fr; }
  html body #start .staff-preview { height: 155px; }
}
@media (max-width: 520px) {
  html body #start #staffChoices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html body #start .staff-preview { height: 138px; }
}
@media (max-height: 700px) and (min-width: 901px) {
  html body #start .staff-preview { height: 118px; }
}

/* Large, named block choices use the same textures as the world and hotbar. */
#inventoryOverlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: #071019d9; overflow-y: auto; }
#inventoryOverlay[hidden] { display: none; }
.inventory-sheet { box-sizing: border-box; width: min(780px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; border: 1px solid #658aa7; border-radius: 16px; background: #1b2a36; color: #f4f8fc; box-shadow: 0 20px 80px #0008; font: 15px/1.45 system-ui, sans-serif; }
.inventory-sheet h2 { margin: 0 0 6px; font-size: 28px; }
.inventory-sheet p { margin: 0 0 18px; color: #cbdce9; }
.inventory-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.inventory-choice { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 118px; padding: 8px 4px; border: 2px solid #536d81; border-radius: 10px; background: #293e4e; color: #f4f8fc; cursor: pointer; font: inherit; }
.inventory-choice strong { font-size: 12px; }
.inventory-count { color: #b3d7e9; font-size: 11px; }
.inventory-choice:hover { border-color: #b9e1fa; background: #34536a; }
.inventory-choice[aria-pressed="true"] { border-color: #a5e5b9; background: #264837; }
.inventory-choice:disabled { opacity: .48; cursor: default; }
.inventory-choice:focus-visible, .inventory-back:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.inventory-sheet .inventory-hint { margin: 16px 0 12px; font-size: 13px; }
.inventory-back { display: block; min-height: 44px; margin-left: auto; padding: 10px 18px; border: 1px solid #9cc5df; border-radius: 8px; background: #c4e5fa; color: #172d3c; font: 700 14px system-ui, sans-serif; cursor: pointer; }
@media (max-width: 700px) { .inventory-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 430px) { .inventory-sheet { padding: 16px; } .inventory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .inventory-choice { min-height: 110px; } }
