* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0f1115; color: #e8e8ea; font-family: "Segoe UI", "Yu Gothic UI", system-ui, sans-serif; overflow: hidden; }
button { font: inherit; cursor: pointer; }

#app { width: 384px; height: 100vh; margin: 0 auto; display: flex; flex-direction: column; background: #14171d; }

/* 上部 HUD: 常時見るもの */
#hud { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #1b1f27; border-bottom: 1px solid #2a2f3a; }
#hud .depth { font-size: 34px; font-weight: 700; line-height: 1; min-width: 110px; }
#hud .depth small { font-size: 14px; margin-left: 3px; color: #9aa3b2; }
#hud .hud-mid { flex: 1; font-size: 14px; line-height: 1.35; }
#hud .hud-mid .small { font-size: 12px; color: #9aa3b2; }
#hud .hud-right { text-align: right; font-size: 13px; }
#hud #status { color: #ffd166; margin-bottom: 4px; white-space: nowrap; }
#hud #recall { background: #2a2f3a; color: #e8e8ea; border: 1px solid #3a4150; border-radius: 6px; padding: 4px 10px; }
#hud #recall:disabled { opacity: .4; cursor: default; }
#hud #sound { background: transparent; color: #e8e8ea; border: 1px solid #3a4150; border-radius: 6px; padding: 4px 6px; margin-left: 4px; }
#hud #sound.off { opacity: .45; }

/* 縦穴 */
#mine { display: block; margin: 0 auto; flex: 1 1 0; min-height: 0; width: 352px; background: #0f1115; }
#ticker { height: 20px; font-size: 12px; color: #9aa3b2; padding: 2px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 地上にいるときだけ出る操作パネル */
#panel { padding: 8px 12px 10px; background: #1b1f27; border-top: 1px solid #2a2f3a; font-size: 13px; min-height: 96px; }
#panel h3 { margin: 0 0 6px; font-size: 13px; color: #9aa3b2; font-weight: 600; }
#panel .praise { background: #2f6f4e33; border: 1px solid #3f8f66; border-radius: 8px; padding: 6px 8px; margin-bottom: 8px; font-size: 13px; line-height: 1.4; }
#panel .praise b { color: #ffd166; font-size: 15px; }
#panel .wh { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 6px; }
#panel .wh .ore { background: #14171d; border-radius: 6px; padding: 4px; text-align: center; font-size: 12px; line-height: 1.2; }
#panel .wh .ore .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; transform: rotate(45deg); margin-bottom: 2px; }
#panel .wh .ore .n { font-size: 14px; font-weight: 700; }
#panel .wh .ore .cap { color: #6b7280; }
#panel .wh .ore.full .n { color: #ff8c8c; }
#panel .actions { display: flex; gap: 6px; margin-bottom: 6px; }
#panel button { background: #2a2f3a; color: #e8e8ea; border: 1px solid #3a4150; border-radius: 6px; padding: 5px 8px; flex: 1; }
#panel button.primary { background: #2f6f4e; border-color: #3f8f66; }
#panel button:disabled { opacity: .4; cursor: default; }
#panel .equip { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
#panel .equip .slot { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: #14171d; border-radius: 6px; padding: 4px 6px; }
#panel .equip .slot .name { font-size: 12px; line-height: 1.2; }
#panel .equip .slot .name small { display: block; color: #6b7280; }
#panel .equip .slot button { flex: 0 0 auto; padding: 4px 8px; }
#panel .equip .slot button.can { background: #6b4fbb; border-color: #8b6fdb; box-shadow: 0 0 8px #8b6fdb88; }
#panel .idle { color: #9aa3b2; padding: 12px 0; text-align: center; }
#panel .idle b { color: #ffd166; }
#panel .timer { font-size: 11px; color: #6b7280; text-align: right; }

/* デバッグ */
#debug { display: flex; align-items: center; gap: 4px; padding: 4px 8px; background: #101319; border-top: 1px solid #2a2f3a; font-size: 11px; color: #6b7280; }
#debug button { background: transparent; color: #9aa3b2; border: 1px solid #2a2f3a; border-radius: 4px; padding: 2px 6px; font-size: 11px; }
#debug button.active { color: #ffd166; border-color: #ffd166; }
#debug #reset { margin-left: auto; }
#debug #saved { min-width: 40px; text-align: right; }

/* おかえり画面 */
.overlay { position: absolute; inset: 0; background: rgba(5, 7, 12, .82); display: flex; align-items: center; justify-content: center; }
.overlay.hidden { display: none; }
.overlay .card { width: 320px; background: #1b1f27; border: 1px solid #3a4150; border-radius: 12px; padding: 18px; text-align: center; box-shadow: 0 10px 40px #000a; }
.overlay h2 { margin: 0 0 6px; font-size: 22px; color: #ffd166; }
.overlay .sub { margin: 4px 0; font-size: 12px; color: #9aa3b2; }
.overlay ul { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.overlay li { background: #14171d; border-radius: 6px; padding: 6px; font-size: 14px; }
.overlay li b { font-size: 18px; }
.overlay button { margin-top: 10px; width: 100%; background: #2f6f4e; color: #fff; border: 1px solid #3f8f66; border-radius: 8px; padding: 8px; font-size: 15px; }
#app { position: relative; }
