html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #101316;
  color: #f4f0e8;
  font-family: "Marcellus", serif;
  touch-action: none;
}

.game-3d,
.game-3d-overlay,
.menu-root {
  position: fixed;
  inset: 0;
}

.game-3d {
  display: block;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

.game-3d-overlay {
  display: block;
  width: 100vw;
  height: 100vh;
  z-index: 2;
  pointer-events: none;
  background: transparent;
}

.inventory-root {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(7, 9, 10, 0.62);
}

.map-root {
  position: fixed;
  inset: 0;
  z-index: 13;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 18px;
  box-sizing: border-box;
  background: rgba(5, 7, 8, 0.72);
  color: #f4f0e8;
  pointer-events: auto;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.map-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.map-title h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

.map-subtitle {
  overflow: hidden;
  color: rgba(244, 240, 232, 0.68);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #f4f0e8;
  font: inherit;
  cursor: pointer;
}

.map-canvas-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #0a0d0e;
}

.map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  image-rendering: pixelated;
}

.map-canvas.is-dragging {
  cursor: grabbing;
}

.map-legend {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 6px 14px;
  padding: 10px 12px;
  background: rgba(8, 12, 16, 0.74);
  font-size: 12px;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.map-legend-swatch {
  width: 12px;
  height: 12px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.map-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  max-width: min(360px, calc(100% - 28px));
  padding: 8px 10px;
  background: rgba(8, 12, 16, 0.66);
  color: rgba(244, 240, 232, 0.72);
  font-size: 12px;
  line-height: 1.35;
}

.inventory-panel {
  width: min(720px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  padding: 18px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(13, 17, 18, 0.94);
  overflow: auto;
}

.inventory-panel.inventory-panel-shader {
  border-color: rgba(86, 212, 222, 0.3);
  background:
    linear-gradient(135deg, rgba(34, 48, 52, 0.96), rgba(8, 10, 12, 0.95)),
    rgba(13, 17, 18, 0.94);
  box-shadow:
    0 22px 80px rgba(0, 0, 0, 0.46),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.inventory-panel-shader .inventory-slot {
  border-color: rgba(146, 230, 232, 0.22);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(6, 9, 10, 0.3)),
    rgba(20, 29, 31, 0.8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -3px 0 rgba(0, 0, 0, 0.26);
}

.inventory-panel-shader .inventory-item {
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, 0.13), transparent 48%),
    rgba(255, 255, 255, 0.055);
}

.inventory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.inventory-head h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0;
}

.inventory-close,
.inventory-tab,
.inventory-slot {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: #f4f0e8;
  font: inherit;
  cursor: pointer;
}

.inventory-close {
  width: 36px;
  height: 36px;
  padding: 0;
}

.inventory-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.inventory-tab {
  min-height: 34px;
  padding: 0 12px;
}

.inventory-tab.is-active {
  border-color: rgba(255, 223, 122, 0.64);
  background: rgba(255, 223, 122, 0.15);
}

.inventory-carried {
  margin-bottom: 12px;
  color: rgba(244, 240, 232, 0.7);
  font-size: 13px;
}

.inventory-section-title {
  margin: 12px 0 7px;
  color: rgba(244, 240, 232, 0.72);
  font-size: 13px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(48px, 1fr));
  gap: 6px;
}

.inventory-slot {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  padding: 4px;
  overflow: hidden;
}

.inventory-slot.is-empty {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    rgba(0, 0, 0, 0.24);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}

.inventory-slot.is-selected {
  border-color: rgba(255, 223, 122, 0.78);
  box-shadow: inset 0 0 0 2px rgba(255, 223, 122, 0.2);
}

.inventory-slot:hover {
  border-color: rgba(255, 223, 122, 0.54);
}

.inventory-grid-creative {
  grid-template-columns: repeat(6, minmax(76px, 1fr));
}

.inventory-creative-slot {
  aspect-ratio: auto;
  min-height: 92px;
  display: grid;
  grid-template-rows: minmax(48px, 1fr) auto;
  gap: 5px;
}

.inventory-creative-slot .inventory-item {
  min-height: 48px;
}

