/*
  星球秘境 / Planet Realms: the world fills the stage under the site bar. The interface is dark
  carved wood and stone with brass and gold trim, parchment-warm text: the party along the
  bottom, the round map top-right, the action buttons on the right, windows for everything else.
*/

html,
body {
  height: 100%;
}

body.r-body {
  margin: 0;
  overflow: hidden;
  color: #efe4cc;
  background: #0b0907;
  font-family: var(--gh-font-body);
  overscroll-behavior: none;
}

.r-stage {
  --gold: #e2b85a;
  --gold-hi: #ffe39a;
  --gold-lo: #8a6424;
  --ink: #efe4cc;
  --dim: #b4a68a;
  --wood: #2a1f16;
  --wood-hi: #3a2b1e;
  --panel: rgba(22, 16, 11, 0.95);
  --line: rgba(226, 184, 90, 0.45);
  --hp: #6ed86a;
  --sp: #5aa6ff;
  --bad: #ff7a64;
  --good: #8af08a;
  position: fixed;
  inset: 56px 0 0;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-size: 15px;
  line-height: 1.45;
  overflow: hidden;
}

#rCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  opacity: 0;
  transition: opacity 900ms ease;
  cursor: crosshair;
}

.r-stage.is-ready #rCanvas {
  opacity: 1;
}

.r-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}

.r-stage [hidden] {
  display: none !important;
}

.r-ui,
.r-wins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.r-wins > * {
  pointer-events: auto;
}

/* ------------------------------------------------------------ buttons */
.r-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--gold-lo);
  border-radius: 6px;
  color: var(--ink);
  background: linear-gradient(#4a3826, #2e2218);
  box-shadow: inset 0 1px 0 rgba(255, 220, 150, 0.18), 0 2px 0 rgba(0, 0, 0, 0.5);
  font: 600 0.9375rem/1.2 var(--gh-font-body);
  cursor: pointer;
  transition: filter 120ms, transform 80ms;
}

.r-btn:hover:not(:disabled) {
  filter: brightness(1.18);
}

.r-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.r-btn:focus-visible,
.r-tab:focus-visible,
.r-topic:focus-visible,
.r-pick:focus-visible,
.r-act:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 2px;
}

.r-btn.is-gold {
  color: #2a1a08;
  border-color: #fff0b8;
  background: linear-gradient(#ffe39a, #d8a042);
}

.r-btn.is-quiet {
  background: transparent;
  border-color: rgba(226, 184, 90, 0.3);
  color: var(--dim);
  box-shadow: none;
}

.r-btn.is-big {
  min-height: 46px;
  padding: 8px 26px;
  font-size: 1.0625rem;
}

.r-btn.is-small {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 0.8125rem;
}

.r-btn.is-tiny {
  min-height: 24px;
  min-width: 26px;
  padding: 2px 6px;
  font-size: 0.75rem;
}

.r-btn.is-dim,
.r-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.r-btn.is-has {
  color: var(--good);
  border-color: rgba(138, 240, 138, 0.4);
}

.r-x {
  appearance: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.3);
  font-size: 1rem;
  cursor: pointer;
}

.r-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.r-row-end {
  justify-content: flex-end;
}

.r-row-center {
  justify-content: center;
}

.r-col-btns {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.r-note {
  color: var(--dim);
  font-size: 0.8125rem;
}

.r-good {
  color: var(--good);
}

.r-bad {
  color: var(--bad);
}

kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 4px;
  border: 1px solid rgba(226, 184, 90, 0.5);
  border-radius: 4px;
  color: var(--gold-hi);
  background: rgba(0, 0, 0, 0.4);
  font: 600 0.75rem/1.5 var(--gh-font-body);
  text-align: center;
}

/* ------------------------------------------------------------ windows */
.r-shade {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(6, 4, 2, 0.55);
  animation: r-fade 160ms ease-out;
}

.r-shade.is-title,
.r-shade.is-story {
  background: linear-gradient(180deg, rgba(6, 4, 2, 0.1), rgba(6, 4, 2, 0.6));
}

@keyframes r-fade {
  from {
    opacity: 0;
  }
}

.r-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: 100%;
  border: 2px solid var(--gold-lo);
  border-radius: 10px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(120, 84, 40, 0.25), transparent 60%),
    linear-gradient(var(--panel), rgba(14, 10, 7, 0.97));
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(255, 220, 150, 0.12), 0 24px 60px -16px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.r-panel.is-wide {
  width: min(980px, 100%);
}

.r-panel.is-full {
  width: min(1180px, 100%);
  height: 100%;
}

.r-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px 8px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(rgba(90, 62, 30, 0.35), transparent);
}

.r-panel-title {
  margin: 0;
  color: var(--gold-hi);
  font: 700 1.125rem/1.3 var(--gh-font-display);
  letter-spacing: 0.04em;
}

.r-panel-body {
  padding: 14px 18px 16px;
  overflow: auto;
  overscroll-behavior: contain;
}

.r-panel h3 {
  margin: 12px 0 6px;
  color: var(--gold);
  font-size: 0.9375rem;
}

.r-panel h3 small {
  color: var(--dim);
  font-weight: 400;
}

.r-shade.is-small .r-panel {
  width: min(440px, 100%);
}

.r-confirm-text,
.r-notice-text {
  margin: 8px 0;
  font-size: 1rem;
  white-space: pre-line;
}

.r-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 10px;
  border-bottom: 1px solid var(--line);
}

.r-tab {
  appearance: none;
  position: relative;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  color: var(--dim);
  background: transparent;
  font: 600 0.875rem/1.2 var(--gh-font-body);
  cursor: pointer;
}

.r-tab.is-on {
  color: var(--gold-hi);
  border-color: var(--line);
  background: rgba(120, 84, 40, 0.25);
}

.r-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 9px;
  color: #2a1a08;
  background: var(--gold-hi);
  font: 700 0.6875rem/1.5 var(--gh-font-body);
  font-style: normal;
}

/* ------------------------------------------------------------ items and the card */
.r-item {
  position: relative;
  background: center / contain no-repeat;
  border-radius: 4px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6));
}

.r-item.in-pack {
  position: absolute;
  cursor: pointer;
}

.r-item.in-pack:hover {
  background-color: rgba(255, 220, 140, 0.12);
}

.r-item.is-magic {
  box-shadow: inset 0 0 0 1px rgba(120, 170, 255, 0.45);
}

.r-item.is-art {
  box-shadow: inset 0 0 0 1px rgba(255, 210, 100, 0.8), 0 0 10px rgba(255, 200, 80, 0.4);
}

.r-item.is-unknown::after {
  content: "?";
  position: absolute;
  right: 2px;
  top: 0;
  color: var(--gold-hi);
  font: 700 0.75rem/1 var(--gh-font-body);
}

.r-power {
  position: absolute;
  right: 1px;
  bottom: 0;
  padding: 0 2px;
  border-radius: 3px;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  font: 700 0.625rem/1.3 var(--gh-font-body);
  font-style: normal;
}

.r-card {
  position: fixed;
  z-index: 90;
  max-width: 300px;
  padding: 10px 12px;
  border: 1px solid var(--gold-lo);
  border-radius: 8px;
  background: rgba(16, 11, 7, 0.97);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  display: grid;
  gap: 2px;
  font-size: 0.8125rem;
}

