/* Cyberville components, built only from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading);
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 400; }
body { font-synthesis: none; }
.pixel { image-rendering: pixelated; }

/* ---- panel: paper, an ink outline, a hard lower edge */
.panel {
  background: var(--paper);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
}
.well {
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}

/* ---- name tab: sits on the top edge of a panel and says who or what it is */
.tab {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--display-md);
  line-height: 1.1;
  letter-spacing: 0.02em;
  padding: 2px var(--s3) 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* ---- button */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); min-width: var(--tap);
  padding: 0 var(--s5);
  font-family: var(--font-display); font-weight: 400; font-size: var(--display-md); line-height: 1; letter-spacing: 0.02em;
  color: var(--ink); background: var(--paper);
  border: var(--border) solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-button);
  cursor: pointer; white-space: nowrap;
  transition: transform var(--quick), box-shadow var(--quick);
}
.btn:hover { background: var(--gold-tint); }
.btn:active, .btn[aria-pressed="true"] { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn[aria-pressed="true"] { background: var(--main-tint); border-width: 4px; }
.btn-main { background: var(--main); color: var(--on-dark); }
.btn-main:hover { background: var(--ink); }
.btn[disabled], .btn[aria-disabled="true"] {
  background: var(--paper-2); color: var(--ink-soft); border-style: dashed; box-shadow: none; cursor: not-allowed;
}
.btn-quiet { box-shadow: none; border-width: 2px; }

/* ---- focus: the same two rings on everything that takes focus */
:focus-visible, .is-focus {
  outline: var(--focus-inner);
  outline-offset: 2px;
  box-shadow: var(--focus-outer);
}

/* ---- key cap and small helpers */
.key {
  display: inline-block; min-width: 1.9em; padding: 0 6px;
  font-family: var(--font-body); font-size: 1rem; font-weight: 700; line-height: 1.35; letter-spacing: 0; text-align: center;
  color: var(--ink); background: var(--paper-2); border: 2px solid var(--ink); border-bottom-width: 4px; border-radius: 4px;
}
.btn-main .key { border-color: var(--paper); }
.hint { font-size: var(--text-sm); color: var(--ink-soft); }
.title { font-family: var(--font-display); font-weight: 400; font-size: var(--display-lg); line-height: 1.05; }

/* ---- status tags: a shape and a word, never color alone */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-weight: 400; font-size: var(--display-sm); line-height: 1.1;
  padding: 2px 10px 3px; border: 2px solid currentColor; border-radius: var(--radius-pill);
}
.tag::before { font-family: var(--font-body); font-weight: 700; }
.tag-safe { color: var(--safe); background: var(--safe-tint); }
.tag-safe::before { content: "\2713"; }
.tag-warn { color: var(--warn); background: var(--warn-tint); }
.tag-warn::before { content: "\2715"; }
.tag-note { color: var(--pal); background: var(--pal-tint); }
.tag-note::before { content: "\2605"; }

/* ---- quest marker: a gold pin with a mark inside. "!" a new quest, "..." in progress, a check when done */
.marker {
  position: relative; display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  background: var(--gold); color: #140c1c;
  border: var(--border) solid #140c1c; border-radius: 8px;
  font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1;
  box-shadow: 0 3px 0 rgba(20, 12, 28, 0.35);
}
.marker::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; width: 10px; height: 10px;
  background: var(--gold); border-right: var(--border) solid #140c1c; border-bottom: var(--border) solid #140c1c;
  transform: translateX(-50%) rotate(45deg);
}
.marker-doing { background: var(--paper); }
.marker-doing::after { background: var(--paper); }
.marker-done { background: var(--safe-tint); color: var(--safe); }
.marker-done::after { background: var(--safe-tint); }

/* ---- name label over a head on the map */
.label {
  font-family: var(--font-display); font-weight: 400; font-size: 19px; line-height: 1; letter-spacing: 0.02em;
  color: #140c1c; background: rgba(222, 238, 214, 0.94);
  border: 2px solid #140c1c; border-radius: 4px; padding: 2px 6px 3px; white-space: nowrap;
}

/* ---- dialog box */
.dialog { position: relative; display: grid; grid-template-columns: auto 1fr; gap: var(--s4); padding: var(--s4) var(--s5) var(--s4) var(--s4); }
.dialog .tab { position: absolute; left: var(--s4); top: 0; transform: translateY(-100%); }
.dialog .face { width: 104px; height: 104px; display: grid; place-items: center; overflow: hidden; }
.dialog .face img { width: 96px; height: 96px; object-fit: contain; image-rendering: pixelated; }
.dialog .say { font-size: var(--text-lg); max-width: var(--measure); }
.dialog .row { display: flex; align-items: center; justify-content: flex-end; gap: var(--s3); margin-top: var(--s3); flex-wrap: wrap; }

/* ---- meter: counted segments, so it reads without color */
.meter { display: flex; gap: 3px; }
.meter i { width: 14px; height: 18px; border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); }
.meter i.on { background: var(--main); }

/* ---- HUD plates on the map */
.plate { white-space: nowrap; display: inline-flex; align-items: center; gap: var(--s3); padding: 6px var(--s4) 8px; }
.plate .where { font-family: var(--font-display); font-weight: 400; font-size: var(--display-lg); line-height: 1; }

/* ---- touch controls */
.stick { width: 132px; height: 132px; border-radius: 50%; background: rgba(222, 238, 214, 0.72); border: var(--border) solid #140c1c; display: grid; place-items: center; }
.stick i { width: 56px; height: 56px; border-radius: 50%; background: var(--paper); border: var(--border) solid #140c1c; box-shadow: 0 4px 0 #140c1c; }
