:root {
  --bg: #120d09;
  --panel: #1b140f;
  --amber: #ffb547;
  --amber-dim: #8a6a3e;
  --me: #3a2a14;
  --line: rgb(255 181 71 / .14);
}

body { background: var(--bg); }

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  background:
    repeating-linear-gradient(0deg, rgb(255 255 255 / .015) 0 1px, transparent 1px 3px),
    var(--bg);
}

#top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(8px + var(--safe-top)) 12px 8px 52px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.net { font: 700 10px/1 var(--mono); letter-spacing: .14em; color: var(--amber-dim); display: flex; align-items: center; gap: 6px; }
.bars { display: inline-flex; align-items: end; gap: 1px; height: 10px; }
.bars i { width: 3px; background: var(--amber); border-radius: 1px; animation: bar 1.6s ease-in-out infinite; }
.bars i:nth-child(1) { height: 30%; }
.bars i:nth-child(2) { height: 55%; animation-delay: .2s; }
.bars i:nth-child(3) { height: 80%; animation-delay: .4s; }
.bars i:nth-child(4) { height: 100%; animation-delay: .6s; }
@keyframes bar { 50% { opacity: .3; } }
body.danger .bars i { background: var(--blood); animation-duration: .4s; }
#where { font: 700 17px/1.3 var(--sans); color: var(--fg); margin-top: 3px; transition: color .3s; }
.pill {
  font: 700 13px/1 var(--mono);
  padding: 7px 11px;
  border-radius: 999px;
  background: rgb(255 59 78 / .12);
  color: #ff7a85;
  border: 1px solid rgb(255 59 78 / .3);
  transition: transform .2s;
}
.pill.bump { animation: bump .35s; }
@keyframes bump { 30% { transform: scale(1.25); } }

#tabs { display: flex; gap: 4px; padding: 6px 10px 0; background: var(--panel); border-bottom: 1px solid var(--line); }
.tab {
  position: relative;
  padding: 8px 12px 9px;
  font: 600 13px/1 var(--mono);
  color: var(--amber-dim);
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
.tab.active { color: var(--amber); border-color: var(--amber); }
.badge {
  display: inline-block;
  min-width: 16px;
  padding: 2px 4px;
  margin-left: 4px;
  border-radius: 8px;
  background: var(--blood);
  color: #fff;
  font-size: 10px;
  animation: bump .35s;
}
.badge[hidden] { display: none; }

#enemy {
  padding: 8px 14px;
  background: linear-gradient(90deg, rgb(255 59 78 / .2), rgb(255 59 78 / .05));
  border-bottom: 1px solid rgb(255 59 78 / .3);
  font: 700 12px/1 var(--mono);
  color: #ff8a93;
  animation: drop .3s ease-out;
}
#enemy[hidden] { display: none; }
@keyframes drop { from { transform: translateY(-100%); opacity: 0; } }
.ebar { height: 5px; margin-top: 6px; background: rgb(0 0 0 / .4); border-radius: 3px; overflow: hidden; }
.ebar i { display: block; height: 100%; width: 100%; background: var(--blood); transition: width .3s; }