.r-card strong {
  color: var(--ink);
  font-size: 0.9375rem;
}

.r-card strong.is-magic {
  color: #9ac4ff;
}

.r-card strong.is-art {
  color: var(--gold-hi);
}

.r-card span {
  color: #d8ccb0;
}

.r-card em {
  color: var(--gold);
  font-style: normal;
}

.r-held {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 95;
  pointer-events: none;
  opacity: 0.9;
}

/* ------------------------------------------------------------ the HUD */
.r-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.r-hud > * {
  pointer-events: auto;
}

.r-cross {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  pointer-events: none !important;
  transition: border-color 120ms, transform 120ms;
}

.r-cross.is-on {
  border-color: rgba(255, 230, 160, 0.85);
}

.r-cross.is-foe {
  border-color: #ff6a50;
  transform: scale(1.3);
}

.r-hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--bar-h, 118px) + 54px);
  transform: translateX(-50%);
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(14, 10, 6, 0.82);
  font-size: 0.9375rem;
  white-space: nowrap;
  pointer-events: none !important;
}

.r-hint.is-far {
  opacity: 0.6;
}

.r-hint small {
  color: var(--dim);
}

.r-log {
  position: absolute;
  left: 12px;
  bottom: calc(var(--bar-h, 118px) + 14px);
  display: grid;
  gap: 2px;
  max-width: min(560px, 60vw);
  pointer-events: none !important;
}

.r-log-line {
  justify-self: start;
  padding: 2px 10px;
  border-radius: 4px;
  background: rgba(10, 7, 4, 0.6);
  color: #f0e6d0;
  font-size: 0.875rem;
  text-shadow: 0 1px 2px #000;
}

.r-nums {
  position: absolute;
  inset: 0;
  pointer-events: none !important;
}

.r-num {
  position: absolute;
  left: 0;
  top: 0;
  font: 800 1.25rem/1 var(--gh-font-body);
  text-shadow: 0 2px 0 #000, 0 0 6px #000;
}

.r-side {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 172px;
}

.r-minimap {
  position: relative;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 3px solid var(--gold-lo);
  box-shadow: 0 0 0 2px #000, inset 0 0 18px rgba(0, 0, 0, 0.8), 0 6px 16px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  overflow: hidden;
}

.r-minimap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.r-compass {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 4px;
  height: 18px;
  pointer-events: none;
}

.r-compass i {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  color: var(--gold-hi);
  font: 700 0.8125rem/1 var(--gh-font-body);
  font-style: normal;
  text-shadow: 0 1px 2px #000, 0 0 4px #000;
}

.r-where,
.r-date,
.r-money {
  width: 100%;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(14, 10, 6, 0.72);
  font-size: 0.8125rem;
  text-align: center;
  text-shadow: 0 1px 2px #000;
}

.r-where {
  color: var(--gold-hi);
  font-weight: 700;
}

.r-date small {
  color: var(--dim);
}

.r-money {
  display: flex;
  justify-content: space-around;
}

.r-buffs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
}

.r-buffs i {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--b, var(--line));
  border-radius: 50%;
  color: var(--b, var(--gold));
  background: rgba(14, 10, 6, 0.85);
  box-shadow: 0 0 6px color-mix(in srgb, var(--b, #e2b85a) 50%, transparent);
  font: 700 0.6875rem/1 var(--gh-font-body);
  font-style: normal;
}

.r-money span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.r-act-i {
  display: inline-flex;
  color: var(--gold-hi);
}

.r-tb {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #6ab0ff;
  border-radius: 6px;
  background: rgba(14, 30, 60, 0.85);
  font-size: 0.8125rem;
  text-align: center;
}

.r-acts {
  position: absolute;
  right: 10px;
  bottom: calc(var(--bar-h, 118px) + 12px);
  display: grid;
  grid-template-columns: repeat(2, 84px);
  gap: 5px;
}

.r-act {
  appearance: none;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--gold-lo);
  border-radius: 6px;
  color: var(--ink);
  background: linear-gradient(rgba(70, 52, 34, 0.92), rgba(34, 25, 17, 0.92));
  font: 600 0.8125rem/1 var(--gh-font-body);
  cursor: pointer;
}

.r-act:hover {
  filter: brightness(1.2);
}

.r-act kbd {
  position: absolute;
  right: 3px;
  top: 2px;
  min-width: 0;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--dim);
  font-size: 0.5625rem;
  line-height: 1;
}

.r-act.is-attack {
  border-color: #b8503a;
}

.r-act.is-on {
  border-color: #6ab0ff;
  box-shadow: 0 0 10px rgba(106, 176, 255, 0.6);
}

/* The party bar. */
.r-party {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(880px, calc(100% - 20px));
  padding: 8px;
  border: 2px solid var(--gold-lo);
  border-radius: 12px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 2px, transparent 2px 7px),
    linear-gradient(var(--wood-hi), var(--wood));
  box-shadow: 0 0 0 1px #000, inset 0 1px 0 rgba(255, 220, 150, 0.15), 0 8px 24px rgba(0, 0, 0, 0.7);
}

.r-hero {
  display: flex;
  gap: 8px;
  min-width: 0;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}

.r-hero:hover {
  background: rgba(255, 220, 140, 0.06);
}

.r-hero.is-active {
  border-color: var(--gold-hi);
  background: rgba(255, 220, 140, 0.1);
  box-shadow: 0 0 14px rgba(255, 200, 90, 0.35);
}

.r-hero.is-swing .r-face {
  animation: r-swing 260ms ease-out;
}

@keyframes r-swing {
  40% {
    transform: translateY(-6px) scale(1.05);
  }
}

.r-face {
  position: relative;
  flex: 0 0 auto;
  width: 78px;
  height: 78px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  overflow: hidden;
  background: #111;
}

.r-face img {
  width: 100%;
  height: 100%;
  display: block;
}

