body, button, input, dialog { font-family: var(--school-font); }
.school-modal { position: fixed; inset: 0; z-index: 20; display: grid; align-content: center; justify-items: center; gap: 24px; padding: 16px; background: rgba(17, 23, 16, .92); }
.school-modal img { width: min(90vw, 850px); max-height: 47vh; object-fit: contain; }
.school-modal p { margin-top: 0; }
.school-box, .school-float { color: white; background: #32382f; border: 2px solid #687360; box-shadow: 0 3px 0 #23271f; padding: 12px; }
.school-float { position: fixed; z-index: 8; top: 10px; touch-action:none; }
#school-chat { right: 109px; } #school-options { right: 10px; }
.school-box { text-align: center; } .school-box h2 { margin: 0 0 10px; font-size: 1.25rem; }
.school-box button { background: #535b4d; color: #fff; border: 1px solid #808b77; padding: 8px 10px; cursor: pointer; }
.school-box input:not([type=range]) { color: white; background: #21261e; border: 1px solid #808b77; padding: 8px; }
#school-chatbox { width: min(90vw, 560px); text-align: left; }
#school-log { height: min(35vh, 240px); overflow: auto; overflow-wrap: anywhere; }
#school-log p { margin: 0 0 6px; }
#school-form { display: flex; flex-wrap: wrap; gap: 8px; }
#school-message { flex: 1; min-width: 100px; }
[hidden] { display: none !important; }

#school-title { user-select: none; }
#school-main-title { position: fixed; z-index: 5; top: 8vh; left: 50%; transform: translateX(-50%); width: min(77vw, 760px); height: 31vh; object-fit: contain; pointer-events: none; }
#school-text { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
#school-inventory { top: 54px; right: 10px; }
#school-flight { top: 94px; right: 10px; }
#school-flight[aria-pressed="true"] { border-image-source: url("/school-ui/button-on.png"); }
#school-native-layout { position: fixed; z-index: 8; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); }
.school-game-button { font: 600 14px var(--school-font); color: #fff; border: 2px solid #161916; border-top-color: #b3b3ac; border-left-color: #b3b3ac; background: #666761; padding: 7px 14px; box-shadow: 0 0 0 1px #222; cursor: pointer; }
.school-game-button:hover { background: #7c8070; }
.school-setting { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 12px 0; }
.school-float { font-size: calc(.85rem * var(--control-scale, 1)); padding: calc(7px * var(--control-scale, 1)) calc(10px * var(--control-scale, 1)); }
.school-editing .school-float, .school-editing #school-text { visibility: hidden; }
#school-edit-preview { position: fixed; z-index: 9; inset: 0; background: #15191130; }
#school-edit-preview button { position: absolute; border: 1px dashed #dce8d5; background: #303a31dd; color: #fff; font: 600 clamp(8px, 1.7vw, 13px) var(--school-font); overflow: hidden; touch-action: none; cursor: grab; padding: 0; }
#school-edit-preview button[aria-pressed="true"] { border: 2px solid #caeabe; background: #48644a; }
#school-full-message { margin: 10px 0 0; font-size: .87rem; color: #f4d99a; }

#school-skin-settings { width: min(90vw, 420px); box-sizing: border-box; }
.school-skin-form { display: grid; gap: 8px; text-align: left; margin-bottom: 10px; }
.school-skin-form label { display: flex; align-items: center; gap: 8px; }
.school-skin-form input { min-width: 0; max-width: 80%; }
.school-skin-form select { min-width: 0; color: #fff; background: #21261e; border: 1px solid #808b77; padding: 6px; }
#school-skin-preview { width: 128px; height: 128px; image-rendering: pixelated; background: repeating-conic-gradient(#272e25 0 25%, #485143 0 50%) 0 / 16px 16px; }
#school-skin-status { min-height: 1.3em; margin: 8px 0; }
#school-skin-settings button:disabled { opacity: .55; }

#school-edit {
  position: fixed;
  z-index: 10;
  top: calc(env(safe-area-inset-top) + 46px);
  left: max(6px, env(safe-area-inset-left));
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  width: min(206px, calc(100vw - 12px));
  padding: 4px;
  font-size: .78rem;
}
#school-edit select { min-width: 0; font: inherit; color: #fff; background: #21261e; }
#school-edit button { font-size: inherit; padding: 6px; }
#school-layout-details { grid-column: span 2; text-align: left; padding-inline: 3px; }
#school-layout-details summary { cursor: pointer; padding: 4px 0; }
#school-layout-details label { display: flex; justify-content: space-between; align-items: center; margin-block: 4px; }
#school-layout-details input { width: 76px; }
#school-account { width: min(340px, calc(100vw - 28px)); box-sizing: border-box; max-height: 90dvh; }
#school-account-form { display: grid; gap: 8px; }
#school-account-form label { display: grid; gap: 4px; text-align: left; }
#school-account-form input { font-size: 16px; }
#school-account-status { font-size: .87rem; }

#school-view { font: inherit; color: white; background: #21261e; border: 1px solid #808b77; padding: 5px 7px; }

.school-float,
#school-chatbox button,
#school-settings button,
#school-palette-close {
  color: white;
  background: #666;
  border: 5px solid transparent;
  border-image: url("/school-ui/button.png") 5 fill stretch;
  box-shadow: none;
  image-rendering: pixelated;
  text-shadow: 1px 1px #252525;
}
.school-float:hover, .school-float:focus-visible,
#school-chatbox button:hover, #school-settings button:hover, #school-palette-close:hover {
  border-image-source: url("/school-ui/button-on.png");
}
#school-chatbox, #school-settings {
  background: #3a3a3a;
  border-color: #858585 #242424 #242424 #858585;
}
#school-chatbox input, #school-settings select {
  background: #222;
  border-color: #929292;
}
#school-hud {
  position: fixed;
  z-index: 5;
  container-type: size;
  display: grid;
  grid-template-columns: repeat(9,minmax(0,1fr));
  grid-template-rows: minmax(0,1fr);
  background: url("/school-ui/hotbar.png") 0 0 / 100% 100%;
  pointer-events: none;
  image-rendering: pixelated;
  color: #fff;
}
#school-hud.is-touch {
  grid-template-columns: repeat(10,minmax(0,1fr));
  background-size: 90% 100%;
  background-repeat: no-repeat;
}
.school-hud-slot {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  container-type: size;
}
.school-hud-more {
  background: url("/school-ui/hotbar.png") right center / 900% 100% no-repeat;
  font-size: .85rem;
  font-size: min(6.4cqw, 64cqh);
  line-height: 1;
  text-shadow: 1px 1px #252525;
}
.school-hud-slot .school-block-icon { width: min(68cqw, 68cqh); }
.school-hud-slot.is-selected::before {
  position: absolute;
  inset: 0;
  content: "";
  background: url("/school-ui/hotbar-selection.png") 0 0 / 100% 100%;
}
.school-block-icon {
  display: block;
  position: relative;
  width: 68%;
  aspect-ratio: 1;
  background: url("/school-block-pack.png") no-repeat;
  background-size: 1600% 1600%;
  image-rendering: pixelated;
}
#school-palette {
  width: min(680px,calc(100% - 20px));
  box-sizing: border-box;
  max-height: 94dvh;
  padding: 10px;
  border: 2px solid #171717;
  color: #161616;
  background: #d1d1d1;
  box-shadow: inset 2px 2px #f1f1f1,inset -2px -2px #666;
  font-family: var(--school-font);
}
#school-palette::backdrop { background: #111a; }
#school-palette header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
#school-palette h2 { font-size: 1rem; margin: 0; }
#school-palette-close { min-width: 34px; font-size: 1.1rem; line-height: 1.1; cursor: pointer; }
#school-palette-search {
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 6px;
  padding: 5px 7px;
  font-size: 16px;
  color: #fff;
  background: #2f2f2f;
  border: 1px solid #181818;
}
#school-palette-search::placeholder { color: #d1d1d1; }
#school-palette-tabs { display: flex; gap: 3px; overflow: auto; padding: 0 1px 4px; }
#school-palette-tabs button {
  flex: none;
  font: 600 .78rem var(--school-font);
  min-height: 31px;
  cursor: pointer;
  padding-inline: 9px;
  border: 4px solid transparent;
  border-image: url("/school-ui/tab.png") 4 fill stretch;
  background: #4c4c4c;
  color: #fff;
  image-rendering: pixelated;
}
#school-palette-tabs button[aria-pressed="true"] {
  border-image-source: url("/school-ui/tab-on.png");
  text-decoration: underline;
  text-underline-offset: 3px;
}
#school-palette-grid {
  min-height: 64px;
  max-height: min(45dvh,330px);
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(36px,1fr));
  align-content: start;
  gap: 2px;
  padding: 4px;
  background: #737373;
}
.school-block-slot {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: url("/school-ui/slot.png") 0 0 / 100% 100%;
  image-rendering: pixelated;
}
.school-block-slot:is(:hover,:focus-visible,.is-selected,[aria-pressed="true"]) {
  outline: 2px solid #fff;
  outline-offset: -2px;
}
#school-palette-message { margin: 7px 0 5px; font-size: .8rem; }
#school-palette-slots {
  margin: 0 auto;
  width: min(380px,100%);
  display: grid;
  grid-template-columns: repeat(9,minmax(0,1fr));
  gap: 2px;
}
@media (max-height: 430px) {
  #school-palette-grid { max-height: 29dvh; }
  #school-palette-slots { width: min(310px,100%); }
  #school-palette header { margin-bottom: 4px; }
}
#school-crosshair {
  position: fixed;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  width: 15px;
  height: 15px;
  pointer-events: none;
  image-rendering: pixelated;
  background: url("/school-ui/crosshair.png") center / contain;
  mix-blend-mode: difference;
}