#feeds { flex: 1; position: relative; min-height: 0; }
.feed {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 14px 12px 20px;
  display: none;
  flex-direction: column;
  gap: 8px;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.feed.active { display: flex; }

/* messages */
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; animation: msg-in .28s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes msg-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.av {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 800 13px/1 var(--mono);
  background: rgb(255 255 255 / .06);
  border: 1px solid currentColor;
}
.bub {
  padding: 8px 12px;
  border-radius: 16px 16px 16px 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.38;
}
.bub .who { display: block; font: 700 11px/1.4 var(--mono); margin-bottom: 1px; }
.msg.me .bub { background: var(--me); border-color: rgb(255 181 71 / .35); border-radius: 16px 16px 4px 16px; color: #ffe1b0; }

.msg.foe .bub { border-color: rgb(255 59 78 / .5); background: #24100f; }
.msg.foe .bub b { color: #ff6b77; }
.timer { height: 3px; margin-top: 7px; border-radius: 2px; background: var(--blood); transform-origin: left; animation: timer linear forwards; }
@keyframes timer { to { transform: scaleX(0); } }
.msg.foe.resolved .timer { animation-play-state: paused; opacity: .3; }
.msg.foe.good .bub { border-color: var(--toxic); }
.msg.foe.bad .bub { animation: shake .3s; }

.sys {
  align-self: center;
  max-width: 92%;
  text-align: center;
  font: italic 14px/1.5 var(--serif);
  color: #c9b79a;
  padding: 4px 8px;
  animation: msg-in .3s;
}
.sys.alert { font: 700 12px/1.4 var(--mono); font-style: normal; color: var(--blood); letter-spacing: .12em; animation: msg-in .3s, alert 1s steps(2) 3; }
.sys.good { color: var(--toxic); font-style: normal; font: 700 12px/1.4 var(--mono); letter-spacing: .08em; }
@keyframes alert { 50% { opacity: .3; } }

.typing { align-self: flex-start; font: 12px var(--mono); color: var(--amber-dim); padding-left: 40px; animation: msg-in .2s; }
.typing i { display: inline-block; width: 4px; height: 4px; margin: 0 1px; border-radius: 50%; background: currentColor; animation: dot 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 30% { transform: translateY(-4px); } }

/* cards */
.card {
  align-self: stretch;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #22180f, #150f0a);
  padding: 12px 14px;
  animation: msg-in .35s;
  font-size: 14px;
}
.card h3 { margin: 0 0 4px; font: 800 13px/1.2 var(--mono); letter-spacing: .1em; color: var(--amber); }
.card p { margin: 0; color: #c9b79a; line-height: 1.45; }
.card .danger { margin-top: 8px; font: 11px var(--mono); color: var(--amber-dim); }
.card .danger b { color: var(--blood); letter-spacing: 2px; }
.card .route {
  margin-top: 10px;
  font: 12px/1.6 var(--mono);
  color: var(--amber-dim);
  white-space: pre;
  overflow-x: auto;
}
.card .route em { font-style: normal; color: var(--amber); }
.card .route .here { color: #fff; background: rgb(255 181 71 / .25); border-radius: 3px; padding: 0 2px; }
.card.loot { border-color: rgb(125 255 106 / .3); }
.card.loot h3 { color: var(--toxic); }
.card.travel .prog { margin-top: 8px; height: 4px; background: rgb(255 255 255 / .06); border-radius: 2px; overflow: hidden; }
.card.travel .prog i { display: block; height: 100%; background: var(--amber); animation: prog var(--t) linear forwards; transform-origin: left; }
@keyframes prog { from { transform: scaleX(0); } }

/* composer */
#composer { background: var(--panel); border-top: 1px solid var(--line); padding: 8px 0 calc(10px + var(--safe-bottom)); }
#chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 12px 8px; min-height: 48px; justify-content: center; }
.chip {
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid rgb(255 181 71 / .45);
  color: var(--amber);
  font: 600 14px/1 var(--sans);
  background: rgb(255 181 71 / .06);
  animation: chip-in .25s backwards cubic-bezier(.2, .9, .3, 1.3);
  transition: transform .1s, background .15s;
}
.chip:nth-child(2) { animation-delay: .04s; }
.chip:nth-child(3) { animation-delay: .08s; }
.chip:nth-child(4) { animation-delay: .12s; }
.chip:nth-child(5) { animation-delay: .16s; }
@keyframes chip-in { from { opacity: 0; transform: translateY(12px) scale(.8); } }
.chip:active { transform: scale(.93); background: rgb(255 181 71 / .2); }
.chip.fight { font: 800 15px/1 var(--mono); letter-spacing: .06em; padding: 14px 18px; }
.chip.dodge { border-color: var(--ice); color: var(--ice); }
.chip.block { border-color: #ffd36a; color: #ffd36a; }
.chip.strike { border-color: var(--blood); color: #ff6b77; }
.chip.special { border-color: var(--rift-hot); color: var(--rift-hot); box-shadow: 0 0 12px rgb(255 77 210 / .35); }
.chip.hold { position: relative; overflow: hidden; isolation: isolate; border-color: var(--rift); color: #fff; padding: 16px 32px; font: 800 16px/1 var(--mono); letter-spacing: .2em; }
.chip.hold::before { content: ""; position: absolute; inset: 0; background: var(--rift); transform-origin: left; transform: scaleX(var(--p, 0)); z-index: -1; }
.chip.chosen { background: var(--amber); color: #000; }

.fake-input {
  margin: 0 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgb(0 0 0 / .3);
  border: 1px solid var(--line);
  font: 13px var(--mono);
  color: var(--amber-dim);
  min-height: 38px;
}
.caret { animation: alert 1s steps(2) infinite; }

body.flash-hurt #app { animation: hurt .4s; }
@keyframes hurt { 0% { box-shadow: inset 0 0 0 100vmax rgb(255 59 78 / .25); } }
body.flash-good #app { animation: good .4s; }
@keyframes good { 0% { box-shadow: inset 0 0 0 100vmax rgb(125 255 106 / .12); } }
