html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #cbb892;
  color: #1c140f;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

button {
  font: inherit;
  color: inherit;
  border: 2px solid #1c140f;
  background: #fff8ec;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  box-shadow: 2px 2px 0 #1c140f;
}

button:hover:not(:disabled) {
  background: #fff1d4;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

#hud {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 3;
  width: min(360px, calc(100vw - 24px));
  padding: 12px 14px;
  background: rgba(246, 239, 226, 0.94);
  border: 3px solid #1c140f;
  border-radius: 16px;
  box-shadow: 4px 4px 0 #1c140f;
}

#hud-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

#hp-row {
  position: relative;
  height: 22px;
  margin-top: 8px;
  border: 2px solid #1c140f;
  border-radius: 999px;
  overflow: hidden;
  background: #2a2118;
}

#hp-fill {
  height: 100%;
  width: 100%;
  background: #d64545;
}

#hp-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff8ec;
  font-size: 12px;
  font-weight: 700;
}

#stat-line,
#gear-line,
#hint {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
}

#skill-row,
#menu-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.skill {
  min-width: 92px;
  padding: 4px 8px;
  border: 2px solid #1c140f;
  border-radius: 12px;
  background: #efe6d6;
}

.skill b,
.skill span {
  display: block;
}

.skill span {
  font-size: 12px;
}

.skill.ready {
  background: #e7f6df;
}

.skill.active {
  background: #ffe1c2;
}

.skill.locked {
  color: #6d6256;
}

.panel {
  position: fixed;
  z-index: 5;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 640px);
  overflow: auto;
  padding: 14px;
  background: #f6efe2;
  border: 3px solid #1c140f;
  border-radius: 16px;
  box-shadow: 4px 4px 0 #1c140f;
}

#inventory {
  top: 16px;
  right: 16px;
}

#craft {
  left: 16px;
  bottom: 16px;
}

.hidden {
  display: none;
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.entry,
.recipe {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px solid rgba(28, 20, 15, 0.15);
}

.entry h3,
.recipe h3 {
  margin: 0;
  font-size: 15px;
}

.muted {
  margin: 4px 0 0;
  color: #5c5148;
  font-size: 13px;
}

.materials {
  margin: 8px 0;
  padding: 0;
  list-style: none;
}

.short {
  color: #a12622;
  font-weight: 700;
}

.ok {
  color: #1d6b3a;
  font-weight: 700;
}

#toast-wrap {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 8px 12px;
  background: #fff8ec;
  border: 2px solid #1c140f;
  border-radius: 999px;
  box-shadow: 3px 3px 0 #1c140f;
  font-weight: 700;
}

#debug-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: rgba(246, 239, 226, 0.94);
  border: 3px solid #1c140f;
  border-radius: 14px;
}

#debug-bar strong {
  align-self: center;
  margin-right: 4px;
}

#debug-bar button {
  padding: 4px 8px;
}

body.debug #craft {
  bottom: 108px;
}