.inventory-creative-label {
  display: -webkit-box;
  min-height: 26px;
  overflow: hidden;
  color: rgba(244, 240, 232, 0.82);
  font-size: 11px;
  line-height: 1.18;
  text-align: center;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.inventory-item {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.12);
}

.inventory-icon {
  width: min(82%, 48px);
  height: min(82%, 48px);
  image-rendering: pixelated;
}

.inventory-item-count {
  position: absolute;
  right: 6px;
  bottom: 4px;
  color: #ffdf7a;
  font-size: 12px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.inventory-hotbar-wrap {
  margin-top: 14px;
}

.inventory-hotbar {
  display: grid;
  grid-template-columns: repeat(10, minmax(42px, 1fr));
  gap: 6px;
}

.inventory-craft-list {
  display: grid;
  gap: 8px;
}

.inventory-craft-recipe {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.045);
}

.inventory-craft-main {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: rgba(244, 240, 232, 0.78);
  font-size: 13px;
}

.inventory-craft-main strong {
  color: #fff8e8;
  font-size: 15px;
}

.inventory-craft-missing {
  color: #ff9d7a;
}

.inventory-craft-result {
  display: grid;
  grid-template-columns: 54px auto;
  gap: 8px;
  align-items: center;
}

.inventory-craft-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 223, 122, 0.48);
  background: rgba(255, 223, 122, 0.16);
  color: #fff8e8;
  font: inherit;
  cursor: pointer;
}

.inventory-craft-button:disabled {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(244, 240, 232, 0.36);
  cursor: default;
}

.inventory-cursor-item {
  position: fixed;
  z-index: 20;
  width: 52px;
  height: 52px;
  pointer-events: none;
  transform: translate(12px, 12px);
}

.inventory-cursor-item .inventory-item {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 223, 122, 0.54);
  box-sizing: border-box;
}

.note-editor-root {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(6, 8, 9, 0.68);
  pointer-events: auto;
}

.note-editor-panel {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto;
  gap: 10px;
  width: min(680px, 100%);
  height: min(560px, calc(100vh - 48px));
  padding: 14px;
  box-sizing: border-box;
  border: 2px solid #2d2419;
  background: #d9c891;
  color: #2b2119;
  box-shadow:
    inset 0 0 0 3px rgba(255, 245, 190, 0.28),
    0 18px 44px rgba(0, 0, 0, 0.52);
  font-family: "Courier New", monospace;
  image-rendering: pixelated;
}

.note-editor-head,
.note-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.note-editor-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}

.note-editor-text {
  width: 100%;
  min-width: 0;
  resize: none;
  padding: 12px;
  box-sizing: border-box;
  border: 2px solid #6b5130;
  background:
    repeating-linear-gradient(0deg, rgba(80, 58, 32, 0.08) 0, rgba(80, 58, 32, 0.08) 1px, transparent 1px, transparent 22px),
    #f0e6c8;
  color: #2b2119;
  font: 16px/1.4 "Courier New", monospace;
  letter-spacing: 0;
  outline: none;
}

.note-editor-text[readonly] {
  background:
    repeating-linear-gradient(0deg, rgba(80, 58, 32, 0.08) 0, rgba(80, 58, 32, 0.08) 1px, transparent 1px, transparent 22px),
    #e6d6a6;
}

.note-editor-close,
.note-editor-button {
  min-height: 34px;
  padding: 0 12px;
  border: 2px solid #4c3922;
  background: #8f6a3d;
  color: #fff3cf;
  font: 14px "Courier New", monospace;
  cursor: pointer;
}

.note-editor-close {
  width: 36px;
  padding: 0;
}

.menu-root {
  position: fixed;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background:
    linear-gradient(180deg, rgba(19, 29, 24, 0.36), rgba(8, 10, 10, 0.68)),
    url("../assets/menu-background.png") center / cover no-repeat,
    linear-gradient(180deg, #9ed3e8, #5d8e35);
  overflow: auto;
}

.menu-root.is-pause-menu {
  background: rgba(7, 9, 10, 0.58);
}

.menu-panel {
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(12, 16, 18, 0.86);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38);
}

.pause-panel {
  width: min(360px, 100%);
}

.menu-panel-wide {
  width: min(920px, 100%);
}

