:root {
  --ink: #14110f;
  --panel: #1e1a17;
  --raised: #2a2420;
  --line: #40362e;
  --text: #ece4d8;
  --muted: #a3968a;
  --accent: #e0a64b;
  --danger: #e58a78;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 19px;
  line-height: 1.55;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 20px 8px;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}

.game-title {
  flex: 1;
  color: var(--muted);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiet {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 44px;
  padding: 0 4px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 15px;
  text-decoration: none;
}

a.quiet { font-size: 26px; line-height: 1; }

.center { display: flex; width: 100%; }

main {
  flex: 1;
  padding: 20px 20px 28px;
}

main.fresh { animation: appear 220ms ease-out; }

@keyframes appear {
  from { opacity: 0; transform: translateY(6px); }
}

@media (prefers-reduced-motion: reduce) {
  main.fresh { animation: none; }
}

h1 {
  margin: 8px 0 12px;
  color: var(--accent);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
}

.story { margin: 0 0 14px; }

.feedback {
  margin-bottom: 20px;
  padding: 12px 14px;
  background: var(--panel);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-style: italic;
}

.feedback p { margin: 0; }

.feedback ul {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--accent);
  font-size: 16px;
  font-style: normal;
}

.feedback p + ul { margin-top: 8px; }

.choices {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.choice {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  line-height: 1.3;
}

a.choice {
  color: inherit;
  text-decoration: none;
}

.story-card {
  display: grid;
  gap: 2px;
  padding: 14px;
}

.story-card span {
  color: var(--muted);
  font-size: 16px;
}

.story-card small {
  margin-top: 4px;
  color: var(--accent);
  font-size: 15px;
}

.choice:active { background: var(--line); }

.choice.locked {
  background: none;
  border-style: dashed;
  color: var(--muted);
}

.choice.locked small {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-style: italic;
}

.the-end {
  margin: 0;
  color: var(--accent);
  font-size: 22px;
  text-align: center;
  letter-spacing: 0.08em;
}

.error { color: var(--danger); }

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.inventory {
  position: sticky;
  bottom: 0;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.items {
  display: flex;
  gap: 8px;
  margin: 0 -20px;
  padding: 0 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.item {
  flex: none;
  width: 76px;
  min-height: 72px;
  padding: 6px 4px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item.active { border-color: var(--accent); }

.item .icon { display: block; font-size: 26px; line-height: 1.2; }

.item .name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 12px;
  line-height: 1.2;
}

.combine-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-size: 16px;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(0 0 0 / 55%);
}

.sheet {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  padding: 20px 20px calc(10px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
}

.sheet p { margin: 0 0 6px; }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sheet-head .icon { font-size: 32px; }

.sheet h2 {
  margin: 0;
  color: var(--accent);
  font-size: 22px;
  font-weight: 600;
}
