:root{
  --bg: #2b2b2b;
  --panel: #0b0b0b;
  --panel2: #111;
  --stroke: rgba(255,255,255,0.10);
  --stroke2: rgba(255,255,255,0.14);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
  --muted2: rgba(255,255,255,0.45);
  --accent: #8fe3ff;
  --accent2: #ffd65c;
  --danger: #ff6b6b;
}

*{ box-sizing: border-box; }

html, body{
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Monda", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.app{
  height: calc(100% - 56px);
  display: flex;
}

/* --- Sidebar --- */
.sidebar{
  width: 420px;
  max-width: 92vw;
  background: linear-gradient(180deg, #050505 0%, #0b0b0b 55%, #060606 100%);
  border-right: 1px solid var(--stroke);
  padding: 14px 14px 18px;
  overflow: auto;
}

.brand{
  display:flex;
  flex-direction:column;
  gap: 4px;
  padding: 10px 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  margin-bottom: 12px;
}
.brand__title{
  font-size: 20px;
  letter-spacing: 0.3px;
  font-weight: 700;
}
.brand__subtitle{
  font-size: 12.5px;
  color: var(--muted);
}

details{
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  overflow: hidden;
  margin-bottom: 12px;
}

summary{
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 10px 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
summary::-webkit-details-marker{ display:none; }

details[open] summary{
  background: rgba(255,255,255,0.05);
}

.row{
  display:flex;
  flex-wrap:wrap;
  gap: 10px 12px;
  align-items: center;
  padding: 10px 12px;
}

/* Used to visually disable a control row (e.g. tolerance slider in strict mode). */
.row.is-disabled{
  opacity: 0.55;
  cursor: not-allowed;
}

.row.is-disabled input[type="range"]{
  filter: grayscale(1);
}

input[type="range"]:disabled{
  opacity: 0.75;
}

input[type="range"]:disabled{
  cursor: not-allowed;
}

.row.fov-nudge{
  padding-top: 0;
}

.fov-warning{
  flex: 1 1 100%;
  color: #ff5b5b;
  font-size: 12px;
  line-height: 1.2;
}

.row.fov-nudge label.toggle{
  flex: 1 1 100%;
}

label{
  display:flex;
  align-items:center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

label.toggle{
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}

/* Small group for adjacent checkbox toggles in the sidebar */
.inline-toggles{
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
}

input[type="number"],
input[type="text"],
select,
textarea{
  color: var(--text);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 8px 10px;
  outline: none;
}

input[type="number"]{ width: 92px; }

/* /tp teleport input */
.tp-row .tp-label{ flex: 1 1 100%; }
.tp-row input[type="text"]{
  width: 100%;
  min-width: 260px;
}
.tp-row .hint{ margin-left: 0; }
.tp-row .hint.tp-error{ color: var(--danger); }
.hint.tp-error{ color: var(--danger); }

/* Grassfinder -> teleport (experimental) */
.crack-tp-row .crack-tp-label{ flex: 1 1 240px; }
.crack-tp-row .crack-tp-label select{ width: 100%; min-width: 220px; }
#crackTpTarget{ width: 86px; }
#crackTpOriginY{ width: 76px; }
#crackTpOut{
  width: calc(100% - 24px);
  margin: 0 12px 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}
.crack-tp-hint{
  padding: 0 12px 10px 12px;
  margin-top: -6px;
}


input[type="number"]:focus,
input[type="text"]:focus,
select:focus,
textarea:focus{
  border-color: rgba(143,227,255,0.45);
  box-shadow: 0 0 0 3px rgba(143,227,255,0.10);
}

input[type="range"]{
  width: 170px;
  accent-color: var(--accent);
}

input[type="checkbox"]{
  accent-color: var(--accent);
}

button{
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
button:hover{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.18);
}
button:active{ transform: translateY(1px); }

.hint{
  color: var(--muted2);
  font-size: 12px;
  margin-left: auto;
}

.readout{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  white-space: pre;
  color: rgba(255,255,255,0.88);
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: 10px 12px;
}

.list{
  width: 100%;
  max-width: 100%;
  min-width: 260px;
  background: rgba(0,0,0,0.25);
}

textarea#exportBox{
  width: calc(100% - 24px);
  margin: 0 12px 12px;
  min-height: 140px;
  resize: vertical;
  background: rgba(0,0,0,0.25);
  border-radius: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
}

.kbdhelp{
  display:flex;
  flex-wrap:wrap;
  gap: 8px 14px;
  font-size: 12.5px;
  color: rgba(255,255,255,0.72);
}
.kbdhelp b{ color: rgba(255,255,255,0.92); }

label.file{
  gap: 10px;
}
label.file input[type="file"]{
  width: 260px;
}

label.range{
  gap: 10px;
}
#gridRadiusLabel{
  color: rgba(255,255,255,0.86);
  font-weight: 700;
}

code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.88);
}

/* --- Workspace / viewport --- */
.workspace{
  flex: 1;
  display:flex;
  flex-direction:column;
  gap: 10px;
  padding: 18px;
  min-width: 0;
}

.viewport{
  position: relative;
  width: 960px;
  height: 540px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--stroke2);
  background: #060606;
  box-shadow: 0 14px 40px rgba(0,0,0,0.45);
}

#view{
  position:absolute;
  inset:0;
  width: 960px;
  height: 540px;
  display:block;
  touch-action: none;
}