.menu-panel-main {
  width: min(420px, 100%);
  text-align: center;
}

.menu-title {
  margin: 0 0 6px;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.menu-title-cubic {
  color: #fff4cf;
  font-family: Arial, sans-serif;
  font-size: 52px;
  font-weight: 900;
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow:
    0 4px 0 #654621,
    4px 0 0 #9a6d32,
    4px 4px 0 #3a2817,
    0 10px 22px rgba(0, 0, 0, 0.56);
}

.menu-subtitle {
  margin: 0 0 22px;
  color: rgba(244, 240, 232, 0.72);
  font-size: 15px;
}

.menu-field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: rgba(244, 240, 232, 0.82);
  font-size: 14px;
}

.menu-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  margin-bottom: 14px;
  color: rgba(244, 240, 232, 0.86);
  font-size: 14px;
}

.menu-check input {
  width: 17px;
  height: 17px;
  margin: 0;
}

.menu-field input,
.menu-field select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #f4f0e8;
  font: inherit;
  outline: none;
}

.menu-field select option {
  background: #211d1b;
  color: #f4f0e8;
}

.cavern-fall-link {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 31;
  padding: 8px 11px;
  border: 1px solid rgba(255, 223, 122, 0.58);
  background: rgba(18, 17, 14, 0.78);
  color: #ffe8a0;
  font-size: 13px;
  text-decoration: none;
  pointer-events: auto;
}

.cavern-fall-link:hover,
.cavern-fall-link:focus-visible {
  background: rgba(56, 48, 29, 0.9);
  color: #fff4cf;
}

.menu-mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.menu-mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

.menu-mode-option input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.menu-field input:focus,
.menu-field select:focus {
  border-color: rgba(255, 223, 122, 0.76);
}

.menu-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.menu-actions-main {
  display: grid;
  grid-template-columns: 1fr;
}

.menu-skin-block {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: center;
  margin: 0 0 16px;
  padding: 10px;
  border: 1px solid rgba(86, 212, 222, 0.22);
  background: rgba(255, 255, 255, 0.055);
}

.menu-main-skin {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: center;
  margin: 0 0 14px;
  padding: 10px;
  border: 1px solid rgba(255, 223, 122, 0.26);
  background: rgba(0, 0, 0, 0.2);
  text-align: left;
}

.skin-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.skin-choice {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: #f4f0e8;
  font: inherit;
  cursor: pointer;
}

.skin-choice.is-selected {
  border-color: rgba(86, 212, 222, 0.72);
  background: rgba(42, 164, 176, 0.16);
}

.skin-choice-name {
  font-weight: 700;
}

.skin-choice-desc {
  color: rgba(244, 240, 232, 0.64);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
}

.skin-preview {
  position: relative;
  width: 74px;
  height: 108px;
  image-rendering: pixelated;
}

.skin-preview-small {
  width: 96px;
  height: 132px;
}

.skin-head,
.skin-body span {
  position: absolute;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset -5px -7px 0 rgba(0, 0, 0, 0.18);
}

.skin-head {
  left: 21px;
  top: 4px;
  width: 32px;
  height: 32px;
  background: #efb77f;
}

.skin-preview-small .skin-head {
  left: 28px;
  width: 40px;
  height: 40px;
}

.skin-hair {
  position: absolute;
  background: var(--hair);
}

.skin-hair-top {
  left: -2px;
  top: -4px;
  width: calc(100% + 4px);
  height: 15px;
}

.skin-hair-left {
  left: -2px;
  top: 8px;
  width: 8px;
  height: 17px;
}

.skin-hair-right {
  right: -2px;
  top: 8px;
  width: 8px;
  height: 17px;
}

.skin-hair-left.is-long,
.skin-hair-right.is-long {
  height: 48px;
}

.skin-bow {
  position: absolute;
  right: 1px;
  top: 1px;
  width: 11px;
  height: 8px;
  background: #25b8c5;
}

.skin-eye {
  position: absolute;
  top: 16px;
  width: 7px;
  height: 9px;
  background: #f8f8f8;
}

.skin-eye::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 1px;
  width: 3px;
  height: 7px;
  background: var(--eye);
}

