:root {
  --paper: #ece9f5;
  --sheet: #fbfafe;
  --ink: #1f1b4d;
  --ink-soft: #5d5a85;
  --rule: #cfcae3;
  --hot: #d92b6a;
  --gold: #f0b429;
  --teal: #197f7c;
  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--body);
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--hot);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Buttons: one loud kind for the main actions, one quiet kind for everything else. */
button {
  cursor: pointer;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--sheet);
  font-weight: 600;
  padding: 0.5rem 1.1rem;
}

button:hover {
  background: var(--hot);
  border-color: var(--hot);
}

button:disabled {
  opacity: 0.5;
  cursor: progress;
}

button.quiet {
  background: none;
  border-color: transparent;
  color: var(--ink-soft);
  font-weight: 500;
  padding-inline: 0.5rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

button.quiet:hover {
  color: var(--hot);
}

/* Header */
.top {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 2px solid var(--ink);
}

.top h1 {
  font: 800 1.5rem/1 var(--display);
  letter-spacing: -0.02em;
}

.summary {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-right: auto;
}

/* Two columns: the conversation, and the shelf it draws from. */
.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.ask {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 2px solid var(--ink);
}

.thread {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.welcome {
  margin: auto 0;
  max-width: 34rem;
}

.welcome h2 {
  font: 800 clamp(2.4rem, 5vw, 4rem) / 0.95 var(--display);
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.welcome p {
  margin-top: 1rem;
  color: var(--ink-soft);
  max-width: 30rem;
}

.starters {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.5rem;
  justify-items: start;
}

.starter {
  background: var(--sheet);
  color: var(--ink);
  font-weight: 500;
  text-align: left;
  border-radius: 0.6rem;
}

.starter:hover {
  background: var(--gold);
  border-color: var(--ink);
}

.msg {
  max-width: 38rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--sheet);
  padding: 0.6rem 1rem;
  border-radius: 1rem 1rem 0.2rem 1rem;
}

.msg.error {
  border-left: 4px solid var(--hot);
  padding-left: 0.75rem;
  color: var(--hot);
}

.status {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-style: italic;
}

.composer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--rule);
}

.composer textarea {
  flex: 1 1 14rem;
  resize: none;
  max-height: 9rem;
  padding: 0.6rem 0.9rem;
  background: var(--sheet);
  border: 2px solid var(--ink);
  border-radius: 0.8rem;
}

/* Pick cards: the one loud element. A game box with a hard ink shadow. */
.picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.5rem 1.25rem;
  padding: 0.25rem 0.5rem 0.5rem 0;
}

.pick {
  background: var(--sheet);
  border: 2px solid var(--ink);
  border-radius: 0.5rem;
  box-shadow: 6px 6px 0 var(--ink);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: land 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}

.pick:nth-child(2) {
  animation-delay: 0.08s;
}
.pick:nth-child(3) {
  animation-delay: 0.16s;
}
.pick:nth-child(4) {
  animation-delay: 0.24s;
}

@keyframes land {
  from {
    opacity: 0;
    transform: translateY(-14px) rotate(-2deg);
  }
}

.pick img,
.pick .no-cover {
  width: 100%;
  aspect-ratio: 460 / 215;
  object-fit: cover;
  display: block;
  border-bottom: 2px solid var(--ink);
  background: var(--gold);
}

.pick .no-cover {
  display: grid;
  place-items: center;
  padding: 0.75rem;
  text-align: center;
  font: 800 1.3rem/1.05 var(--display);
}

.pick-body {
  padding: 0.8rem 0.9rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.pick h3 {
  font: 800 1.2rem/1.1 var(--display);
  letter-spacing: -0.015em;
}

.facts {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.reason {
  font-size: 0.95rem;
}

.play {
  margin-top: auto;
  align-self: flex-start;
  display: inline-block;
  background: var(--hot);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  padding: 0.4rem 1rem;
  border-radius: 999px;
}

.play:hover {
  background: var(--ink);
}

.play.install {
  background: none;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink);
}

.play.install:hover {
  background: var(--gold);
}

/* Shelf */
.shelf {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1.25rem 1.5rem 0;
}

.shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.shelf-head h2 {
  font: 800 1.5rem/1 var(--display);
  letter-spacing: -0.02em;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-top: 1rem;
}

.filters input[type="search"],
.filters select {
  background: var(--sheet);
  border: 1.5px solid var(--ink);
  border-radius: 0.5rem;
  padding: 0.35rem 0.6rem;
}

.filters input[type="search"] {
  flex: 1 1 10rem;
  min-width: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.check input {
  accent-color: var(--hot);
  width: 1rem;
  height: 1rem;
}

#rolled:not(:empty) {
  margin-top: 1.25rem;
  max-width: 22rem;
  padding-right: 0.5rem;
}

.count {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.games {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  border-top: 1px solid var(--rule);
}

.games li {
  display: grid;
  grid-template-columns: 0.6rem minmax(0, 1fr) auto auto auto;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--rule);
}

/* The dot says one thing: is it installed. */
.dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  border: 1.5px solid var(--rule);
  align-self: center;
}

.dot.on {
  background: var(--teal);
  border-color: var(--teal);
}