.r-rec {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.r-hero.is-down .r-face img {
  filter: grayscale(0.6) brightness(0.75);
}

.r-gem {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 6px currentColor;
}

.r-gem.is-green {
  color: #4ad86a;
  background: #4ad86a;
}

.r-gem.is-yellow {
  color: #ffd040;
  background: #ffd040;
}

.r-gem.is-red {
  color: #ff4a3a;
  background: #ff4a3a;
  animation: r-blink 700ms infinite alternate;
}

@keyframes r-blink {
  to {
    opacity: 0.4;
  }
}

.r-up {
  position: absolute;
  right: 3px;
  top: 1px;
  color: var(--gold-hi);
  font-size: 0.8125rem;
  text-shadow: 0 1px 2px #000;
}

.r-up.is-train {
  color: #8af08a;
  animation: r-blink 900ms infinite alternate;
}

.r-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.r-flash.is-on {
  animation: r-hurt 450ms ease-out;
}

.r-flash.is-glow {
  animation: r-glow 700ms ease-out;
}

@keyframes r-hurt {
  from {
    opacity: 0.8;
    background: rgba(255, 30, 20, 0.8);
  }
}

@keyframes r-glow {
  from {
    opacity: 0.85;
    background: radial-gradient(circle, var(--glow, #fff), transparent 75%);
  }
}

.r-hero-info {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.r-hero-info strong {
  overflow: hidden;
  color: var(--gold-hi);
  font-size: 0.875rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.r-hero-info small {
  overflow: hidden;
  color: var(--dim);
  font-size: 0.6875rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.r-bar {
  position: relative;
  height: 13px;
  border: 1px solid rgba(0, 0, 0, 0.7);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.r-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(#8af08a, #3aa04a);
  transition: width 200ms;
}

.r-bar i.is-mid {
  background: linear-gradient(#ffe070, #c89a20);
}

.r-bar i.is-low {
  background: linear-gradient(#ff8a6a, #c0302a);
}

.r-bar.is-sp i {
  background: linear-gradient(#8ac4ff, #2a6ad0);
}

.r-bar span {
  position: relative;
  display: block;
  font: 600 0.625rem/13px var(--gh-font-body);
  text-align: center;
  text-shadow: 0 1px 1px #000;
}

.r-hero-info em {
  min-height: 1em;
  color: var(--bad);
  font-size: 0.6875rem;
  font-style: normal;
}

.r-stage.is-picking .r-hero {
  border-color: #6ab0ff;
  animation: r-blink 700ms infinite alternate;
}

/* Touch. */
.r-touch {
  display: none;
}

.r-stage.is-touch .r-touch {
  display: block;
  pointer-events: none !important;
}

.r-stick {
  position: absolute;
  left: 18px;
  bottom: calc(var(--bar-h, 118px) + 20px);
  width: 120px;
  height: 120px;
  border: 2px solid rgba(226, 184, 90, 0.4);
  border-radius: 50%;
  background: rgba(14, 10, 6, 0.35);
  pointer-events: auto;
  touch-action: none;
}

.r-stick i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffe39a, #a87a30);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
}

.r-tbtns {
  position: absolute;
  right: 196px;
  bottom: calc(var(--bar-h, 118px) + 20px);
  display: grid;
  grid-template-columns: repeat(2, 54px);
  gap: 8px;
  pointer-events: auto;
}

.r-tbtn {
  appearance: none;
  width: 54px;
  height: 54px;
  border: 2px solid var(--gold-lo);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(40, 30, 20, 0.85);
  font-size: 1.25rem;
  touch-action: none;
}

.r-tbtn.is-big {
  border-color: #ff7a5a;
}

/* ------------------------------------------------------------ title and making the party */
.r-panel.r-title {
  width: min(560px, 100%);
  padding: 18px 10px 10px;
  border-color: rgba(226, 184, 90, 0.7);
  background: radial-gradient(120% 90% at 50% 0%, rgba(80, 52, 22, 0.75), rgba(10, 7, 4, 0.85));
  text-align: center;
}

.r-title-kicker {
  margin: 0;
  color: var(--gold);
  font-size: 0.8125rem;
  letter-spacing: 0.2em;
}

.r-title-name {
  margin: 4px 0;
  color: var(--gold-hi);
  font: 800 clamp(2.4rem, 7vw, 3.6rem)/1.1 var(--gh-font-display);
  letter-spacing: 0.08em;
  text-shadow: 0 0 24px rgba(255, 190, 80, 0.45), 0 3px 0 #3a2208;
}

.r-title-sub {
  margin: 0 0 14px;
  color: var(--dim);
}

.r-title-menu {
  display: grid;
  gap: 8px;
  max-width: 280px;
  margin: 0 auto;
}

.r-title-keys {
  margin: 14px 0 0;
  color: var(--dim);
  font-size: 0.75rem;
}

.r-create .r-panel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1;
}

.r-create-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.r-slot {
  appearance: none;
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 6px;
  border: 2px solid rgba(226, 184, 90, 0.25);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.3);
  text-align: left;
  cursor: pointer;
}

.r-slot img {
  grid-row: span 2;
  width: 52px;
  height: 52px;
  border-radius: 6px;
}

.r-slot strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.r-slot small {
  color: var(--dim);
  font-size: 0.75rem;
}

.r-slot.is-on {
  border-color: var(--gold-hi);
  background: rgba(255, 220, 140, 0.1);
}

.r-slot .r-badge {
  position: absolute;
  right: 6px;
  top: 6px;
}

.r-create-edit {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 250px;
  gap: 18px;
  flex-shrink: 0;
}

.r-create-col h3:first-child {
  margin-top: 0;
}

.r-create-face img {
  display: block;
  width: 160px;
  height: 160px;
  margin: 0 auto;
  border: 3px solid var(--gold);
  border-radius: 10px;
}

.r-label {
  display: block;
  margin: 8px 0 4px;
  color: var(--dim);
  font-size: 0.8125rem;
}

.r-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--gold-lo);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.45);
  font: 600 1rem var(--gh-font-body);
  user-select: text;
}

.r-pick-grid {
  display: grid;
  gap: 6px;
}

.r-pick-grid.is-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.r-pick-grid.is-9 {
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}

.r-pick {
  appearance: none;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px;
  border: 2px solid rgba(226, 184, 90, 0.2);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.3);
  font: 600 0.8125rem var(--gh-font-body);
  cursor: pointer;
}

.r-pick img {
  width: 100%;
  max-width: 64px;
  border-radius: 6px;
}

.r-pick.is-text {
  padding: 8px 4px;
  border-left: 4px solid var(--tint, var(--gold));
}

.r-pick.is-on {
  border-color: var(--gold-hi);
  background: rgba(255, 220, 140, 0.14);
}

.r-blurb {
  margin: 8px 0;
  padding: 8px 10px;
  border-left: 3px solid var(--gold-lo);
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.875rem;
}

.r-blurb b {
  color: var(--gold-hi);
  font-weight: 600;
}

.r-blurb small {
  color: var(--dim);
}

.r-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.r-chip {
  appearance: none;
  padding: 5px 10px;
  border: 1px solid rgba(226, 184, 90, 0.35);
  border-radius: 14px;
  color: var(--dim);
  background: rgba(0, 0, 0, 0.3);
  font: 600 0.8125rem var(--gh-font-body);
  cursor: pointer;
}

.r-chip.is-on {
  color: #2a1a08;
  border-color: #fff0b8;
  background: var(--gold-hi);
}

.r-chip.is-fixed {
  color: var(--gold-hi);
  border-style: dashed;
  cursor: default;
}

.r-stats-edit {
  display: grid;
  gap: 4px;
}

.r-stat-row {
  display: grid;
  grid-template-columns: 28px 1fr 34px 30px 28px;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
}

.r-stat-row b {
  font-size: 1rem;
  text-align: right;
}

.r-stat-row b.is-up,
.r-statline b.is-up {
  color: var(--good);
}

.r-stat-row b.is-down,
.r-statline b.is-down {
  color: var(--bad);
}

.r-stat-row small {
  color: var(--dim);
}

/* ------------------------------------------------------------ story */
.r-panel.r-story {
  width: min(720px, 100%);
  padding: 22px 26px 12px;
  border-color: rgba(226, 184, 90, 0.6);
  background: rgba(10, 7, 4, 0.88);
}

.r-story-text {
  margin: 0;
  min-height: 7em;
  font-size: 1.125rem;
  line-height: 1.8;
}

.r-story-text.is-in {
  animation: r-rise 700ms ease-out;
}

@keyframes r-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ------------------------------------------------------------ the sheet */
.r-sheet-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.r-sheet-heroes,
.r-who {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.r-mini {
  appearance: none;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 64px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 8px;
  color: var(--dim);
  background: rgba(0, 0, 0, 0.3);
  font: 600 0.6875rem var(--gh-font-body);
  cursor: pointer;
}

.r-mini img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
}

.r-mini span {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.r-mini.is-on {
  border-color: var(--gold-hi);
  color: var(--gold-hi);
}

.r-sheet-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.r-sheet-face img {
  display: block;
  width: 140px;
  height: 140px;
  border: 3px solid var(--gold);
  border-radius: 10px;
}

.r-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  margin: 8px 0;
  font-size: 0.875rem;
}

.r-dl dt {
  color: var(--dim);
}

.r-dl dd {
  margin: 0;
  text-align: right;
}

.r-statlist {
  display: grid;
  gap: 3px;
}

.r-statline {
  display: grid;
  grid-template-columns: 1fr 40px 32px 32px;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.875rem;
}

.r-statline b {
  text-align: right;
}

.r-statline small,
.r-statline em {
  color: var(--dim);
  font-style: normal;
  text-align: right;
}

.r-skillgroups {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.r-skillgroup h3 {
  margin-top: 0;
}

.r-skill {
  display: grid;
  grid-template-columns: 1fr 28px 26px auto;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.8125rem;
}

.r-skill + .r-skill {
  margin-top: 3px;
}

.r-skill.is-off {
  color: rgba(239, 228, 204, 0.4);
}

.r-skill small {
  color: var(--gold);
  text-align: center;
}

.r-skill b {
  text-align: right;
}

.r-sheet-body > .r-note:first-child {
  grid-column: 1 / -1;
  margin: 0;
}

.r-awards {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
}

.r-awards li {
  padding: 3px 0;
  color: var(--gold-hi);
}

/* The paper doll and the pack. */
.r-sheet-body:has(.r-doll) {
  grid-template-columns: 300px minmax(0, 1fr);
}

.r-doll {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 64px;
  gap: 5px;
}

.r-doll-figure {
  grid-column: 2 / 4;
  grid-row: 1 / 3;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  padding: 4px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.r-doll-figure img {
  width: 92px;
  height: 92px;
  border-radius: 8px;
}

.r-doll-figure span {
  color: var(--dim);
  font-size: 0.625rem;
  text-align: center;
}

.r-slot-box {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(226, 184, 90, 0.3);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  overflow: hidden;
}

.r-slot-box > small {
  position: absolute;
  left: 4px;
  top: 2px;
  color: rgba(239, 228, 204, 0.4);
  font-size: 0.5625rem;
}

.r-slot-box .r-item {
  max-width: 92%;
  max-height: 92%;
  background-size: contain;
}

.r-slot-box.is-main,
.r-slot-box.is-off,
.r-slot-box.is-missile,
.r-slot-box.is-armor {
  grid-row: span 2;
}

.r-pack-wrap {
  min-width: 0;
}

.r-pack {
  position: relative;
  margin: 0 auto;
  border: 2px solid var(--gold-lo);
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.45);
  background-image:
    linear-gradient(rgba(226, 184, 90, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 184, 90, 0.08) 1px, transparent 1px);
  background-size: 30px 30px;
}

.r-pack-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.r-pack-foot span {
  margin-right: auto;
  color: var(--gold-hi);
}

/* ------------------------------------------------------------ the spellbook */
.r-spells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.r-spell {
  appearance: none;
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 2px solid rgba(226, 184, 90, 0.2);
  border-radius: 10px;
  color: var(--ink);
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--school) 22%, transparent), rgba(0, 0, 0, 0.35));
  font: 600 0.75rem var(--gh-font-body);
  cursor: pointer;
}

.r-spell img {
  width: 48px;
  height: 48px;
}

.r-spell small {
  position: absolute;
  right: 6px;
  top: 4px;
  color: #9ac4ff;
}

.r-spell.is-unknown {
  opacity: 0.4;
  cursor: default;
}

.r-spell.is-unknown i {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  font-size: 1.5rem;
  font-style: normal;
}

.r-spell.is-on {
  border-color: var(--gold-hi);
}

.r-spell.is-quick::after {
  content: "R";
  position: absolute;
  left: 6px;
  top: 4px;
  color: var(--gold-hi);
  font-size: 0.6875rem;
}

.r-spell-detail {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.r-spell-detail img {
  width: 72px;
  height: 72px;
}

.r-spell-detail h3 {
  margin-top: 0;
}

.r-spell-detail > div {
  flex: 1;
}

.r-spell-detail .r-row {
  flex: 0 0 auto;
}

/* ------------------------------------------------------------ buildings and people */
.r-shop-head,
.r-talk-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
}

.r-keeper {
  flex: 0 0 auto;
  width: 96px;
  height: 96px;
  border: 3px solid var(--gold);
  border-radius: 10px;
}

.r-keeper.is-big {
  width: 132px;
  height: 132px;
}

.r-shop-head strong,
.r-talk-head strong {
  display: block;
  color: var(--gold-hi);
  font-size: 1.125rem;
}

.r-shop-head small,
.r-talk-head small {
  color: var(--dim);
}

.r-shop-head p {
  margin: 4px 0 0;
  font-style: italic;
}

.r-money-line {
  margin: 0 0 8px;
  color: var(--gold-hi);
}

.r-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(transparent calc(100% - 10px), rgba(90, 62, 30, 0.6) calc(100% - 10px)),
    rgba(0, 0, 0, 0.3);
}