.skin-eye-left {
  left: 7px;
}

.skin-eye-right {
  right: 7px;
}

.skin-torso {
  left: 22px;
  top: 38px;
  width: 30px;
  height: 38px;
  background:
    linear-gradient(90deg, transparent 38%, var(--accent) 39%, var(--accent) 47%, transparent 48%),
    #111518;
}

.skin-preview-small .skin-torso {
  left: 29px;
  top: 48px;
  width: 38px;
  height: 46px;
}

.skin-arm {
  top: 40px;
  width: 13px;
  height: 38px;
  background:
    linear-gradient(180deg, #111518 0 72%, var(--accent) 73% 84%, #efb77f 85%),
    #111518;
}

.skin-preview-small .skin-arm {
  top: 50px;
  width: 16px;
  height: 45px;
}

.skin-arm-left {
  left: 7px;
}

.skin-arm-right {
  right: 7px;
}

.skin-leg {
  top: 77px;
  width: 14px;
  height: 28px;
  background:
    linear-gradient(180deg, var(--pants) 0 70%, #0f1518 71% 84%, #f2f2f2 85%),
    var(--pants);
}

.skin-preview-small .skin-leg {
  top: 95px;
  width: 17px;
  height: 34px;
}

.skin-leg-left {
  left: 22px;
}

.skin-leg-right {
  right: 22px;
}

.menu-btn {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #f4f0e8;
  font: inherit;
  cursor: pointer;
}

.menu-btn-primary {
  border-color: rgba(255, 223, 122, 0.62);
  background: rgba(255, 223, 122, 0.16);
}

.education-grid {
  display: grid;
  gap: 8px;
}

.education-grid-countries {
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  max-height: min(420px, calc(100vh - 220px));
  overflow-y: auto;
}

.education-grid-grades {
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
}

.education-grid-subjects {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.education-grid-lessons {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  max-height: min(460px, calc(100vh - 220px));
  overflow-y: auto;
}

.education-option,
.education-subject,
.education-lesson {
  justify-content: center;
  min-width: 0;
}

.education-subject,
.education-lesson {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.education-subject-status {
  min-width: 16px;
  color: #9dffb5;
  font-weight: 700;
  white-space: nowrap;
}

.education-lesson-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.education-lesson-topic {
  overflow: hidden;
  color: rgba(244, 240, 232, 0.66);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-code-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.lesson-code-select {
  flex: 1 1 220px;
  margin: 0;
}

.lesson-code-select select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #f4f0e8;
  font: inherit;
  outline: none;
}

.lesson-code-workspace {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 14px;
}

.lesson-code-stage {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-height: min(560px, calc(100vh - 260px));
  overflow-y: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
    rgba(0, 0, 0, 0.18);
  background-size: 24px 24px;
}

.lesson-code-stack {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 174, 66, 0.42);
  border-radius: 8px;
  background: rgba(235, 142, 34, 0.15);
}

.lesson-code-stack-complete {
  border-color: rgba(85, 198, 106, 0.42);
  background: rgba(65, 175, 88, 0.14);
}

.lesson-code-stack h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.lesson-code-stack-body,
.lesson-code-palette {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.lesson-code-palette {
  align-content: start;
  max-height: min(560px, calc(100vh - 260px));
  overflow-y: auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.lesson-code-palette-group {
  display: grid;
  gap: 8px;
}

.lesson-code-palette-group + .lesson-code-palette-group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.lesson-code-palette-group h2 {
  margin: 0;
  color: rgba(244, 240, 232, 0.72);
  font-size: 13px;
  line-height: 1.2;
}

.lesson-code-palette-block {
  justify-content: flex-start;
  border-radius: 8px;
  background: #d9822b;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
  text-align: left;
}

.lesson-code-palette-group + .lesson-code-palette-group .lesson-code-palette-block {
  background: #39a85a;
}

.lesson-code-stack-body {
  min-height: 54px;
}

.lesson-code-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 8px 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px 6px 6px 8px;
  background: #d9822b;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
  color: #fff8e8;
  font-size: 13px;
  line-height: 1.25;
  position: relative;
}

.lesson-code-block::before,
.lesson-code-block::after {
  content: "";
  position: absolute;
  left: 18px;
  width: 34px;
  height: 8px;
  border-radius: 0 0 5px 5px;
  background: rgba(0, 0, 0, 0.18);
}

.lesson-code-block::before {
  top: -1px;
}

.lesson-code-block::after {
  bottom: -8px;
  background: inherit;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-top: 0;
}

.lesson-code-block-place,
.lesson-code-block-mine,
.lesson-code-block-biome {
  background: #39a85a;
}

.lesson-code-block-say {
  background: #7f62d9;
}

.lesson-code-block-thumbnail {
  background: #2f9bc8;
}

.lesson-code-block-content {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.lesson-code-block-content span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lesson-code-param {
  min-height: 30px;
  max-width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: #201812;
  font: inherit;
}

.lesson-code-param-wide {
  width: min(260px, 100%);
}

.lesson-code-param-small {
  width: 64px;
  padding: 0 6px;
}

.lesson-code-param-label {
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
}

.lesson-code-remove {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.2);
  color: #f4f0e8;
  cursor: pointer;
}

.lesson-code-empty {
  color: rgba(244, 240, 232, 0.58);
  font-size: 13px;
}

.lesson-code-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.lesson-code-file input {
  display: none;
}

.menu-hint {
  margin-top: 14px;
  color: rgba(244, 240, 232, 0.62);
  font-size: 13px;
  line-height: 1.4;
}

.saved-worlds {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.saved-worlds-title {
  margin-bottom: 10px;
  color: rgba(244, 240, 232, 0.82);
  font-size: 14px;
}

.saved-worlds-empty {
  color: rgba(244, 240, 232, 0.56);
  font-size: 13px;
}

.saved-worlds-list {
  display: grid;
  gap: 8px;
  max-height: 184px;
  overflow-y: auto;
}

.saved-world-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.saved-world-load,
.saved-world-delete {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: #f4f0e8;
  font: inherit;
  cursor: pointer;
}

.saved-world-load {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 7px 10px;
  text-align: left;
}

.saved-world-name,
.saved-world-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-world-name {
  font-size: 14px;
}

.saved-world-meta {
  color: rgba(244, 240, 232, 0.58);
  font-size: 12px;
}

.saved-world-delete {
  padding: 0;
}

.calculator-root {
  position: fixed;
  right: 18px;
  bottom: 96px;
  z-index: 28;
  width: min(360px, calc(100vw - 24px));
  pointer-events: auto;
}

.tnt-table-root {
  inset: 0;
  right: auto;
  bottom: auto;
  display: grid;
  place-items: center;
  width: 100vw;
  min-height: 100vh;
  padding: 24px;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 50% 35%, rgba(204, 62, 45, 0.22), transparent 38%),
    rgba(8, 10, 12, 0.92);
}

.calculator-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(24, 28, 32, 0.94);
  color: #f4f0e8;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
}

.calculator-title {
  font-size: 16px;
  font-weight: 700;
}

.calculator-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.calculator-input {
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
  color: #f4f0e8;
  font: inherit;
}

.calculator-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tnt-table-panel .calculator-actions {
  grid-template-columns: 1fr 1fr;
}

.tnt-table-panel {
  width: min(720px, 100%);
  gap: 14px;
  padding: 24px;
}

.tnt-table-panel .calculator-title {
  font-size: 28px;
}

.tnt-table-field,
.tnt-table-check {
  display: grid;
  gap: 6px;
  color: rgba(244, 240, 232, 0.82);
  font-size: 13px;
}

.tnt-table-check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.calculator-actions button,
.calculator-close {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #f4f0e8;
  font: inherit;
  cursor: pointer;
}

.calculator-actions button {
  font-size: 18px;
  font-weight: 700;
}

.calculator-actions button:hover,
.calculator-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.calculator-result {
  min-height: 20px;
  color: rgba(244, 240, 232, 0.74);
  font-size: 13px;
  line-height: 1.35;
}

.pets-root {
  position: fixed;
  inset: 0;
  z-index: 16;
  pointer-events: none;
}

.pets-open-button {
  position: absolute;
  top: 18px;
  left: 18px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 223, 164, 0.52);
  border-radius: 9px;
  background: rgba(31, 22, 19, 0.82);
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3);
  color: #fff4d5;
  font: 700 14px "Marcellus", serif;
  cursor: pointer;
  pointer-events: auto;
}

.pets-open-button:hover {
  background: rgba(63, 43, 34, 0.94);
  transform: translateY(-1px);
}

.pets-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 10, 0.64);
  backdrop-filter: blur(2px);
  pointer-events: auto;
}

