@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* 添加中文像素字体 */
@font-face {
  font-family: 'MinecraftChinese';
  src: url('https://cdn.fcode.vip/oj/static/mc/ipix.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --grass: #5bbd46;
  --dirt: #8c5e36;
  --stone: #828282;
  --wood: #ad7c48;
  --leaves: #377425;
  --water: #3574ae;
}

* {
  box-sizing: border-box;
  image-rendering: pixelated;
}

body {
  /* 修改字体顺序，优先使用中文像素字体 */
  font-family: 'MinecraftChinese', 'Press Start 2P', cursive;
  margin: 0;
  padding: 0;
  color: #333;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: none; /* 隐藏默认鼠标 */
}

/* 3D世界容器 */
#minecraft-world {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

/* 自定义钻石剑鼠标 */
#diamond-sword {
  position: fixed;
  width: 40px;
  height: 40px;
  background-image: url('https://cdn.fcode.vip/oj/static/mc/zsj.png');
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 9999;
  /* 修改为朝左倾斜 */
  transform: rotate(225deg);
  transform-origin: 50% 50%;
  transition: transform 0.1s;
}

/* 点击效果 */
#diamond-sword.click {
  transform: rotate(235deg) scale(1.2);
}

h1, h2 {
    text-align: center;
    margin: 20px 0;
}

.container {
  max-width: 800px;
  margin: 40px auto;
  padding: 0;
  position: relative;
  z-index: 1;
}

.minecraft-window {
  border: 4px solid #000;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  background: #c6c6c6;
  position: relative;
}

.minecraft-title-bar {
  background: #3d69c2;
  color: white;
  font-size: 16px;
  padding: 10px 15px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  border-bottom: 4px solid #000;
}

.minecraft-content {
  padding: 20px;
  background-image: url('https://cdn.fcode.vip/oj/static/mc/mcbj.jpeg');
  min-height: 400px;
}

h1 {
  color: #333;
  font-size: 22px;
  margin-bottom: 30px;
  text-align: center;
  text-shadow: 2px 2px 0 #fff;
}

.msg {
  background: rgba(255, 255, 255, 0.7);
  border: 3px solid #000;
  padding: 15px;
  margin-bottom: 15px;
  animation: fadeIn 0.5s ease-out;
  position: relative;
  font-size: 12px;
  line-height: 1.4;
}

.msg:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--wood);
}

.msg strong {
  color: var(--dirt);
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
}

.msg-time {
  display: block;
  text-align: right;
  font-size: 10px;
  color: #666;
  margin-top: 8px;
}

.btn {
  display: inline-block;
  /* background-image: url('https://cdn.fcode.vip/oj/static/mc/arrow.png'); */
  background-color: #c6c6c6;
  background-repeat: repeat;
  border: 3px solid #000;
  color: white;
  font-family: 'Press Start 2P', cursive;
  font-size: 14px;
  padding: 12px 24px;
  text-decoration: none;
  text-align: center;
  margin: 20px 0;
  cursor: pointer;
  text-shadow: 2px 2px 0 #000;
  transition: all 0.1s;
  position: relative;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 0 #000;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 10px;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
}

input[type="text"], textarea {
  width: 100%;
  padding: 12px;
  border: 3px solid #000;
  background: rgba(255, 255, 255, 0.8);
  font-family: 'Press Start 2P', cursive;
  font-size: 12px;
  margin-bottom: 5px;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.error {
  background-color: rgba(231, 76, 60, 0.7);
  border: 3px solid #000;
  color: white;
  padding: 12px;
  margin: 15px 0;
  animation: shake 0.5s;
}

/* 动画效果 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* 方块悬停动画 */
.block {
  display: inline-block;
  width: 48px;
  height: 48px;
  background-size: contain;
  margin: 5px;
  image-rendering: pixelated;
  transition: all 0.2s;
  cursor: pointer;
}

.block:hover {
  transform: scale(1.1);
}

.grass-block { background-image: url('https://cdn.fcode.vip/oj/static/mc/cfk.png'); }
.stone-block { background-image: url('https://cdn.fcode.vip/oj/static/mc/nt.png'); }
.wood-block { background-image: url('https://cdn.fcode.vip/oj/static/mc/mt.png'); }

/* 工具栏 */
.toolbar {
  display: flex;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px;
  border: 3px solid #000;
  margin-top: 20px;
  position: relative;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    margin: 20px 10px;
  }
  
  h1 {
    font-size: 18px;
  }
  
  .btn {
    display: block;
    width: 100%;
  }
}

/* 心跳动画 */
.heart {
  display: inline-block;
  color: red;
  animation: heartbeat 1s infinite;
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* 挖掘动画 */
.dig-animation {
  position: absolute;
  pointer-events: none;
  width: 50px;
  height: 50px;
  background-image: url('https://i.imgur.com/PeYOZCY.png');
  background-size: 500% 100%;
  image-rendering: pixelated;
  animation: dig 0.5s steps(5) forwards;
  z-index: 100;
}

@keyframes dig {
  from { background-position: 0 0; }
  to { background-position: 100% 0; }
}

/* 添加方块放置动画 */
.place-animation {
  position: absolute;
  pointer-events: none;
  width: 50px;
  height: 50px;
  background-image: url('https://cdn.fcode.vip/oj/static/mc/place_effect.png');
  background-size: contain;
  image-rendering: pixelated;
  animation: placeBlock 0.3s forwards;
  z-index: 100;
  transform: translate(-50%, -50%);
}

@keyframes placeBlock {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* 选中的工具栏方块 */
.block.selected {
  transform: scale(1.2);
  box-shadow: 0 0 10px #fff, 0 0 15px #fff;
  border: 2px solid white;
}

/* 添加工具栏方块说明 */
.toolbar {
  position: relative;
}

.block {
  position: relative;
}

.block::after {
  content: attr(data-block-type);
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: white;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
}

.block:hover::after {
  opacity: 1;
}