.r-shelf-item {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
}

.r-shelf-item:hover {
  background: rgba(255, 220, 140, 0.12);
}

.r-shelf-item span {
  color: var(--gold-hi);
  font: 700 0.75rem var(--gh-font-body);
}

.r-shelf-item b {
  max-width: 90px;
  font-size: 0.6875rem;
  text-align: center;
}

.r-shelf-item.is-dim {
  opacity: 0.5;
}

.r-list {
  display: grid;
  gap: 6px;
}

.r-list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
}

.r-list-row img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
}

.r-list-row > span {
  flex: 1;
  min-width: 140px;
}

.r-list-row small {
  display: block;
  color: var(--dim);
  font-size: 0.75rem;
}

.r-teach {
  display: grid;
  gap: 6px;
}

.r-teach-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
}

.r-teach-row b {
  min-width: 100px;
  color: var(--gold-hi);
}

.r-rumor {
  margin: 6px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--gold-lo);
  background: rgba(0, 0, 0, 0.3);
  font-style: italic;
}

.r-teacher {
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}

.r-teacher h3 {
  margin: 0 0 4px;
}

.r-speech {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(240, 225, 190, 0.07);
  font-size: 1rem;
  line-height: 1.7;
}

.r-speech p {
  margin: 0 0 6px;
}