.pets-dialog,
.pet-mode-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(560px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  box-sizing: border-box;
  padding: 24px;
  border: 1px solid rgba(255, 218, 151, 0.46);
  border-radius: 16px;
  background: linear-gradient(155deg, rgba(50, 37, 31, 0.98), rgba(18, 23, 25, 0.98));
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.56);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.pets-dialog h2,
.pet-mode-dialog h3 {
  margin: 0 0 6px;
  color: #ffe0a3;
}

.pets-close-button {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #fff4df;
  font-size: 27px;
  cursor: pointer;
}

.pets-limit,
.pets-cap-note,
.pet-empty {
  color: rgba(244, 240, 232, 0.72);
  font-size: 13px;
  line-height: 1.4;
}

.pet-create-form {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr auto;
  gap: 10px;
  align-items: end;
  margin: 18px 0;
  padding: 14px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.055);
}

.pet-create-form label {
  display: grid;
  gap: 6px;
  color: rgba(255, 245, 224, 0.82);
  font-size: 12px;
}

.pet-create-form select,
.pet-create-form input,
.pet-create-form button,
.pet-hide-button,
.pet-resume-button,
.pet-status-button,
.pet-mode-dialog button {
  min-height: 38px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff8e8;
  font: inherit;
}

.pet-create-form select,
.pet-create-form input {
  width: 100%;
  padding: 0 10px;
}

