:root{
  --bg1:#87ceeb; 
  --menu:#0e1622; 
  --muted:#9fb3c8; 
  --accent1:#3b82f6; 
  --accent2:#06b6d4;
  --success:#10b981;
  --danger:#ef4444;
  --warning:#f59e0b;
  --purple:#8b5cf6;
}

*{
  box-sizing:border-box;
  margin:0;
  padding:0;
}

html,body{
  height:100%;
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;
  background:linear-gradient(180deg,var(--bg1),#cfeaff);
  overflow:hidden;
  user-select:none;
}

canvas{
  display:block;
  width:100%;
  height:100%;
  cursor:none;
}

/* Overlay menu */
.overlay{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(180deg,rgba(0,0,0,.7),rgba(0,0,0,.4));
  z-index:100;
  backdrop-filter:blur(10px);
  animation:fadeIn 0.3s ease-out;
}

@keyframes fadeIn{
  from{opacity:0}
  to{opacity:1}
}

.card{
  background:var(--menu);
  padding:28px;
  border-radius:20px;
  min-width:480px;
  max-width:560px;
  color:#fff;
  box-shadow:0 25px 70px rgba(0,0,0,.8);
  border:2px solid rgba(255,255,255,.08);
  max-height:90vh;
  overflow-y:auto;
  animation:slideUp 0.4s ease-out;
}

@keyframes slideUp{
  from{
    opacity:0;
    transform:translateY(30px);
  }
  to{
    opacity:1;
    transform:translateY(0);
  }
}

.card h1{
  margin:0 0 24px;
  font-size:32px;
  background:linear-gradient(135deg,var(--accent1),var(--accent2),var(--purple));
  -webkit-background-clip:text;
  background-clip:text;
  background-clip:text;
  background-clip:text;
  -webkit-text-fill-color:transparent;
  text-align:center;
  font-weight:900;
  letter-spacing:-1px;
}

.card h2{
  margin:0 0 18px;
  font-size:24px;
  text-align:center;
}

.card h3{
  margin:20px 0 14px;
  font-size:17px;
  color:var(--muted);
  font-weight:700;
  display:flex;
  align-items:center;
  gap:8px;
}

.card label{
  display:block;
  margin-top:14px;
  color:var(--muted);
  font-size:14px;
  font-weight:600;
}

.card input[type="text"],
.card input[type="number"]{
  width:100%;
  padding:12px 16px;
  border-radius:10px;
  border:2px solid rgba(255,255,255,.1);
  background:rgba(255,255,255,.06);
  color:#fff;
  margin-top:8px;
  font-size:15px;
  transition:all .3s;
  font-family:inherit;
}

.card input:focus{
  outline:none;
  border-color:var(--accent1);
  background:rgba(255,255,255,.1);
  box-shadow:0 0 0 4px rgba(59,130,246,.2);
}

.actions{
  display:flex;
  gap:12px;
  margin-top:20px;
}

button{
  padding:14px 24px;
  border-radius:12px;
  border:0;
  color:#fff;
  font-weight:700;
  cursor:pointer;
  font-size:15px;
  transition:all .3s;
  font-family:inherit;
  position:relative;
  overflow:hidden;
}

button::before{
  content:'';
  position:absolute;
  top:50%;
  left:50%;
  width:0;
  height:0;
  border-radius:50%;
  background:rgba(255,255,255,.2);
  transform:translate(-50%,-50%);
  transition:width .6s,height .6s;
}

button:hover::before{
  width:300px;
  height:300px;
}

.btn-primary{
  background:linear-gradient(135deg,var(--accent1),var(--accent2));
  box-shadow:0 6px 20px rgba(59,130,246,.4);
  flex:2;
}

.btn-primary:hover{
  transform:translateY(-3px);
  box-shadow:0 8px 25px rgba(59,130,246,.5);
}

.btn-secondary{
  background:linear-gradient(135deg,var(--purple),#a78bfa);
  box-shadow:0 6px 20px rgba(139,92,246,.4);
  flex:1;
}

.btn-secondary:hover{
  transform:translateY(-3px);
  box-shadow:0 8px 25px rgba(139,92,246,.5);
}

.btn-save{
  background:linear-gradient(135deg,var(--success),#059669);
}

.btn-download{
  background:linear-gradient(135deg,var(--accent2),#0891b2);
}

.btn-upload{
  background:linear-gradient(135deg,var(--warning),#d97706);
}

.btn-close{
  background:linear-gradient(135deg,var(--danger),#dc2626);
  width:100%;
  margin-top:16px;
}

button:active{
  transform:scale(0.98);
}

.row.small{
  display:flex;
  gap:10px;
  margin-top:14px;
  flex-wrap:wrap;
}

.row.small button{
  flex:1;
  padding:10px 14px;
  font-size:13px;
}

.settings{
  margin-top:20px;
  padding:16px;
  background:rgba(255,255,255,.03);
  border-radius:12px;
  border:1px solid rgba(255,255,255,.06);
}

.settings label{
  display:flex;
  align-items:center;
  gap:10px;
  margin:10px 0;
  cursor:pointer;
  font-size:14px;
  color:#fff;
  transition:color .3s;
}

.settings label:hover{
  color:var(--accent1);
}

.settings input[type="checkbox"]{
  width:20px;
  height:20px;
  cursor:pointer;
  accent-color:var(--accent1);
}

.settings input[type="range"]{
  flex:1;
  margin:0 10px;
  accent-color:var(--accent1);
  cursor:pointer;
}

.controls-info{
  margin-top:20px;
  padding:16px;
  background:rgba(255,255,255,.03);
  border-radius:12px;
  border:1px solid rgba(255,255,255,.06);
}

.controls-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:10px;
  margin-top:12px;
}

.controls-grid > div{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:13px;
  color:rgba(255,255,255,.8);
}

kbd{
  background:rgba(255,255,255,.1);
  padding:4px 8px;
  border-radius:6px;
  font-size:11px;
  font-weight:700;
  border:1px solid rgba(255,255,255,.2);
  font-family:monospace;
  box-shadow:0 2px 4px rgba(0,0,0,.2);
}

.version{
  text-align:center;
  margin-top:20px;
  font-size:12px;
  color:var(--muted);
  font-style:italic;
}

/* HUD */
.hud{
  position:fixed;
  left:16px;
  top:16px;
  color:#fff;
  z-index:90;
  background:rgba(0,0,0,.45);
  padding:14px 18px;
  border-radius:14px;
  font-size:14px;
  font-weight:600;
  backdrop-filter:blur(8px);
  border:2px solid rgba(255,255,255,.12);
  box-shadow:0 4px 20px rgba(0,0,0,.4);
  min-width:220px;
}

.hud > div{
  margin:6px 0;
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.hud > div span:last-child{
  color:var(--accent2);
  font-weight:700;
}

.debug-overlay{
  position:fixed;
  right:16px;
  top:16px;
  color:#fff;
  z-index:90;
  background:rgba(0,0,0,.5);
  padding:14px 18px;
  border-radius:14px;
  font-size:13px;
  font-family:monospace;
  backdrop-filter:blur(8px);
  border:2px solid rgba(0,255,100,.4);
  box-shadow:0 4px 20px rgba(0,255,100,.3);
  min-width:240px;
}

.debug-title{
  font-size:15px;
  font-weight:900;
  color:#10b981;
  margin-bottom:10px;
  text-align:center;
  letter-spacing:2px;
}

.debug-overlay > div:not(.debug-title){
  margin:6px 0;
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding:4px 0;
  border-bottom:1px solid rgba(255,255,255,.1);
}

.debug-overlay > div:not(.debug-title)::before{
  content:'▸';
  color:#10b981;
  margin-right:6px;
  font-weight:900;
}

.debug-overlay > div:last-child{
  border-bottom:none;
}

.debug-overlay span{
  color:#06b6d4;
  font-weight:700;
}

.hidden{
  display:none !important;
}

.crosshair{
  position:fixed;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  font-size:32px;
  color:#fff;
  pointer-events:none;
  text-shadow:
    0 0 8px rgba(0,0,0,1),
    0 0 16px rgba(0,0,0,0.8),
    0 0 3px rgba(255,255,255,0.3);
  z-index:80;
  font-weight:900;
  opacity:0.9;
  font-family:monospace;
  animation:pulse 2s ease-in-out infinite;
}

@keyframes pulse{
  0%,100%{transform:translate(-50%,-50%) scale(1)}
  50%{transform:translate(-50%,-50%) scale(1.05)}
}

/* Inventar */
.inventory{
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom:24px;
  background:rgba(0,0,0,.6);
  padding:16px;
  border-radius:16px;
  color:#fff;
  z-index:90;
  backdrop-filter:blur(12px);
  border:2px solid rgba(255,255,255,.15);
  box-shadow:0 10px 40px rgba(0,0,0,.7);
}

.inventory .title{
  text-align:center;
  font-size:11px;
  color:rgba(255,255,255,0.7);
  margin-bottom:12px;
  font-weight:800;
  letter-spacing:1px;
  text-transform:uppercase;
}

.hotbar{
  display:flex;
  gap:12px;
  padding:6px;
}

.slot{
  width:68px;
  height:68px;
  border-radius:12px;
  background:rgba(255,255,255,.05);
  border:3px solid rgba(255,255,255,.15);
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  font-size:11px;
  cursor:pointer;
  transition:all .3s cubic-bezier(0.4,0,0.2,1);
  position:relative;
  padding:6px;
}

.slot:hover{
  background:rgba(255,255,255,.12);
  transform:translateY(-4px) scale(1.05);
  box-shadow:0 8px 24px rgba(59,130,246,.4);
}

.slot.dragging{
  opacity:0.5;
  transform:scale(0.95) rotate(5deg);
}

.slot.selected{
  border-color:var(--accent1);
  box-shadow:
    0 0 20px rgba(59,130,246,.7),
    inset 0 0 20px rgba(59,130,246,.3);
  background:rgba(59,130,246,.25);
  transform:translateY(-6px) scale(1.1);
}

.slot .key{
  position:absolute;
  top:4px;
  left:6px;
  font-size:10px;
  color:rgba(255,255,255,0.6);
  font-weight:800;
  background:rgba(0,0,0,0.4);
  padding:3px 6px;
  border-radius:4px;
}

.slot .blockname{
  font-size:10px;
  font-weight:700;
  text-align:center;
  margin-bottom:3px;
  color:rgba(255,255,255,0.95);
  text-shadow:0 1px 3px rgba(0,0,0,.9);
  line-height:1.2;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.slot .count{
  position:absolute;
  bottom:4px;
  right:6px;
  font-size:14px;
  font-weight:900;
  color:#fff;
  text-shadow:
    -1px -1px 2px #000,
    1px -1px 2px #000,
    -1px 1px 2px #000,
    1px 1px 2px #000;
  background:rgba(0,0,0,0.5);
  padding:2px 6px;
  border-radius:4px;
  min-width:22px;
  text-align:center;
}

/* Crafting Menu */
.crafting-menu{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.7);
  z-index:95;
  backdrop-filter:blur(10px);
  animation:fadeIn 0.3s ease-out;
}

.crafting-card{
  min-width:540px;
  max-height:85vh;
  overflow-y:auto;
}

#recipes{
  display:grid;
  gap:14px;
  margin-bottom:18px;
  max-height:60vh;
  overflow-y:auto;
  padding-right:8px;
}

#recipes::-webkit-scrollbar{
  width:8px;
}

#recipes::-webkit-scrollbar-track{
  background:rgba(255,255,255,.05);
  border-radius:4px;
}

#recipes::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.2);
  border-radius:4px;
}

#recipes::-webkit-scrollbar-thumb:hover{
  background:rgba(255,255,255,.3);
}

.recipe{
  padding:16px;
  background:rgba(255,255,255,.06);
  border-radius:12px;
  border:2px solid rgba(255,255,255,.12);
  cursor:pointer;
  transition:all .3s;
  font-size:15px;
}

.recipe:hover{
  background:rgba(255,255,255,.12);
  border-color:var(--accent1);
  transform:translateX(6px);
  box-shadow:0 4px 16px rgba(59,130,246,.3);
}

.recipe.disabled{
  opacity:0.3;
  cursor:not-allowed;
  filter:grayscale(1);
}

.recipe.disabled:hover{
  transform:none;
  border-color:rgba(255,255,255,.12);
  box-shadow:none;
}

.recipe strong{
  color:var(--accent2);
}

/* Status */
.status{
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  top:90px;
  background:rgba(0,0,0,.75);
  color:#fff;
  padding:16px 32px;
  border-radius:14px;
  z-index:90;
  font-weight:700;
  font-size:16px;
  backdrop-filter:blur(10px);
  border:2px solid rgba(255,255,255,.2);
  animation:statusSlideIn 0.5s cubic-bezier(0.68,-0.55,0.265,1.55);
  box-shadow:0 6px 24px rgba(0,0,0,.8);
}

@keyframes statusSlideIn{
  0%{
    opacity:0;
    transform:translateX(-50%) translateY(-30px) scale(0.8);
  }
  100%{
    opacity:1;
    transform:translateX(-50%) translateY(0) scale(1);
  }
}

/* Stats (Health & Hunger) */
.stats{
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom:110px;
  display:flex;
  gap:28px;
  color:#fff;
  z-index:90;
  font-size:16px;
  font-weight:800;
}

.stats > div{
  display:flex;
  align-items:center;
  gap:10px;
  background:rgba(0,0,0,.5);
  padding:10px 16px;
  border-radius:12px;
  backdrop-filter:blur(8px);
  border:2px solid rgba(255,255,255,.15);
}

.stats .icon{
  font-size:22px;
  filter:drop-shadow(0 2px 4px rgba(0,0,0,.6));
}

.stats .bar{
  width:100px;
  height:12px;
  background:rgba(0,0,0,.5);
  border-radius:6px;
  overflow:hidden;
  border:2px solid rgba(255,255,255,.2);
}

.stats .fill{
  height:100%;
  background:linear-gradient(90deg,#ef4444,#dc2626);
  transition:width .3s ease-out;
  box-shadow:0 0 10px rgba(239,68,68,.8);
}

.stats .hunger-fill{
  background:linear-gradient(90deg,#f59e0b,#d97706);
  box-shadow:0 0 10px rgba(245,158,11,.8);
}

.stats span:last-child{
  font-size:18px;
  min-width:30px;
  text-align:center;
  text-shadow:
    -1px -1px 2px rgba(0,0,0,.8),
    1px -1px 2px rgba(0,0,0,.8),
    -1px 1px 2px rgba(0,0,0,.8),
    1px 1px 2px rgba(0,0,0,.8);
}

/* Loading Screen */
.loading-screen{
  position:fixed;
  inset:0;
  background:linear-gradient(180deg,rgba(0,0,0,.9),rgba(0,0,0,.7));
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:110;
  backdrop-filter:blur(10px);
}

.loading-content{
  text-align:center;
  color:#fff;
}

.spinner{
  width:60px;
  height:60px;
  border:6px solid rgba(255,255,255,.2);
  border-top-color:var(--accent1);
  border-radius:50%;
  animation:spin 1s linear infinite;
  margin:0 auto 24px;
}

@keyframes spin{
  to{transform:rotate(360deg)}
}

.loading-content h2{
  font-size:28px;
  margin-bottom:12px;
  background:linear-gradient(135deg,var(--accent1),var(--accent2));
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
}

.loading-content p{
  font-size:16px;
  color:var(--muted);
}

/* Particles */
.particle{
  position:fixed;
  width:6px;
  height:6px;
  background:#fff;
  border-radius:50%;
  pointer-events:none;
  z-index:85;
  box-shadow:
    0 0 6px rgba(255,255,255,0.9),
    0 0 12px rgba(255,255,255,0.6);
  animation:particleFall 1.4s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
}

@keyframes particleFall{
  0%{
    transform:translateY(0) translateX(0) scale(1);
    opacity:1;
  }
  100%{
    transform:translateY(140px) translateX(var(--random-x,0)) scale(0.2);
    opacity:0;
  }
}

/* Scrollbar (Card) */
.card::-webkit-scrollbar{
  width:10px;
}

.card::-webkit-scrollbar-track{
  background:rgba(255,255,255,.03);
  border-radius:5px;
}

.card::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.15);
  border-radius:5px;
}

.card::-webkit-scrollbar-thumb:hover{
  background:rgba(255,255,255,.25);
}

/* Responsive Design */
@media (max-width: 768px){
  .card{
    min-width:95%;
    max-width:95%;
    padding:20px;
  }
  
  .slot{
    width:56px;
    height:56px;
  }
  
  .hotbar{
    gap:8px;
  }
  
  .controls-grid{
    grid-template-columns:1fr;
  }
  
  .hud{
    font-size:12px;
    padding:10px 14px;
  }
  
  .stats{
    bottom:100px;
    gap:16px;
  }
  
  .stats .bar{
    width:80px;
  }
}

@media (max-height: 700px){
  .card{
    max-height:85vh;
  }
  
  .settings{
    padding:12px;
  }
  
  .controls-info{
    padding:12px;
  }
}