.r-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.r-topic {
  appearance: none;
  padding: 7px 14px;
  border: 1px solid var(--gold-lo);
  border-radius: 18px;
  color: var(--gold-hi);
  background: rgba(60, 42, 24, 0.7);
  font: 600 0.875rem var(--gh-font-body);
  cursor: pointer;
}

.r-topic:hover {
  background: rgba(90, 64, 34, 0.9);
}

/* ------------------------------------------------------------ journal and maps */
.r-quest {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-left: 3px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}

.r-quest.is-main {
  border-left-color: var(--gold-hi);
}

.r-quest h3 {
  margin: 0 0 4px;
}

.r-quest p {
  margin: 0;
  font-size: 0.875rem;
}

.r-bigmap {
  display: block;
  margin: 0 auto;
  border: 2px solid var(--gold-lo);
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
}

.r-planet {
  position: relative;
  display: grid;
  justify-items: center;
}

.r-globe {
  width: min(520px, 80vw, 60vh);
  height: auto;
  aspect-ratio: 1;
  image-rendering: auto;
}

.r-globe-labels {
  position: absolute;
  top: 0;
  width: min(520px, 80vw, 60vh);
  height: auto;
  aspect-ratio: 1;
  cursor: grab;
  touch-action: none;
}

.r-set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(226, 184, 90, 0.15);
}

.r-set-row input[type="range"] {
  width: 180px;
  accent-color: var(--gold);
}

.r-help-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  font-size: 0.875rem;
}

.r-help-cols ul {
  margin: 0;
  padding-left: 18px;
}

/* ------------------------------------------------------------ tower cards */
.r-cards .r-panel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.r-cards-table {
  display: grid;
  grid-template-columns: 170px 1fr 170px;
  gap: 12px;
  flex: 1;
  min-height: 220px;
}

.r-cards-side {
  display: grid;
  align-content: start;
  gap: 8px;
}

.r-cards-side h3 {
  margin: 0;
  text-align: center;
}

.r-stock {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0 8px;
  padding: 6px 10px;
  border-left: 4px solid var(--c);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
}

.r-stock b {
  color: var(--c);
  font-size: 1.125rem;
  filter: brightness(1.5);
}

.r-stock span {
  font-size: 1.125rem;
  font-weight: 700;
}

.r-stock small {
  color: var(--dim);
  font-size: 0.6875rem;
}

