:root {
  --bg: #100c0a;
  --ink: #f3e6d4;
  --dim: #cbbba6;
  --amber: #e2a15a;
  --ember: #d4532a;
  --line: rgba(226, 161, 90, 0.4);
  --serif: "Iowan Old Style", Palatino, Georgia, serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
}
html, body, * {
  scrollbar-width: thin;
  scrollbar-color: rgba(203, 187, 166, 0.45) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
*::-webkit-scrollbar-track,
*::-webkit-scrollbar-track-piece,
*::-webkit-scrollbar-corner { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(203, 187, 166, 0.4);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
button, input { font: inherit; color: inherit; }
button {
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #2a211c;
  padding: 10px 16px;
  cursor: pointer;
  touch-action: manipulation;
}
button:active { transform: translateY(1px) scale(0.99); }
button.primary { background: linear-gradient(#f0c48a, #c47a32); color: #2a160c; border-color: transparent; font-weight: 700; }
button.quiet { background: transparent; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui button, #ui input, #ui .panel, #ui .sheet, #ui form { pointer-events: auto; }
#boot, #fail {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 24px;
  text-align: center;
}
#title, #classes { position: absolute; inset: 0; }
#title {
  background:
    linear-gradient(to top, rgba(10, 7, 6, 0.94) 0%, rgba(10, 7, 6, 0.72) 38%, rgba(10, 7, 6, 0.18) 100%),
    url("assets/title.jpg") center/cover no-repeat;
  display: flex;
  align-items: flex-end;
}
#classes {
  background: rgba(12, 9, 8, 0.94);
  overflow: auto;
}
.sheet, .panel, .dialog {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
}
h1, h2 { font-weight: 650; letter-spacing: 0.01em; margin: 0 0 8px; }
h1 { font-size: 56px; line-height: 0.95; }
.eyebrow, .fine, .quiet { color: var(--dim); }
.lede { font-size: 18px; line-height: 1.35; max-width: 38rem; }
.actions, .chairs, #skills, #tools, #shop-list, #equip, #bag-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.actions button, #shop-list button, .slot { min-width: 140px; }
.seed { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 12px; }
.seed label, .name { display: flex; flex-direction: column; gap: 6px; color: var(--dim); width: 100%; }
input {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #1a1411;
  padding: 8px 12px;
}
.chairs { margin: 12px 0; }
.chair {
  display: flex;
  gap: 10px;
  text-align: left;
  width: min(100%, 220px);
  border-radius: 18px;
  padding: 8px;
  align-items: center;
}
.chair img { width: 72px; height: 96px; object-fit: cover; border-radius: 12px; background: #241c18; }
.chair em { display: block; color: var(--dim); font-style: normal; font-size: 14px; }
#confirm {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 5, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
#confirm[hidden] { display: none; }
.dialog { background: #1a1411; border-radius: 24px 24px 0 0; }
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.topline {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top));
  left: 14px;
  margin: 0;
  text-shadow: 0 1px 2px #000;
}
.topline.meta { top: calc(28px + env(safe-area-inset-top)); color: var(--dim); font-size: 14px; }
.globe {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #6a5038;
  background: #120c0a;
  box-shadow: 0 0 0 4px #1c140f, 0 10px 18px rgba(0,0,0,0.55);
}
.globe.life { left: 14px; }
.globe.mana { right: 14px; }
.globe span {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 0;
}
.globe.life span { background: radial-gradient(circle at 35% 28%, #ff6d55, #8d1a12 72%); }
.globe.mana span { background: radial-gradient(circle at 35% 28%, #67d0ef, #12485f 72%); }
.globe em {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 12px;
  text-shadow: 0 1px 2px #000;
}
#hud button { pointer-events: auto; }
.bars { width: min(280px, 46vw); }
.place { text-align: right; }
.place p { margin: 0; }
.bar { height: 10px; background: rgba(0, 0, 0, 0.45); border-radius: 99px; overflow: hidden; margin: 4px 0; }
.bar span { display: block; height: 100%; width: 0; }
.hp span { background: #c4493a; }
.mp span { background: #3f8f9a; }
.xp span, .boss span { background: #e2a15a; }
.row { display: flex; justify-content: space-between; margin: 0; font-size: 14px; }
#hptext, #mptext, #who { margin: 0; font-size: 13px; color: var(--dim); }
#bossbar { position: absolute; left: 50%; top: calc(8px + env(safe-area-inset-top)); transform: translateX(-50%); width: min(420px, 70vw); text-align: center; }
#bossname { margin: 0 0 4px; }
#toasts { position: absolute; left: 12px; right: 12px; top: calc(108px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
#toasts p { margin: 0; background: rgba(16, 12, 10, 0.86); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; }
.panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: min(86vh, 760px);
  overflow: auto;
  background: #171310;
  border-radius: 24px 24px 0 0;
}
#win img { width: 120px; height: 160px; object-fit: cover; border-radius: 16px; }
#dock {
  position: absolute;
  left: 108px; right: 108px; bottom: 0;
  padding: 8px 8px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  background: linear-gradient(to top, rgba(10, 8, 7, 0.75), rgba(10, 8, 7, 0));
}
#skills button, #tools button, #act { position: relative; overflow: hidden; }
#skills button { min-width: 72px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
#skills .k { font-size: 12px; color: var(--dim); }
#skills .nm { font-size: 14px; }
#skills button i {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  transform: scaleY(var(--p, 0));
  transform-origin: bottom;
  pointer-events: none;
}
.slot { display: flex; flex-direction: column; align-items: flex-start; min-height: 64px; border-radius: 16px; }
.slot em { font-style: normal; color: var(--dim); font-size: 12px; }
#detail { margin: 10px 0; }
@media (max-width: 720px) {
  h1 { font-size: 42px; }
  #copy-hall { display: none; }
  .bars { width: min(220px, 58vw); }
  .place { max-width: 42vw; }
}