.badge{
  position:absolute;
  right:12px;
  bottom:12px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.10);
  padding: 9px 11px;
  border-radius: 14px;
  font-size: 12px;
  display:flex;
  flex-direction:column;
  gap:6px;
  pointer-events:none;
  color: rgba(255,255,255,0.85);
}

.swatch{
  display:inline-block;
  width: 14px;
  height: 3px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 999px;
}
.swatch.grid{ background: #cfcfcf; }
.swatch.chunk{ background: var(--accent2); }
.swatch.sel{ background: #cc3333; }

.workspace__hint{
  color: rgba(255,255,255,0.55);
  font-size: 12px;
}

.workspace__help{
  color: rgba(255,255,255,0.72);
  font-size: 12px;
  line-height: 1.4;
}
.workspace__help b{ color: rgba(255,255,255,0.92); }

/* --- Bottom repo footer --- */
.repos{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  display:flex;
  align-items:center;
  gap: 14px;
  padding: 0 18px;
  background: rgba(0,0,0,0.72);
  border-top: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(8px);
  z-index: 30;
}
.repos__title{
  font-weight: 700;
  color: rgba(255,255,255,0.86);
  margin-right: 6px;
}
.repos a{
  color: rgba(143,227,255,0.9);
  text-decoration: none;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(143,227,255,0.12);
  background: rgba(143,227,255,0.06);
}
.repos a:hover{ background: rgba(143,227,255,0.10); }

/* Mojang/Microsoft disclaimer (bottom-right, subtle) */
.repos__disclaimer{
  margin-left: auto;
  padding-left: 12px;
  max-width: 440px;
  min-width: 0; /* allow shrinking inside flex */
  font-size: 10px;
  line-height: 1.15;
  max-height: 24px; /* ~2 lines; keeps the footer compact even without line-clamp support */
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.55);
  text-align: right;
  /* keep it compact */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* Bottom-right credit / GitHub link */
.gpt-credit{
  position: fixed;
  right: 12px;
  bottom: 64px; /* sit above the repo footer */
  z-index: 40;
  max-width: min(640px, calc(100vw - 24px));
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.25;
  color: rgba(255,255,255,0.86);
  text-decoration: none;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}
.gpt-credit:hover{
  color: rgba(255,255,255,0.95);
  border-color: rgba(143,227,255,0.25);
  background: rgba(143,227,255,0.08);
}

/* Scrollbar styling (webkit) */
.sidebar::-webkit-scrollbar{ width: 10px; }
.sidebar::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,0.35);
}
.sidebar::-webkit-scrollbar-thumb:hover{ background: rgba(255,255,255,0.14); }

@media (max-width: 1120px){
  .app{ flex-direction: column; }
  .sidebar{ width: auto; border-right: none; border-bottom: 1px solid var(--stroke); }
  .workspace{ align-items: center; }
}


/* Coordinate cracking UI */
.crack{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255,255,255,0.10);
}

.hidden{ display: none; }

.foliage-picker{
  position:absolute;
  left:10px;
  top:10px;
  z-index:6;
  padding:8px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius:12px;
  background:rgba(0,0,0,0.55);
  color:#fff;
  user-select:none;
}

.foliage-picker label{
  display:flex;
  align-items:center;
  gap:8px;
}

.foliage-picker select{
  font-size:12px;
  padding:4px 6px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.14);
  background:rgba(25,25,25,0.85);
  color:#fff;
}

.tex-indicator{
  position:absolute;
  left:10px;
  bottom:10px;
  font-size:12px;
  padding:6px 8px;
  border-radius:10px;
  background:rgba(0,0,0,0.55);
  color:#fff;
  pointer-events:none;
  user-select:none;
}

.warning{
  margin: 6px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 214, 92, 0.28);
  border-radius: 12px;
  background: rgba(255, 214, 92, 0.08);
  color: rgba(255,255,255,0.86);
  font-size: 12px;
}
#crackOut{
  width: 100%;
  min-height: 110px;
  margin-top: 8px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  background: rgba(0,0,0,0.28);
  color: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 10px 12px;
}

footer.disclaimer{
  padding: 10px 14px;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.25);
  text-align: center;
}


.variant-controls{
  margin-top:8px;
  display:flex;
  align-items:center;
  gap:10px;
  font-size:12px;
}
.variant-controls.hidden{ display:none; }
.variant-controls input{
  width:64px;
  font-size:12px;
  padding:4px 6px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.14);
  background:rgba(25,25,25,0.85);
  color:#fff;
}
.variant-controls select{
  font-size:12px;
  padding:4px 6px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.14);
  background:rgba(25,25,25,0.85);
  color:#fff;
}

.variant-controls .frame-btn{
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1;
}
.variant-controls .frame-label{
  min-width: 42px;
  text-align: center;
  color: rgba(255,255,255,0.85);
  font-variant-numeric: tabular-nums;
}


/* Top-right toggle over the canvas */
.canvas-topright{
  position:absolute;
  top:10px;
  right:10px;
  z-index: 20;
  pointer-events: auto;
  user-select: none;
  font-size: 12px;
  display:flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.canvas-topright .toggle{
  background: rgba(20,20,20,0.75);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 6px 10px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.canvas-topright .toggle input{
  transform: translateY(1px);
}

.canvas-topright .toggle select{
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 12px;
}

.canvas-topright .rp-controls{
  background: rgba(20,20,20,0.75);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 6px 10px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.canvas-topright .rp-controls input[type="file"]{
  display:none;
}
.canvas-topright .rp-controls button{
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 12px;
}
.canvas-topright .rp-name{
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255,255,255,0.75);
  font-size: 11px;
}