.r-towers {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 10px;
  border-radius: 10px;
  background: linear-gradient(#1a2a44, #3a4a5a 70%, #4a5a3a 70%, #3a4a2a);
}

.r-tower {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100%;
  width: 46%;
  justify-content: center;
}

.r-tower-top {
  position: relative;
  width: 60px;
  min-height: 4px;
  border: 2px solid #3a2a1a;
  border-bottom: 0;
  background: repeating-linear-gradient(#b89a70 0 10px, #8a7050 10px 12px);
  transition: height 400ms;
}

.r-tower.is-foe .r-tower-top {
  background: repeating-linear-gradient(#a07a8a 0 10px, #7a5a6a 10px 12px);
}

.r-tower-top::before {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  top: -24px;
  height: 24px;
  background: #c03a2a;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.r-tower.is-foe .r-tower-top::before {
  background: #3a5ac0;
}

.r-wall {
  position: relative;
  width: 30px;
  min-height: 2px;
  background: repeating-linear-gradient(90deg, #8a8478 0 8px, #6a645a 8px 10px);
  transition: height 400ms;
}

.r-tower-top span,
.r-wall span {
  position: absolute;
  left: 50%;
  top: -46px;
  transform: translateX(-50%);
  font-weight: 800;
  text-shadow: 0 1px 2px #000;
}

.r-wall span {
  top: -22px;
  font-size: 0.8125rem;
}

.r-goal {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--dim);
  font-size: 0.75rem;
  white-space: nowrap;
}

.r-cards-last {
  min-height: 1.5em;
  text-align: center;
}

.r-cards-result {
  text-align: center;
}

.r-cards-result.is-win h2 {
  color: var(--gold-hi);
}

.r-cards-result.is-lose h2 {
  color: var(--bad);
}

.r-hand {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.r-tcard {
  appearance: none;
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 130px;
  padding: 10px 8px;
  border: 2px solid var(--c);
  border-radius: 10px;
  color: var(--ink);
  background: linear-gradient(color-mix(in srgb, var(--c) 35%, #1a120a), #1a120a);
  font: 600 0.8125rem var(--gh-font-body);
  text-align: left;
  cursor: pointer;
  transition: transform 120ms;
}

.r-tcard:hover {
  transform: translateY(-6px);
}

.r-tcard i {
  position: absolute;
  right: 6px;
  top: 6px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--c);
  font-style: normal;
}

.r-tcard b {
  padding-right: 26px;
  color: var(--gold-hi);
}

.r-tcard span {
  color: #d8ccb0;
  font-weight: 400;
}

.r-tcard em {
  color: var(--gold);
  font-size: 0.6875rem;
  font-style: normal;
}

.r-tcard.is-dim {
  opacity: 0.5;
}

.r-tcard.is-bin {
  border-style: dashed;
}

/* ------------------------------------------------------------ small screens */
@media (max-width: 860px) {
  .r-create-edit {
    grid-template-columns: 1fr;
  }

  .r-sheet-body,
  .r-sheet-body:has(.r-doll) {
    grid-template-columns: 1fr;
  }

  .r-skillgroups {
    grid-template-columns: 1fr 1fr;
  }

  .r-help-cols {
    grid-template-columns: 1fr;
  }

  .r-pack {
    transform-origin: left top;
  }
}

@media (max-width: 720px), (max-height: 520px) {
  .r-stage {
    --bar-h: 78px;
    font-size: 14px;
  }

  .r-party {
    bottom: 4px;
    gap: 4px;
    padding: 4px;
  }

  .r-hero {
    gap: 4px;
    padding: 2px;
  }

  .r-face {
    width: 54px;
    height: 54px;
  }

  .r-hero-info small,
  .r-hero-info em {
    display: none;
  }

  .r-bar {
    height: 10px;
  }

  .r-bar span {
    font-size: 0.5625rem;
    line-height: 10px;
  }

  .r-side {
    width: 112px;
    top: 6px;
    right: 6px;
  }

  .r-minimap {
    width: 110px;
    height: 110px;
  }

  .r-date small {
    display: none;
  }

  .r-acts {
    grid-template-columns: repeat(2, 42px);
    right: 6px;
  }

  .r-act {
    justify-content: center;
    padding: 0;
  }

  .r-act-l,
  .r-act kbd {
    display: none;
  }

  .r-tbtns {
    right: 108px;
  }

  .r-create-slots {
    grid-template-columns: 1fr 1fr;
  }

  .r-pick-grid.is-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .r-cards-table {
    grid-template-columns: 1fr;
  }

  .r-hand {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .r-log {
    max-width: 70vw;
  }

  .r-log-line {
    font-size: 0.75rem;
  }
}

@media (max-width: 560px) {
  .r-party {
    width: calc(100% - 12px);
  }

  .r-hero {
    flex-direction: column;
    align-items: center;
    gap: 3px;
  }

  .r-hero-info {
    display: grid;
    width: 100%;
    gap: 2px;
  }

  .r-hero-info strong,
  .r-hero-info small,
  .r-hero-info em {
    display: none;
  }

  .r-bar {
    height: 7px;
  }

  .r-bar span {
    display: none;
  }
}

/* Short screens (a phone held sideways): a small map, the buttons in two rows of five. */
@media (max-height: 520px) {
  .r-side {
    width: 98px;
  }

  .r-minimap {
    width: 94px;
    height: 94px;
  }

  .r-where,
  .r-date small,
  .r-buffs {
    display: none;
  }

  .r-date,
  .r-money {
    padding: 2px 4px;
    font-size: 0.6875rem;
  }

  .r-acts {
    grid-template-columns: repeat(5, 38px);
    gap: 4px;
    bottom: calc(var(--bar-h, 78px) + 6px);
  }

  .r-act {
    height: 32px;
  }

  .r-tbtns {
    right: 230px;
    bottom: calc(var(--bar-h, 78px) + 6px);
    grid-template-columns: repeat(3, 48px);
  }

  .r-tbtn {
    width: 48px;
    height: 48px;
  }

  .r-stick {
    width: 104px;
    height: 104px;
    bottom: calc(var(--bar-h, 78px) + 8px);
  }

  .r-log {
    bottom: calc(var(--bar-h, 78px) + 8px);
    max-width: 46vw;
  }

  .r-hint {
    bottom: calc(var(--bar-h, 78px) + 84px);
  }

  .r-panel-body {
    padding: 10px 12px;
  }
}

/* Narrow screens held upright: buttons in a column of pairs on the right, the map smaller. */
@media (max-width: 560px) and (min-height: 521px) {
  .r-side {
    width: 104px;
  }

  .r-minimap {
    width: 100px;
    height: 100px;
  }

  .r-where,
  .r-date small {
    display: none;
  }

  .r-tbtns {
    right: 104px;
  }
}

/* Touch screens: the menu buttons in a column on the left, the log beside them, the stick
   bottom-left and the four action buttons bottom-right (attack, quick spell, use, jump). */
.r-stage.is-touch .r-act.is-attack,
.r-stage.is-touch .r-act.is-quick,
.r-stage.is-touch .r-acts .r-act:nth-child(4) {
  display: none;
}

.r-stage.is-touch .r-acts {
  top: 8px;
  left: 8px;
  right: auto;
  bottom: auto;
  grid-template-columns: 38px;
  gap: 4px;
}

.r-stage.is-touch .r-act {
  justify-content: center;
  width: 38px;
  height: 34px;
  padding: 0;
}

.r-stage.is-touch .r-act-l,
.r-stage.is-touch .r-act kbd {
  display: none;
}

.r-stage.is-touch .r-log {
  top: 8px;
  left: 54px;
  bottom: auto;
  max-width: min(60vw, 520px, calc(100% - 180px));
}

.r-stage.is-touch .r-stick {
  left: 56px;
  bottom: calc(var(--bar-h, 118px) + 12px);
}

.r-stage.is-touch .r-tbtns {
  right: 10px;
  bottom: calc(var(--bar-h, 118px) + 12px);
  grid-template-columns: repeat(2, 54px);
}

.r-stage.is-touch .r-tbtn {
  width: 54px;
  height: 54px;
}

.r-stage.is-touch .r-tbtn.is-fly {
  width: 44px;
  height: 44px;
}

@media (max-height: 520px) {
  .r-stage.is-touch .r-acts {
    grid-template-columns: repeat(2, 38px);
  }

  .r-stage.is-touch .r-log {
    left: 96px;
  }

  .r-stage.is-touch .r-stick {
    left: 98px;
    width: 96px;
    height: 96px;
  }

  .r-stage.is-touch .r-tbtns {
    right: 112px;
    grid-template-columns: repeat(4, 48px);
  }

  .r-stage.is-touch .r-tbtn {
    width: 48px;
    height: 48px;
  }
}

.r-mhp {
  display: inline-block;
  width: 64px;
  height: 7px;
  margin-left: 8px;
  border: 1px solid rgba(0, 0, 0, 0.8);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.6);
  overflow: hidden;
  vertical-align: middle;
}

.r-mhp b {
  display: block;
  height: 100%;
  background: linear-gradient(#ff8a6a, #c0302a);
}

.r-cover {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: #0b0907;
  pointer-events: auto;
  transition: opacity 450ms ease;
}

.r-cover span {
  color: var(--gold-hi);
  font: 700 clamp(1.4rem, 4vw, 2.2rem)/1.2 var(--gh-font-display);
  letter-spacing: 0.08em;
  text-shadow: 0 0 20px rgba(255, 190, 80, 0.4);
}

.r-cover.is-out {
  opacity: 0;
}


/* ============================================================ the art pass: ornament, texture, depth
   Overrides colours, borders and shadows only (sizes stay with the rules and media queries above):
   gold filigree corners and a leather grain on every window, engraved gold titles over a rule with a
   diamond, bevelled buttons, ribbon tabs, a riveted party bar with glossy gauges, a brass compass ring
   round the map, a leather pack, wooden shelves in shops, parchment pages in the spellbook. */
.r-stage {
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.42 0 0 0 0 0.28 0 0 0 0.16 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --parchment: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='0.035' numOctaves='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.32 0 0 0 0 0.15 0 0 0 0.28 0'/></filter><rect width='100%' height='100%' filter='url(%23p)'/></svg>");
}

.r-panel {
  border: 2px solid #9a7432;
  background:
    var(--grain),
    radial-gradient(120% 70% at 50% 0%, rgba(140, 96, 44, 0.28), transparent 62%),
    radial-gradient(90% 60% at 50% 110%, rgba(0, 0, 0, 0.45), transparent 70%),
    linear-gradient(#22180f, #130d08);
  box-shadow:
    0 0 0 1px #000,
    inset 0 0 0 3px rgba(0, 0, 0, 0.45),
    inset 0 0 0 4px rgba(226, 184, 90, 0.28),
    inset 0 0 40px rgba(0, 0, 0, 0.55),
    0 28px 70px -18px rgba(0, 0, 0, 0.95);
}

.r-panel::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 3;
  pointer-events: none;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='46' height='46' viewBox='0 0 46 46'><g transform='rotate(0 23 23)'><g fill='none' stroke='%23e2b85a' stroke-linecap='round'><path d='M4 34 V10 Q4 4 10 4 H34' stroke-width='2'/><path d='M10 24 V14 Q10 10 14 10 H24' stroke-width='1.2' opacity='0.75'/><path d='M34 4 q7 0 7 6 q0 5 -5 5 q-3 0 -3 -3' stroke-width='1.5'/><path d='M4 34 q0 7 6 7 q5 0 5 -5 q0 -3 -3 -3' stroke-width='1.5'/></g><path d='M6.5 1 L12 6.5 L6.5 12 L1 6.5 Z' fill='%23ffe39a' stroke='%236a4a1a' stroke-width='0.8'/></g></svg>") top left / 42px no-repeat,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='46' height='46' viewBox='0 0 46 46'><g transform='rotate(90 23 23)'><g fill='none' stroke='%23e2b85a' stroke-linecap='round'><path d='M4 34 V10 Q4 4 10 4 H34' stroke-width='2'/><path d='M10 24 V14 Q10 10 14 10 H24' stroke-width='1.2' opacity='0.75'/><path d='M34 4 q7 0 7 6 q0 5 -5 5 q-3 0 -3 -3' stroke-width='1.5'/><path d='M4 34 q0 7 6 7 q5 0 5 -5 q0 -3 -3 -3' stroke-width='1.5'/></g><path d='M6.5 1 L12 6.5 L6.5 12 L1 6.5 Z' fill='%23ffe39a' stroke='%236a4a1a' stroke-width='0.8'/></g></svg>") top right / 42px no-repeat,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='46' height='46' viewBox='0 0 46 46'><g transform='rotate(270 23 23)'><g fill='none' stroke='%23e2b85a' stroke-linecap='round'><path d='M4 34 V10 Q4 4 10 4 H34' stroke-width='2'/><path d='M10 24 V14 Q10 10 14 10 H24' stroke-width='1.2' opacity='0.75'/><path d='M34 4 q7 0 7 6 q0 5 -5 5 q-3 0 -3 -3' stroke-width='1.5'/><path d='M4 34 q0 7 6 7 q5 0 5 -5 q0 -3 -3 -3' stroke-width='1.5'/></g><path d='M6.5 1 L12 6.5 L6.5 12 L1 6.5 Z' fill='%23ffe39a' stroke='%236a4a1a' stroke-width='0.8'/></g></svg>") bottom left / 42px no-repeat,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='46' height='46' viewBox='0 0 46 46'><g transform='rotate(180 23 23)'><g fill='none' stroke='%23e2b85a' stroke-linecap='round'><path d='M4 34 V10 Q4 4 10 4 H34' stroke-width='2'/><path d='M10 24 V14 Q10 10 14 10 H24' stroke-width='1.2' opacity='0.75'/><path d='M34 4 q7 0 7 6 q0 5 -5 5 q-3 0 -3 -3' stroke-width='1.5'/><path d='M4 34 q0 7 6 7 q5 0 5 -5 q0 -3 -3 -3' stroke-width='1.5'/></g><path d='M6.5 1 L12 6.5 L6.5 12 L1 6.5 Z' fill='%23ffe39a' stroke='%236a4a1a' stroke-width='0.8'/></g></svg>") bottom right / 42px no-repeat;
}

.r-panel-head {
  position: relative;
  padding-left: 44px;
  padding-right: 40px;
  border-bottom: 0;
  background:
    var(--grain),
    linear-gradient(rgba(110, 76, 36, 0.55), rgba(40, 28, 16, 0.2));
}

.r-panel-head::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: -6px;
  height: 12px;
  pointer-events: none;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='12' viewBox='0 0 22 12'><path d='M11 1 L16 6 L11 11 L6 6 Z' fill='%23e2b85a' stroke='%235a3a12' stroke-width='0.8'/><circle cx='2.5' cy='6' r='1.5' fill='%23e2b85a'/><circle cx='19.5' cy='6' r='1.5' fill='%23e2b85a'/></svg>") center / 22px 12px no-repeat,
    linear-gradient(90deg, transparent, rgba(226, 184, 90, 0.75) 20%, rgba(226, 184, 90, 0.75) 80%, transparent) center / 100% 1px no-repeat;
}

.r-panel-title {
  background: linear-gradient(#fff4cc, #f0c868 48%, #b07e2c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.9)) drop-shadow(0 0 8px rgba(255, 190, 80, 0.25));
}

.r-panel h3 {
  color: #f0c868;
  text-shadow: 0 1px 0 #000;
}

/* Bevelled buttons; gold ones look struck from the metal. */
.r-btn {
  border-color: #a07a34;
  background:
    linear-gradient(rgba(255, 230, 170, 0.1), transparent 45%),
    linear-gradient(#584230, #33261a 60%, #281d14);
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 170, 0.28),
    inset 0 -2px 0 rgba(0, 0, 0, 0.4),
    0 2px 0 #000,
    0 4px 8px rgba(0, 0, 0, 0.45);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.r-btn:hover:not(:disabled) {
  filter: brightness(1.15);
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 170, 0.35),
    inset 0 -2px 0 rgba(0, 0, 0, 0.4),
    0 2px 0 #000,
    0 0 12px rgba(255, 200, 100, 0.3);
}

.r-btn.is-gold {
  border-color: #ffe7a8;
  color: #2a1a06;
  background:
    linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 48%),
    linear-gradient(#ffe08a, #e2b04a 55%, #b07c26);
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -2px 0 rgba(120, 70, 10, 0.5),
    0 2px 0 #3a2208,
    0 4px 10px rgba(0, 0, 0, 0.5),
    0 0 16px rgba(255, 200, 90, 0.25);
}

.r-btn.is-quiet {
  background: linear-gradient(rgba(60, 44, 30, 0.6), rgba(30, 22, 15, 0.6));
}

/* Tabs like ribbons. */
.r-tabs {
  border-bottom: 1px solid rgba(226, 184, 90, 0.5);
}

.r-tab {
  background: linear-gradient(rgba(60, 44, 28, 0.45), rgba(30, 22, 14, 0.2));
  border-color: rgba(226, 184, 90, 0.18);
}

.r-tab.is-on {
  color: #fff0c4;
  border-color: rgba(226, 184, 90, 0.6);
  background:
    linear-gradient(#e2b85a, #e2b85a) top / 100% 2px no-repeat,
    linear-gradient(rgba(150, 104, 48, 0.55), rgba(70, 50, 28, 0.35));
  text-shadow: 0 1px 0 #000;
}

/* The party bar: carved wood, brass rivets at the corners. */
.r-party {
  border-color: #9a7432;
  background:
    var(--grain),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 9px),
    linear-gradient(#433122, #2a1e14 55%, #1e150d);
  box-shadow:
    0 0 0 1px #000,
    inset 0 0 0 3px rgba(0, 0, 0, 0.35),
    inset 0 0 0 4px rgba(226, 184, 90, 0.22),
    inset 0 1px 0 rgba(255, 220, 150, 0.2),
    0 10px 28px rgba(0, 0, 0, 0.75);
}

.r-party::before {
  content: "";
  position: absolute;
  inset: 5px;
  pointer-events: none;
  background:
    radial-gradient(circle at 5px 5px, #ffe39a 0 2px, #8a6424 2.6px, transparent 3.6px) top left / 10px 10px no-repeat,
    radial-gradient(circle at 5px 5px, #ffe39a 0 2px, #8a6424 2.6px, transparent 3.6px) top right / 10px 10px no-repeat,
    radial-gradient(circle at 5px 5px, #ffe39a 0 2px, #8a6424 2.6px, transparent 3.6px) bottom left / 10px 10px no-repeat,
    radial-gradient(circle at 5px 5px, #ffe39a 0 2px, #8a6424 2.6px, transparent 3.6px) bottom right / 10px 10px no-repeat;
}

.r-face {
  border-color: #c89a48;
  box-shadow: 0 0 0 1px #000, inset 0 0 10px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.6);
}

.r-hero.is-active .r-face {
  border-color: #ffe39a;
  box-shadow: 0 0 0 1px #000, 0 0 12px rgba(255, 210, 110, 0.6);
}

/* Glossy gauges in a dark inset. */
.r-bar {
  border-color: #000;
  background: linear-gradient(#0a0806, #241a12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 220, 150, 0.12);
}

.r-bar i {
  background: linear-gradient(rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 55%), linear-gradient(#9af49a, #2e9a42);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.r-bar i.is-mid {
  background: linear-gradient(rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 55%), linear-gradient(#ffe680, #c8941a);
}

.r-bar i.is-low {
  background: linear-gradient(rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 55%), linear-gradient(#ff9a7a, #b8281e);
}

.r-bar.is-sp i {
  background: linear-gradient(rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 55%), linear-gradient(#9acaff, #2462c8);
}

/* Action buttons: dark stone with a gold edge. */
.r-act {
  border-color: #8a6a30;
  background:
    linear-gradient(rgba(255, 230, 170, 0.1), transparent 45%),
    linear-gradient(rgba(74, 56, 38, 0.95), rgba(30, 22, 15, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 230, 170, 0.22), inset 0 -2px 0 rgba(0, 0, 0, 0.4), 0 2px 0 #000, 0 3px 8px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 0 #000;
}

/* The map in a brass compass ring. */
.r-minimap {
  border: 4px solid #b88a3a;
  box-shadow:
    0 0 0 2px #2a1a08,
    0 0 0 4px #e2b85a,
    0 0 0 6px #1a1006,
    inset 0 0 22px rgba(0, 0, 0, 0.85),
    0 8px 20px rgba(0, 0, 0, 0.7);
}

.r-minimap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: repeating-conic-gradient(rgba(255, 227, 154, 0.75) 0deg 1.4deg, transparent 1.4deg 15deg);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  mask: radial-gradient(closest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
}

/* The pack: dark tooled leather with stitched cells. */
.r-pack {
  border: 2px solid #8a6424;
  background-color: #1e140c;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.55) 1px, transparent 1px),
    linear-gradient(rgba(226, 184, 90, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 184, 90, 0.1) 1px, transparent 1px),
    var(--grain),
    radial-gradient(120% 120% at 50% 40%, #3a2818, #1a110a);
  background-size: 30px 30px, 30px 30px, 30px 30px, 30px 30px, auto, auto;
  background-position: 0 0, 0 0, 0 1px, 1px 0, 0 0, 0 0;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.8), 0 0 0 1px #000;
}

.r-item.in-pack:hover {
  filter: brightness(1.2) drop-shadow(0 0 6px rgba(255, 220, 140, 0.55));
}

.r-slot-box {
  border-color: rgba(226, 184, 90, 0.35);
  background:
    var(--grain),
    radial-gradient(100% 100% at 50% 30%, rgba(70, 50, 30, 0.6), rgba(10, 7, 4, 0.8));
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}

/* Shop wares stand on little wooden shelves against a planked wall. */
.r-shelf {
  position: relative;
  z-index: 0;
  border-color: #6a4a22;
  background:
    var(--grain),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.35) 0 2px, transparent 2px 64px),
    repeating-linear-gradient(90deg, rgba(255, 220, 160, 0.04) 0 1px, transparent 1px 7px),
    linear-gradient(#3a2818, #24180e);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.75);
}

.r-shelf-item {
  position: relative;
  padding: 6px 6px 12px;
}

.r-shelf-item::after {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  bottom: 22px;
  height: 7px;
  z-index: -1;
  border-radius: 2px;
  background: linear-gradient(#a67c48, #6a4626 60%, #3a2412);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.6);
}

.r-shelf-item span {
  text-shadow: 0 1px 0 #000;
}

/* The spellbook: parchment pages with a fold down the middle, brown ink. */
.r-spells {
  padding: 14px;
  border: 1px solid #8a6a3a;
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent calc(50% - 14px), rgba(90, 60, 20, 0.28) 50%, transparent calc(50% + 14px)),
    var(--parchment),
    radial-gradient(140% 120% at 50% 50%, #f4e6c4 40%, #d8c095);
  box-shadow: inset 0 0 30px rgba(110, 70, 20, 0.45), 0 0 0 1px #000, 0 6px 16px rgba(0, 0, 0, 0.6);
}

.r-spell {
  color: #3a2410;
  border-color: rgba(120, 80, 30, 0.28);
  background: radial-gradient(circle at 50% 32%, color-mix(in srgb, var(--school) 30%, transparent), rgba(255, 245, 220, 0.35));
  text-shadow: none;
}

.r-spell.is-on {
  border-color: #8a5a12;
  box-shadow: 0 0 0 2px rgba(255, 200, 90, 0.5), 0 0 10px rgba(255, 190, 80, 0.5);
}

.r-spell.is-unknown {
  opacity: 0.5;
  color: #6a4a2a;
}

.r-spell small {
  color: #2a4a8a;
}

.r-spell.is-quick::after {
  color: #8a2a12;
}

/* The title: struck gold letters that catch the light. */
.r-panel.r-title {
  background:
    var(--grain),
    radial-gradient(120% 90% at 50% 0%, rgba(96, 62, 26, 0.82), rgba(10, 7, 4, 0.9));
}

.r-title-name {
  background: linear-gradient(100deg, #b07e2c 0%, #ffe9a8 30%, #fff8dc 38%, #f0c868 46%, #b07e2c 70%, #f0c868 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 3px 0 #2a1604) drop-shadow(0 0 18px rgba(255, 190, 80, 0.45));
  animation: r-shine 7s ease-in-out infinite;
}

@keyframes r-shine {
  0%, 100% { background-position: 100% 0; }
  50% { background-position: 0% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .r-title-name { animation: none; }
}

.r-title-kicker {
  color: #f0c868;
  text-shadow: 0 1px 0 #000;
}

/* The plaques under the map: dark wood with a brass edge; the place name on a gold-lettered banner. */
.r-where,
.r-date,
.r-money {
  border: 1px solid rgba(184, 138, 58, 0.7);
  background:
    var(--grain),
    linear-gradient(rgba(58, 42, 26, 0.92), rgba(22, 16, 10, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 220, 150, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.7), 0 3px 8px rgba(0, 0, 0, 0.5);
}

.r-where {
  border-color: #c89a48;
  background:
    linear-gradient(90deg, transparent, rgba(255, 210, 120, 0.12), transparent),
    var(--grain),
    linear-gradient(#5a3e22, #2a1c10);
  letter-spacing: 0.08em;
}

.r-buffs i {
  background: radial-gradient(circle at 40% 35%, rgba(255, 255, 255, 0.18), rgba(14, 10, 6, 0.9) 60%);
}

/* The item card: a small framed note in the same leather and gold. */
.r-card {
  border: 1px solid #b88a3a;
  background:
    var(--grain),
    linear-gradient(rgba(120, 84, 40, 0.22), transparent 40%),
    linear-gradient(#20170f, #120c07);
  box-shadow: 0 0 0 1px #000, inset 0 0 0 2px rgba(0, 0, 0, 0.4), inset 0 0 0 3px rgba(226, 184, 90, 0.2), 0 12px 32px rgba(0, 0, 0, 0.75);
}

.r-card strong {
  text-shadow: 0 1px 0 #000;
}
