/* 我的世界 · 一句话盖房 */
:root {
  --bg: #0f1411;
  --bg2: #141a15;
  --card: #18201a;
  --ln: #2a352c;
  --ln2: #3a4a3c;
  --tx: #e9f0e5;
  --sub: #93a596;
  --ac: #8fd06a;
  --ac2: #5f9a45;
  --on-ac: #10180e;
  --warn: #d97757;
  --hud: 46px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%; overflow: hidden; background: var(--bg); color: var(--tx);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased; user-select: none;
}
body { display: flex; flex-direction: column; }

/* 顶栏 */
#hud {
  height: calc(var(--hud) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #16201a, #101613);
  border-bottom: 2px solid var(--ln); z-index: 20; flex: 0 0 auto;
}
.hud-l { min-width: 0; }
.brand { font-size: 15px; font-weight: 800; letter-spacing: 3px; color: var(--ac); }
.meta { font-size: 10px; color: var(--sub); margin-top: 1px; display: flex; gap: 5px; align-items: center; letter-spacing: .3px; }
.meta i { font-style: normal; opacity: .5; }
.icn {
  width: 34px; height: 32px; display: grid; place-items: center;
  background: #1c2620; border: 2px solid var(--ln); color: var(--sub);
}
.icn:active { color: var(--tx); }

/* 画布 */
#stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: radial-gradient(circle at 50% 30%, #1b2a20, #0d120f 70%); }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; touch-action: none; }

.emptytip {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  text-align: center; color: #cfe0c6; font-size: 13px; line-height: 1.8;
  letter-spacing: .5px; pointer-events: none; transition: opacity .4s;
}
.emptytip span { color: var(--sub); font-size: 11.5px; }
.emptytip.off { opacity: 0; }

.zoomctl { position: absolute; right: 10px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.zoomctl button {
  width: 38px; height: 38px; background: rgba(24,32,26,.92); border: 2px solid var(--ln2);
  color: var(--tx); font-size: 17px; font-family: inherit; line-height: 1;
}
.zoomctl button:active { background: #243027; }
.zoomctl button:nth-child(3) { color: var(--ac); }

.buildbar {
  position: absolute; left: 12px; right: 12px; top: 12px;
  background: rgba(20,27,22,.94); border: 2px solid var(--ln2); padding: 9px 11px;
}
.bb-t { font-size: 11.5px; color: var(--ac); letter-spacing: .5px; margin-bottom: 7px; }
.bb-bar { height: 4px; background: #26332a; }
.bb-bar i { display: block; height: 100%; width: 0; background: var(--ac); transition: width .2s; }

/* 底部 */
#dock {
  flex: 0 0 auto; background: #131a15; border-top: 2px solid var(--ln);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); z-index: 20;
}
.chips { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 7px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; font-family: inherit; font-size: 11px; color: #c9d8c3;
  background: #1c2620; border: 2px solid var(--ln); padding: 6px 9px; white-space: nowrap;
}
.chip:active { border-color: var(--ac2); color: var(--ac); }
.inputRow { display: flex; gap: 8px; align-items: center; }
#ask {
  flex: 1; height: 42px; background: #0b100d; border: 2px solid var(--ln);
  color: var(--tx); font-family: inherit; font-size: 13px; padding: 0 11px; outline: none;
}
#ask:focus { border-color: var(--ac2); }
#ask::placeholder { color: #66796a; }
#go {
  width: 48px; height: 42px; flex: 0 0 48px; background: var(--ac); color: var(--on-ac);
  border: 2px solid var(--ac2); font-family: inherit; font-size: 14px; font-weight: 800;
}
#go:active { transform: translateY(1px); }
#go[disabled] { opacity: .5; }

/* 弹层 */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end;
  background: rgba(5,8,6,.66); opacity: 0; transition: opacity .2s;
}
.sheet-wrap.on { opacity: 1; }
.sheet-wrap.hidden { display: none; }
.sheet {
  width: 100%; max-height: 86vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: #16201a; border-top: 2px solid var(--ln2);
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(12px); transition: transform .22s;
}
.sheet-wrap.on .sheet { transform: none; }

.sh { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.sh .t { font-size: 14px; font-weight: 800; letter-spacing: 1.5px; color: var(--ac); }
.sh .x { font-family: inherit; font-size: 11px; color: var(--sub); background: none; border: 2px solid var(--ln); padding: 4px 10px; }

.fld { margin-top: 12px; }
.fld > label { display: block; font-size: 10.5px; color: var(--sub); letter-spacing: .6px; margin-bottom: 5px; }
.inp {
  width: 100%; height: 40px; background: #0d1410; border: 2px solid var(--ln);
  color: var(--tx); font-family: inherit; font-size: 13px; padding: 0 10px; outline: none;
}
.inp:focus { border-color: var(--ac2); }
.btn {
  font-family: inherit; font-size: 12.5px; color: var(--tx); background: #212c24;
  border: 2px solid var(--ln2); padding: 9px 12px;
}
.btn:active { background: #2a382e; }
.btn.pri { background: var(--ac); border-color: var(--ac2); color: var(--on-ac); font-weight: 800; }
.btn.block { display: block; width: 100%; }
.btn.danger { color: #e0917e; }
.row { display: flex; gap: 8px; }
.grow { flex: 1; }
.tiny { font-size: 10.5px; line-height: 1.7; color: var(--sub); }
.hr { height: 2px; background: var(--ln); margin: 14px 0 2px; }
.tiny.ok { color: var(--ac); }
.tiny.err { color: var(--warn); }

.sld { display: flex; align-items: center; gap: 10px; }
.sld input[type=range] { flex: 1; accent-color: var(--ac); }
.sld .v { font-size: 12px; color: var(--ac); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

.log { border-left: 2px solid var(--ln2); padding-left: 10px; margin-top: 8px; }
.log .it { font-size: 11.5px; color: #b9c9b3; line-height: 1.7; }
.log .it b { color: var(--ac); font-weight: 700; }

.toast {
  position: fixed; left: 50%; top: calc(var(--hud) + env(safe-area-inset-top) + 12px);
  transform: translateX(-50%) translateY(-6px); background: #e9f0e5; color: #14200f;
  font-size: 11.5px; padding: 8px 12px; border: 2px solid #9fb897; max-width: 84vw;
  text-align: center; opacity: 0; pointer-events: none; transition: .2s; z-index: 90; line-height: 1.5;
}
.toast.on { opacity: 1; transform: translateX(-50%); }
.hidden { display: none !important; }