.games .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.games .store,
.games .time {
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.games .time {
  min-width: 4.5rem;
  text-align: right;
}

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

.games a:hover {
  color: var(--hot);
  text-decoration: underline;
}

.empty {
  padding: 1.5rem 0.25rem;
  color: var(--ink-soft);
}

@media (max-width: 860px) {
  html,
  body {
    height: auto;
  }
  .layout {
    display: block;
  }
  .ask {
    border-right: 0;
    border-bottom: 2px solid var(--ink);
    min-height: 80vh;
  }
  .top {
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
  }
  .games {
    overflow: visible;
  }
}

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

/* Tables and card grids the picker lays out (DLC lists, comparisons) */
.results-title {
  font: 800 1.3rem/1.1 var(--display);
  letter-spacing: -0.015em;
  margin-bottom: 0.75rem;
}

.table-scroll {
  overflow-x: auto;
  background: var(--sheet);
  border: 2px solid var(--ink);
  border-radius: 0.5rem;
  box-shadow: 6px 6px 0 var(--ink);
  margin: 0 0.5rem 0.5rem 0;
}

.results table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}

.results th,
.results td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--rule);
}

.results thead th {
  background: var(--gold);
  border-bottom: 2px solid var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.results tbody th {
  font-weight: 600;
  min-width: 9rem;
}

.results tbody tr:last-child > * {
  border-bottom: 0;
}

.results tbody a {
  color: inherit;
  text-underline-offset: 3px;
}

.results tbody a:hover {
  color: var(--hot);
}

.card-facts {
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.25rem 0.75rem;
  font-size: 0.92rem;
}

.card-facts dt {
  color: var(--ink-soft);
}

.card-facts dd {
  margin: 0;
}

/* The picker's replies: paragraphs, bullet lists and bold */
.msg.reply {
  white-space: normal;
  display: grid;
  gap: 0.7rem;
}

.msg.reply ul {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.3rem;
}

/* Cover art that links to the game's Steam page */
.cover-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.cover-link:hover img {
  filter: brightness(1.12);
}

.cover-link:focus-visible {
  outline-offset: -3px;
}

/* Asking about one game from the shelf */
.games .ask-about {
  padding: 0 0.25rem;
  font-size: 0.85rem;
}

.topic {
  flex-basis: 100%;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.topic strong {
  color: var(--ink);
}

.msg.user .about {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
}

.msg.reply a {
  color: inherit;
  text-underline-offset: 3px;
}

.msg.reply a:hover {
  color: var(--hot);
}

/* A line in the conversation each time the picker changes its notes */
.memory-line {
  font-size: 0.88rem;
  color: var(--ink-soft);
  border-left: 3px solid var(--teal);
  padding-left: 0.7rem;
  max-width: 38rem;
}

/* "What I remember" */
.memory {
  width: min(44rem, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  padding: 1.5rem;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0.6rem;
  box-shadow: 8px 8px 0 var(--ink);
}

.memory::backdrop {
  background: rgb(31 27 77 / 0.45);
}

.memory-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.memory-head h2 {
  font: 800 1.8rem/1 var(--display);
  letter-spacing: -0.02em;
}

.memory-intro {
  margin-top: 0.5rem;
  color: var(--ink-soft);
  max-width: 34rem;
}

.memory-section {
  margin-top: 1.5rem;
}

.memory-section h3 {
  font: 800 1.15rem/1.1 var(--display);
}

.memory-section .empty {
  padding: 0.5rem 0 0;
}

.notes {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
}

.note-date {
  grid-column: 1;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.note-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
}

.note textarea,
.note-add input {
  background: var(--sheet);
  border: 1.5px solid var(--ink);
  border-radius: 0.5rem;
  padding: 0.4rem 0.6rem;
  width: 100%;
  resize: vertical;
}

.note-add {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.note-add button {
  white-space: nowrap;
}

/* Welcome screen: suggestions to ask about, conversations to continue */
.home-section {
  margin-top: 2rem;
}

.home-section h3 {
  font: 800 1.15rem/1.1 var(--display);
}

#home-error {
  margin-top: 1.5rem;
}

.follow-up {
  background: var(--sheet);
  border: 2px solid var(--ink);
  border-radius: 0.5rem;
  box-shadow: 5px 5px 0 var(--teal);
  padding: 0.9rem 1rem 1rem;
}

.follow-up + .follow-up {
  margin-top: 1rem;
}

.follow-up h4 {
  margin: 0;
  font: 800 1.15rem/1.15 var(--display);
}

.follow-up .facts {
  margin-top: 0.2rem;
}

.answers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.conversations {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
}

.conversations li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--rule);
}

.conversations .open {
  text-align: left;
  padding-left: 0;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversations .when {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* With more on the welcome screen it can outgrow the column, so let it start at the top and scroll. */
.welcome {
  margin: 0;
  padding-bottom: 1rem;
}

/* Signed-in user in the header */
.who {
  font-weight: 600;
  font-size: 0.9rem;
}

[hidden] {
  display: none !important;
}

/* Sign-in page */
.login {
  margin: auto;
  padding: 2rem 1.5rem;
  max-width: 38rem;
}

.login h1 {
  font: 800 clamp(2.6rem, 7vw, 4.5rem) / 0.95 var(--display);
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.login p {
  margin-top: 1rem;
  max-width: 32rem;
}

.login .soft {
  color: var(--ink-soft);
}

.login .steam {
  display: inline-block;
  margin-top: 1.75rem;
  background: var(--ink);
  color: var(--sheet);
  font-weight: 600;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  box-shadow: 5px 5px 0 var(--hot);
}

.login .steam:hover {
  background: var(--hot);
  box-shadow: 5px 5px 0 var(--ink);
}

.login code {
  font-size: 1.05em;
  font-weight: 600;
  user-select: all;
}

.login .msg {
  white-space: normal;
  margin-top: 1.5rem;
}