.pet-create-form button,
.pet-hide-button,
.pet-resume-button,
.pet-mode-dialog button {
  padding: 0 13px;
  cursor: pointer;
}

.pet-create-form button,
.pet-mode-dialog button.is-selected {
  border-color: rgba(255, 208, 122, 0.56);
  background: rgba(180, 119, 55, 0.42);
}

.pet-hide-button {
  border-color: rgba(255, 208, 122, 0.38);
  background: rgba(124, 83, 47, 0.3);
}

.pets-carrier-title {
  margin: 18px 0 9px;
  color: #ffe0a3;
  font-size: 17px;
}

.pet-collection {
  display: grid;
  gap: 8px;
}

.pet-collection-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, auto);
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border-left: 4px solid #d69a58;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.pet-kind-parrot { border-left-color: #48b96d; }
.pet-kind-capybara { border-left-color: #a8754b; }
.pet-kind-dog { border-left-color: #d99b61; }
.pet-kind-cat { border-left-color: #e9a85e; }

.pet-collection-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pet-collection-copy strong {
  overflow: hidden;
  color: #fff1ce;
  text-overflow: ellipsis;
}

.pet-collection-copy span {
  color: rgba(244, 240, 232, 0.62);
  font-size: 12px;
}

.pet-status-button:disabled,
.pet-resume-button:disabled {
  opacity: 0.48;
  cursor: default;
}

.pet-mode-dialog {
  width: min(340px, calc(100vw - 32px));
  text-align: center;
}

.pet-mode-dialog button {
  display: block;
  width: 100%;
  margin-top: 8px;
}

.is-hidden {
  display: none;
}

@media (max-width: 760px) {
  .menu-root {
    align-items: flex-start;
    padding: 16px;
  }

  .menu-panel {
    padding: 18px;
  }

  .menu-title-cubic {
    font-size: 38px;
  }

  .menu-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .lesson-code-toolbar,
  .lesson-code-workspace {
    display: grid;
    grid-template-columns: 1fr;
  }

  .lesson-code-stage,
  .lesson-code-palette {
    max-height: none;
  }

  .calculator-root {
    right: 12px;
    bottom: 82px;
  }

  .pets-open-button {
    top: 12px;
    left: 12px;
  }

  .pets-open-button span {
    display: none;
  }

  .pet-create-form,
  .pet-collection-row {
    grid-template-columns: 1fr;
  }
}
