/* Two visual layers from the design document: the organic world (parchment,
   bark, moss, Alegreya) and the cold System (ice-blue panels, sharp edges,
   Chakra Petch). Mobile first, designed at about 390 px wide. */

/* The game's two typefaces, kept with the game rather than fetched from
   Google Fonts, so that opening the game sends nothing to Google: Alegreya
   for the world, Chakra Petch for the System (SIL Open Font License, the
   licences are in fonts/). Latin and Latin Extended cover Polish. */
@font-face {
  font-family: 'Alegreya';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/alegreya-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Alegreya';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/alegreya-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Alegreya';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/alegreya-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Alegreya';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/alegreya-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/chakra-petch-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/chakra-petch-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/chakra-petch-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/chakra-petch-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/chakra-petch-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/chakra-petch-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --bg: #12170f;
  --bg-deep: #0d110b;
  --surface: #182014;
  --line: #2a3322;
  --bark: #2b2219;
  --bark-line: #4a3d2c;
  --text: #e7dcc2;
  --text-muted: #b9ae94;
  --leaf: #a7c47f;
  --danger: #ef9a85;
  --system: #8fe3ef;
  --system-text: #d6f6fa;
  --system-line: rgba(143, 227, 239, 0.55);
  --system-fill: rgba(143, 227, 239, 0.07);
  --bark-active: #3a2e22;
  --accent: #c9a14a;
  --gold: #d9b45a;
  /* Punkty Czasu: the amber of an hourglass's sand. */
  --time: #e39b5b;
  --hp: #c8553d;
  --hp-track: #2a1c17;
  --mana: #4f8fc0;
  --mana-track: #172231;
  --xp: #d9b45a;
  --xp-track: #2a2414;
  --class-xp: #a986e8;
  --class-xp-track: #241c33;
  --icon-muted: #6f6656;
  --src-class: #7d9a5a;
  --src-character: #e7dcc2;
  --src-professions: #c9a14a;
  --src-equipment: #5f86b0;
  --src-core: #8fe3ef;
  --nav-height: 68px;
  --font-world: 'Alegreya', Georgia, serif;
  --font-system: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --gutter: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 70% at 50% 0%, rgba(143, 227, 239, 0.05), transparent 60%),
    repeating-linear-gradient(125deg, transparent 0 6px, rgba(37, 48, 31, 0.45) 6px 7px);
  color: var(--text);
  font-family: var(--font-world);
  font-size: 17px;
  line-height: 1.45;
}

[hidden] {
  display: none !important;
}

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

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

.screen {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) var(--gutter) max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.screen--center {
  min-height: 100vh;
  min-height: 100dvh;
  justify-content: center;
}

/* World layer */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 20px;
  text-align: center;
}

.emblem {
  width: 52px;
  height: 52px;
  color: var(--system);
}

.hero-title {
  margin: 8px 0 0;
  font-size: 44px;
  font-weight: 700;
  line-height: 1.05;
}

.hero-tagline {
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
}

.page-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* A report: the title on the left, a large "Powrót" on the right. */
.page-heading--back {
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.page-heading-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* After .button in specificity, so the button keeps its own width. */
.page-heading--back .back-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  width: auto;
  min-height: 52px;
  padding: 0 18px 0 12px;
  font-size: 16px;
  text-decoration: none;
}

.page-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
}

.page-title:focus {
  outline: none;
}

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

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.card-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.status-list {
  margin: 0;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.status-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.status-row dt {
  color: var(--text-muted);
  font-size: 15px;
}

.status-row dd {
  margin: 0;
  font-family: var(--font-system);
  font-size: 15px;
  font-weight: 600;
  text-align: right;
}

.status-ok {
  color: var(--leaf);
}

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

/* System layer */

.system-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--system-line);
  /* Ice-blue tint over a mostly opaque base, so the forest hatch stays faint. */
  background: linear-gradient(var(--system-fill), var(--system-fill)), rgba(18, 23, 15, 0.85);
  font-family: var(--font-system);
}

.system-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.system-label {
  margin: 0;
  color: var(--system);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.system-text {
  margin: 0;
  color: var(--system-text);
  font-size: 15px;
  line-height: 1.4;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--system-line);
}

.segmented-option {
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.segmented-option + .segmented-option {
  border-left: 1px solid var(--system-line);
}

.segmented-option[aria-pressed='true'] {
  background: rgba(143, 227, 239, 0.14);
  color: var(--system-text);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field--switch .toggle {
  align-self: flex-start;
}

.field label,
.field-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.optional {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--bark-line);
  border-radius: 0;
  background: var(--bg-deep);
  color: var(--text);
  /* 16 px keeps iOS from zooming in on focus. */
  font-family: var(--font-system);
  font-size: 16px;
}

.field input:focus {
  outline: none;
  border-color: var(--system);
  box-shadow: 0 0 0 1px var(--system);
}

.field-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.35;
}

.password {
  position: relative;
}

.password input {
  padding-right: 80px;
}

.password-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  min-width: 68px;
  padding: 0 10px;
  border: 0;
  border-left: 1px solid var(--bark-line);
  background: transparent;
  color: var(--system);
  font-family: var(--font-system);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(239, 154, 133, 0.6);
  background: rgba(239, 154, 133, 0.08);
  color: var(--danger);
  font-family: var(--font-system);
  font-size: 14px;
  line-height: 1.4;
}

.button {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 0;
  font-family: var(--font-system);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.button--system {
  border: 1px solid var(--system);
  background: rgba(143, 227, 239, 0.16);
  color: var(--system-text);
}

.button--system:active:not(:disabled) {
  background: rgba(143, 227, 239, 0.26);
}

.button--world {
  border: 1px solid var(--bark-line);
  border-radius: 4px;
  background: var(--bark);
  color: var(--text);
  font-family: var(--font-world);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.button--world:active:not(:disabled) {
  background: #3a2e22;
}

.badge {
  padding: 5px 8px;
  border: 1px solid;
  font-family: var(--font-system);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.badge--system {
  border-color: var(--system-line);
  color: var(--system);
  text-transform: uppercase;
}

.badge--world {
  max-width: 60%;
  overflow: hidden;
  border-color: var(--bark-line);
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: center;
}

/* Game frame: top bar, screen and the two bottom bars */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) var(--gutter) 10px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line);
}

.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

/* The character and class level, one over the other, so gold and Punkty
   Systemu fit beside them on a phone. */
.topbar-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.topbar-badges .badge {
  max-width: 100%;
  padding: 2px 6px;
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
}

.topbar-badges .badge--world {
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* The gold is a button: it opens the camp's resources under it. */
.gold {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--gold);
  font-family: var(--font-system);
  font-size: 14px;
  font-weight: 600;
}

.gold[aria-expanded='true'] {
  background: var(--bark-active);
}

/* Punkty Systemu next to the gold, in the System's colours. */
.points {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  color: var(--system);
}

/* Narrow phones: a little tighter, so the level badges keep their room. */
@media (max-width: 374px) {
  .gold {
    font-size: 13px;
  }

  .camp-button {
    min-width: 42px;
  }
}

.wallet-list {
  position: absolute;
  top: calc(max(8px, env(safe-area-inset-top)) + 48px);
  right: var(--gutter);
  z-index: 30;
  min-width: 210px;
  margin: 0;
  padding: 4px 12px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--bark-line);
  border-radius: 4px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.wallet-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 14px;
}

.wallet-item + .wallet-item {
  border-top: 1px solid var(--line);
}

.wallet-name {
  flex: 1;
  color: var(--text);
}

.wallet-amount {
  color: var(--gold);
  font-weight: 600;
}

/* The camp in the top right corner, with the time left of an upgrade. */
.camp-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 48px;
  height: 44px;
  padding: 0 4px;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 10px;
  letter-spacing: 0.06em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
}

.camp-button--busy {
  color: var(--system);
}

/* In the camp the tent is lit like the current tab of the bottom bar. */
.camp-button[aria-current='page'] {
  background: rgba(143, 227, 239, 0.08);
  box-shadow: inset 0 -2px 0 var(--system);
  color: var(--system-text);
  font-weight: 700;
}

/* A full store waits in the camp: a gold dot on the tent. */
.camp-button--ready {
  position: relative;
  color: var(--gold);
}

.camp-button--ready::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--bg-deep);
}

/* Each currency in its own color: gold, the System's blue and amber time. */
.wallet-item--gold .wallet-name,
.wallet-item--gold svg {
  color: var(--gold);
}

.wallet-item--system .wallet-name,
.wallet-item--system .wallet-amount,
.wallet-item--system svg {
  color: var(--system);
}

.wallet-item--time .wallet-name,
.wallet-item--time .wallet-amount,
.wallet-item--time svg {
  color: var(--time);
}

/* The materials under the currencies. */
.wallet-item + .wallet-item--materials {
  border-top-color: var(--bark-line);
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
}

.meters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.meter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.meter-value {
  color: var(--text);
}

.meter-track,
.meter-fill {
  height: 6px;
}

.meter-fill {
  transition: width 0.4s ease;
}

.meter--hp .meter-track {
  background: var(--hp-track);
}

.meter--hp .meter-fill {
  background: var(--hp);
}

.meter--mana .meter-track {
  background: var(--mana-track);
}

.meter--mana .meter-fill {
  background: var(--mana);
}

.meter--xp .meter-track {
  background: var(--xp-track);
}

.meter--xp .meter-fill {
  background: var(--xp);
}

.meter--class-xp .meter-track {
  background: var(--class-xp-track);
}

.meter--class-xp .meter-fill {
  background: var(--class-xp);
}

.meter-label {
  white-space: nowrap;
}

.meter-value {
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--system-line);
  background: var(--system-fill);
  font-family: var(--font-system);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.activity-label {
  overflow: hidden;
  color: var(--system-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-time {
  flex-shrink: 0;
  color: var(--system);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.activity--done {
  border-color: var(--system);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    background: rgba(143, 227, 239, 0.18);
  }
}

.screen--game {
  padding-top: 16px;
  padding-bottom: calc(var(--nav-height) + 28px + env(safe-area-inset-bottom));
  gap: 16px;
}

.screen-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.screen--game:has(.pending-bar) {
  padding-bottom: calc(var(--nav-height) + 96px + env(safe-area-inset-bottom));
}

/* The narrator's camera (camera.js) zooms the screen from its top left
   corner; meanwhile the page around it keeps its size and does not scroll
   sideways. */
.screen--game {
  transform-origin: 0 0;
}

.filming {
  overflow: clip;
}

.nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid;
}

.nav--main {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--bg-deep);
  border-top-color: var(--line);
}

/* The character bar has its own bark background, as in the mockup. */
.nav--character {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--bark);
  border-top-color: var(--bark-line);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-world);
  font-size: 13px;
  line-height: 1.1;
  text-decoration: none;
}

.nav-icon {
  position: relative;
  display: flex;
  color: var(--text);
}

.nav-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-lock {
  position: absolute;
  top: -4px;
  right: -9px;
  color: var(--text-muted);
}

.nav-hint {
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.nav-item--locked .nav-icon,
.nav-item--locked .nav-label {
  opacity: 0.55;
}

.nav-item--system .nav-icon {
  color: var(--system);
}

.nav--main .nav-item[aria-current='page'] {
  background: rgba(143, 227, 239, 0.08);
  box-shadow: inset 0 2px 0 var(--system);
  color: var(--system-text);
  font-weight: 700;
}

.nav--character .nav-item[aria-current='page'] {
  background: var(--bark-active);
  box-shadow: inset 0 2px 0 var(--accent);
  color: var(--text);
  font-weight: 700;
}

/* Common pieces */

a.button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.button--small {
  width: auto;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 12px;
}

.button--world.button--small {
  font-size: 15px;
}

.button--danger {
  border: 1px solid rgba(239, 154, 133, 0.7);
  background: rgba(239, 154, 133, 0.12);
  color: var(--danger);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.section-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.section-title--art {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title--art .sprite {
  width: 28px;
  height: 28px;
}

.section-count {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 400;
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge--tall {
  padding: 6px 10px;
  background: var(--system-fill);
}

.badge--gentle {
  border-color: rgba(167, 196, 127, 0.6);
  color: var(--leaf);
  font-size: 11px;
}

.badge--hard {
  border-color: rgba(239, 154, 133, 0.6);
  color: var(--danger);
  font-size: 11px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--bark-line);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.chip--dashed {
  border-style: dashed;
  color: var(--text-muted);
}

.chip--safe,
.chip--success {
  border-color: rgba(167, 196, 127, 0.6);
  color: var(--leaf);
}

.chip--fainted {
  border-color: rgba(239, 154, 133, 0.6);
  color: var(--danger);
}

.chip--escaped {
  border-color: rgba(217, 180, 90, 0.6);
  color: var(--gold);
}

.lock-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: none;
}

.segmented--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

a.segmented-option {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.segmented-option[aria-current='page'] {
  background: rgba(143, 227, 239, 0.14);
  color: var(--system-text);
}

.segmented-option:disabled {
  cursor: default;
  opacity: 0.6;
}

.bar {
  height: 6px;
  background: var(--line);
}

.bar-fill {
  height: 6px;
  background: var(--text);
  transition: width 0.4s ease;
}

.bar-fill--class {
  background: var(--src-class);
}

.bar--system {
  background: rgba(143, 227, 239, 0.15);
}

.bar-fill--system {
  background: var(--system);
  transition: width 1s linear;
}

.system-hint {
  margin: 0;
  color: rgba(214, 246, 250, 0.75);
  font-size: 13px;
  line-height: 1.4;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: var(--gutter);
  bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  left: var(--gutter);
  z-index: 50;
  max-width: 408px;
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid var(--system-line);
  background: rgba(13, 17, 11, 0.97);
  color: var(--system-text);
  font-family: var(--font-system);
  font-size: 14px;
  line-height: 1.4;
}

/* Bottom sheet */

.sheet {
  position: fixed;
  inset: auto 0 0;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  max-height: 85dvh;
  margin: 0 auto;
  padding: 0;
  overflow: auto;
  border: 0;
  border-top: 1px solid var(--bark-line);
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  color: var(--text);
}

.sheet::backdrop {
  background: rgba(5, 8, 4, 0.72);
}

.sheet-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom));
}

.sheet-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
}

.sheet-title {
  margin: 0;
  padding-right: 44px;
  font-size: 22px;
  font-weight: 700;
}

.sheet-text {
  margin: 0;
}

/* "Zainstaluj jako aplikację" (install.js) */

#install-slot:empty {
  display: none;
}

.install-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.install-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.install-button svg {
  flex: none;
  color: var(--system);
}

.install-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.install-steps {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  line-height: 1.4;
}

.install-warning {
  color: var(--gold);
}

.install-note {
  color: var(--text-muted);
  font-size: 14px;
}

/* Google sign-in, after Google's rules for its button on a dark page: the
   four-colour G on a near-black fill, a grey edge and light grey text. */
.google-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid #8e918f;
  border-radius: 4px;
  background: #131314;
  color: #e3e3e3;
  font-family: Roboto, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.google-button:active {
  background: #2a2a2c;
}

.google-button--small {
  width: auto;
  min-height: 40px;
  padding: 8px 12px;
  gap: 8px;
  font-size: 14px;
}

.google-logo {
  flex: none;
  width: 20px;
  height: 20px;
}

.google-button--small .google-logo {
  width: 18px;
  height: 18px;
}

.google-hint {
  margin: 0;
  color: var(--gold);
  font-size: 13px;
  line-height: 1.35;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--line);
}

.status-row--google {
  align-items: center;
}

.sheet-actions {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 10px;
}

/* Character creation */

.hero--small {
  padding-top: 8px;
}

.hero--small .hero-title {
  font-size: 34px;
}

.class-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.class-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.class-card[aria-checked='true'] {
  border-color: var(--system);
  background: linear-gradient(var(--system-fill), var(--system-fill)), var(--surface);
  box-shadow: inset 0 0 0 1px var(--system);
}

.class-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.class-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border: 1px solid var(--bark-line);
  border-radius: 4px;
  color: var(--text);
}

.class-icon .class-art {
  display: block;
  width: 100%;
  height: 100%;
}

.class-name {
  font-size: 20px;
  font-weight: 700;
}

.class-meta {
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.class-description {
  font-size: 15px;
  line-height: 1.4;
}

/* Character screen */

.portrait-wrap {
  display: flex;
  justify-content: center;
}

.portrait {
  position: relative;
  width: 100%;
  max-width: 336px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--bark-line);
  border-radius: 4px;
  background: #1a2316;
}

.portrait-art {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  transition: opacity 0.25s;
}

.portrait--bare .portrait-art {
  opacity: 1;
}

.portrait--bare .slots {
  display: none;
}

.portrait-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.slots {
  position: absolute;
  top: 18%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slots--left {
  left: 10px;
}

.slots--right {
  right: 10px;
}

.slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1.5px solid var(--rarity, var(--bark-line));
  border-radius: 6px;
  background: rgba(13, 17, 11, 0.85);
  color: var(--text);
}

.slot--empty {
  border-style: dashed;
  border-color: var(--bark-line);
  background: rgba(13, 17, 11, 0.6);
  color: var(--icon-muted);
}

.slot--core {
  border-color: var(--system);
  border-radius: 0;
  background: rgba(18, 40, 44, 0.85);
  color: var(--system);
}

.slot--locked {
  border-style: dashed;
  opacity: 0.55;
}

/* An item's sprite sits on a glow in its rarity colour. */
.slot:not(.slot--empty, .slot--core) {
  background:
    radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--rarity, transparent) 24%, transparent), transparent 70%),
    rgba(13, 17, 11, 0.85);
}

.slot .sprite--item {
  width: 40px;
  height: 40px;
}

/* The number in the corner is the upgrade level (from the upgrades stage on). */
.slot-level {
  position: absolute;
  right: -5px;
  bottom: -5px;
  padding: 0 3px;
  border: 1px solid var(--bark-line);
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-system);
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
}

.eye-toggle {
  position: absolute;
  top: 10px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  transform: translateX(-50%);
  border: 1px solid var(--bark-line);
  border-radius: 22px;
  background: rgba(13, 17, 11, 0.85);
  color: var(--text);
}

.bag {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 48px);
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Items */

/* Pixel-art sprites (src/client/art.js) keep their pixels sharp. */
.sprite {
  display: block;
  image-rendering: pixelated;
}

.item-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-title {
  margin: 0;
  padding-right: 44px;
  color: var(--rarity, var(--text));
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.item-details--small .item-title {
  padding-right: 0;
  font-size: 17px;
}

.item-meta {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.item-properties {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  font-family: var(--font-system);
  font-size: 14px;
  list-style: none;
}

.compare {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.compare-title {
  margin: 0;
  color: var(--system);
  font-family: var(--font-system);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* The Kowadło part of the item card. */
.anvil-step,
.anvil-chance {
  margin: 0;
  color: var(--text);
  font-family: var(--font-system);
  font-size: 14px;
}

.anvil-step {
  font-weight: 600;
}

.anvil .preview-list li {
  color: var(--leaf);
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-deep);
  color: var(--text-muted);
  text-align: left;
}

.item-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.item-name {
  color: var(--rarity, var(--text));
  font-weight: 700;
}

.item-summary-art {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.item-summary-art .sprite {
  flex: none;
  width: 32px;
  height: 32px;
}

/* The item card: the sprite large, on a frame in the rarity colour. */
.item-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 44px;
}

.item-head .item-title {
  padding-right: 0;
}

.item-art {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border: 1.5px solid var(--rarity, var(--bark-line));
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--rarity, transparent) 26%, transparent), transparent 70%),
    var(--bg-deep);
}

.item-art .sprite {
  width: 64px;
  height: 64px;
}

/* Stats screen */

.levels {
  gap: 14px;
}

.level-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.level-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 16px;
}

.num {
  font-family: var(--font-system);
  font-weight: 600;
}

.level-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 8px;
  color: var(--system);
  font-family: var(--font-system);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.level-note span:last-child {
  color: var(--text-muted);
}

.level-professions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}

.stat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: -6px;
  color: var(--text-muted);
  font-size: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.swatch {
  display: block;
  width: 10px;
  height: 10px;
}

.swatch--class,
.segment--class {
  background: var(--src-class);
}

.swatch--character,
.segment--character {
  background: var(--src-character);
}

.swatch--professions,
.segment--professions {
  background: var(--src-professions);
}

.swatch--equipment,
.segment--equipment {
  background: var(--src-equipment);
}

.swatch--core,
.segment--core {
  background: var(--src-core);
}

.stat-list {
  display: flex;
  flex-direction: column;
}

.stat-row {
  border-bottom: 1px solid var(--line);
}

.stat-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.stat-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
}

.stat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.stat-name {
  font-size: 17px;
}

.stat-total {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-system);
  font-size: 17px;
  font-weight: 600;
}

.stat-extra {
  color: var(--system);
  font-size: 12px;
}

.stat-effect {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.3;
}

.source-bar {
  display: flex;
  width: 100%;
  height: 6px;
  background: #1d2519;
}

.segment {
  display: block;
  height: 6px;
}

.stat-add,
.stat-add-space {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
}

.stat-add {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--system-line);
  background: var(--system-fill);
  color: var(--system);
}

.stat-detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--system-line);
  background: var(--system-fill);
  color: var(--system-text);
  font-family: var(--font-system);
  font-size: 13px;
}

.stat-detail-title {
  margin: 0;
  color: var(--system);
}

.stat-detail-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stat-detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.stat-detail-sources {
  margin: 0;
  color: rgba(214, 246, 250, 0.7);
  font-size: 12px;
}

.combat-values {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.value-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.value-label,
.value-note {
  color: var(--text-muted);
  font-size: 13px;
}

.value-note {
  font-size: 12px;
}

.value-number {
  font-family: var(--font-system);
  font-size: 17px;
  font-weight: 600;
}

.pending-bar {
  position: fixed;
  right: 0;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
  left: 0;
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px var(--gutter);
  border-top: 1px solid var(--system-line);
  background: rgba(13, 17, 11, 0.97);
}

.pending-text {
  flex: 1;
  color: var(--system-text);
  font-family: var(--font-system);
  font-size: 13px;
}

/* Walka: hunts */

.region-card {
  gap: 10px;
}

.region-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.region-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.region-description {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  font-style: italic;
}

.region-trait,
.region-warning {
  margin: 0;
  font-size: 15px;
}

.region-warning {
  color: var(--gold);
}

/* A region on the main Walka view opens its inner regions. */
.region-link {
  color: inherit;
  text-decoration: none;
}

.region-link:active {
  background: var(--bark-active);
}

.region-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.region-foot > svg {
  flex: none;
  color: var(--accent);
}

/* Inner regions as circles with a picture of the place, two in a row and
   the odd last one in the middle. */
.area-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 12px;
  padding-top: 4px;
}

.area-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  color: var(--text);
  text-align: center;
  text-decoration: none;
}

.area-tile:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.area-circle {
  position: relative;
  display: block;
  width: min(136px, 38vw);
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg-deep);
  box-shadow: 0 0 0 4px rgba(13, 17, 11, 0.7), 0 6px 18px rgba(0, 0, 0, 0.45);
}

.area-tile:active .area-circle {
  box-shadow: 0 0 0 4px var(--system-line);
}

.area-art {
  display: block;
  width: 100%;
  height: 100%;
}

.area-tile-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.area-tile--locked {
  color: var(--text-muted);
}

.area-tile--locked .area-circle {
  border-color: var(--bark-line);
}

.area-tile--locked .area-art {
  filter: grayscale(1) brightness(0.45);
}

.area-lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text);
}

.area-levels {
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* The chosen inner region: its picture above the length and the start. */
.area-card {
  gap: 10px;
}

.area-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 0 2px;
}

.area-circle--large {
  width: min(176px, 48vw);
}


/* Hunt length: a slider in 5-minute steps with a button for one step on each side. */
.duration-picker {
  display: grid;
  gap: 6px;
}

.duration-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  font-family: var(--font-system);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.duration-title {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}

/* The length's name: "bardzo krótka", "średnia"… */
.duration-kind {
  color: var(--system);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.duration-value {
  color: var(--system-text);
  font-size: 20px;
  font-weight: 700;
}

.duration-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

.duration-step {
  min-height: 48px;
  padding: 0;
  font-family: var(--font-system);
  font-size: 24px;
  line-height: 1;
}

.duration-step:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.duration-slider {
  --fill: 0%;
  width: 100%;
  height: 48px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.duration-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--system) var(--fill), var(--bark-line) var(--fill));
}

.duration-slider::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
  margin-top: -11px;
  border: 2px solid var(--system);
  border-radius: 50%;
  background: var(--bg-deep);
  box-shadow: 0 0 10px rgba(143, 227, 239, 0.45);
  -webkit-appearance: none;
  appearance: none;
}

.duration-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--bark-line);
}

.duration-slider::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--system);
}

.duration-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 2px solid var(--system);
  border-radius: 50%;
  background: var(--bg-deep);
  box-shadow: 0 0 10px rgba(143, 227, 239, 0.45);
}

.duration-slider:focus-visible {
  outline: 2px solid var(--system);
  outline-offset: 2px;
}

.duration-scale {
  display: flex;
  justify-content: space-between;
  margin: 0 58px;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 12px;
}

.duration-lock {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* Test mode: a tool to skip the waiting, set apart from the game's own buttons. */
.test-tools {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--gold);
}

.test-tools-text {
  margin: 0;
  color: var(--gold);
  font-family: var(--font-system);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.button--test {
  border: 1px dashed var(--gold);
  background: rgba(224, 160, 60, 0.12);
  color: var(--gold);
}

/* The scrapper: one button per rarity, with what it would sell. */
.scrap-options {
  display: grid;
  gap: 8px;
}

.scrap-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.scrap-option:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.scrap-detail {
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 13px;
}

.chip--tough {
  border-color: var(--system-line);
  color: var(--system);
}

.item-classes,
.item-price {
  color: var(--text-muted);
}

.threat-note {
  margin: 0;
  font-size: 14px;
}

/* "Przewiń" for resting, above the exploration it is not part of. */
.rest-skip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-deep);
}

.rest-skip[hidden] {
  display: none;
}

.rest-skip-text {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 14px;
}

.rest-skip .button--time {
  width: auto;
  flex: none;
}

.threat {
  margin: 0;
  font-family: var(--font-system);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.threat--low strong {
  color: var(--leaf);
}

.threat--moderate strong {
  color: var(--gold);
}

.threat--high strong {
  color: #e69a5c;
}

.threat--very-high strong {
  color: var(--danger);
}

.countdown {
  margin: 6px 0 2px;
  color: var(--system-text);
  font-family: var(--font-system);
  font-size: 40px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}

/* Report */

.report-summary {
  gap: 4px;
}

.result {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.result--success {
  color: var(--leaf);
}

.result--fainted {
  color: var(--danger);
}

.result--escaped {
  color: var(--gold);
}

.report-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.arena-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.arena {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 10px 8px;
  border: 1px solid var(--bark-line);
  border-radius: 4px;
  background: #141b11;
}

.arena-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.arena-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 92px;
  padding: 18px 3px 3px;
  border: 1px dashed rgba(74, 61, 44, 0.7);
}

.arena-field-label {
  position: absolute;
  top: 3px;
  right: 0;
  left: 0;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.unit {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 6px 6px 5px;
  border: 1px solid var(--bark-line);
  border-radius: 4px;
  background: rgba(13, 17, 11, 0.9);
}

.unit--elite {
  border-color: #e0a03c;
}

.unit-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

.unit-icon {
  display: flex;
  color: var(--text);
}

/* The class bust or the monster's sprite, with the level in its corner. */
.unit-art {
  position: relative;
  display: flex;
  justify-content: center;
}

.unit-art .sprite--monster,
.unit-art .class-art {
  display: block;
  width: 100%;
  max-width: 72px;
  height: auto;
  aspect-ratio: 1;
}

.unit-art .class-art {
  border-radius: 4px;
}

.unit-art .unit-level {
  position: absolute;
  top: 0;
  right: 0;
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(13, 17, 11, 0.85);
}

.unit-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.unit-level,
.unit-hp-text {
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 10px;
}

.unit-hp {
  height: 5px;
  margin-top: 2px;
  background: var(--hp-track);
}

.unit-hp-fill {
  height: 5px;
  background: var(--hp);
  transition: width 0.35s ease;
}

.unit--ally .unit-hp-fill {
  background: var(--leaf);
}

.unit-hp-text {
  text-align: right;
}

.unit-status {
  overflow: hidden;
  color: var(--gold);
  font-family: var(--font-system);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-status:empty {
  display: none;
}

.unit--down {
  filter: grayscale(1);
  opacity: 0.4;
}

.unit--down::after {
  content: '✕';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--danger);
  font-size: 30px;
  font-weight: 700;
  pointer-events: none;
}

/* The attacker is drawn above the others while it lunges. */
.unit--acting {
  z-index: 3;
}

.arena {
  position: relative;
  touch-action: pan-y;
}

.arena-fx {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: visible;
  pointer-events: none;
}

.projectile {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.projectile--arrow {
  width: 26px;
  height: 2px;
  margin: -1px 0 0 -13px;
  background: linear-gradient(90deg, rgba(231, 220, 194, 0), #e7dcc2 40%, #e7dcc2);
}

.projectile--arrow::after {
  content: '';
  position: absolute;
  top: -3px;
  right: -2px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 7px solid #e7dcc2;
}

.projectile--magic {
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0, var(--fx, #8fe3ef) 45%, rgba(0, 0, 0, 0) 72%);
  box-shadow: 0 0 14px 4px var(--fx, #8fe3ef);
}

.slash {
  position: absolute;
  width: 46px;
  height: 46px;
  pointer-events: none;
}

.slash::before,
.slash::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 4px;
  right: 4px;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 2px;
  background: #ffd8cc;
  box-shadow: 0 0 6px rgba(239, 154, 133, 0.9);
  transform: rotate(-35deg);
}

/* One cut for a hit, two parallel cuts for a critical one; a cross would look
   like the mark of a fallen unit. */
.slash::after {
  display: none;
}

.slash--strong::before,
.slash--strong::after {
  height: 4px;
  background: #ffe2a8;
  box-shadow: 0 0 10px rgba(224, 160, 60, 0.95);
}

.slash--strong::before {
  margin-top: -7px;
}

.slash--strong::after {
  display: block;
  margin-top: 4px;
  opacity: 0.75;
}

.float {
  position: absolute;
  z-index: 5;
  font-family: var(--font-system);
  font-size: 17px;
  font-weight: 700;
  pointer-events: none;
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}

.float--hit {
  color: #ffb3a3;
}

.float--crit {
  color: var(--gold);
  font-size: 22px;
}

.float--tick,
.float--effect {
  color: #c5e38f;
  font-size: 13px;
}

.float--dodge {
  color: var(--system);
  font-size: 14px;
}

.arena-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  padding: 8px 16px;
  border: 1px solid var(--system-line);
  background: rgba(13, 17, 11, 0.92);
  color: var(--system-text);
  font-family: var(--font-system);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.arena-banner--shown {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.arena-banner[data-result='true'] {
  border-color: rgba(167, 196, 127, 0.7);
  color: var(--leaf);
}

.arena-banner[data-result='false'] {
  border-color: rgba(239, 154, 133, 0.7);
  color: var(--danger);
}

.fight-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fight-tabs {
  display: flex;
  gap: 6px;
  margin: 0 calc(var(--gutter) * -1);
  padding: 2px var(--gutter) 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.fight-tabs::-webkit-scrollbar {
  display: none;
}

.fight-tab {
  position: relative;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--bark-line);
  border-bottom: 3px solid var(--leaf);
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-system);
  font-size: 15px;
  font-weight: 600;
}

.fight-tab--false {
  border-bottom-color: var(--danger);
}

.fight-tab--null {
  border-bottom-color: var(--gold);
}

.fight-tab[aria-selected='true'] {
  border-color: var(--system);
  background: rgba(143, 227, 239, 0.14);
  color: var(--system-text);
}

.fight-tab-key {
  position: absolute;
  top: 1px;
  right: 3px;
  color: var(--gold);
  font-size: 10px;
}

.fight-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fight-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.fight-meta,
.fight-outcome {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.fight-outcome {
  font-family: var(--font-system);
  font-size: 12px;
}

.fight-outcome--true {
  color: var(--leaf);
}

.fight-outcome--false {
  color: var(--danger);
}

.fight-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fight-pager .button {
  width: 100%;
}

.chip--key {
  border-color: rgba(217, 180, 90, 0.6);
  color: var(--gold);
  font-size: 11px;
}

.chip--elite {
  border-color: rgba(224, 160, 60, 0.7);
  color: #e0a03c;
  font-size: 11px;
}

.link-button {
  padding: 0;
  border: 0;
  border-bottom: 1px dashed currentColor;
  background: none;
  font: inherit;
  text-align: right;
}

.link-button:has(.sprite) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.link-button .sprite {
  width: 32px;
  height: 32px;
}

.preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--system-line);
  background: var(--system-fill);
}

.preview-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  font-family: var(--font-system);
  font-size: 14px;
  list-style: none;
}

.preview-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.preview-up .num {
  color: var(--leaf);
}

.preview-down .num {
  color: var(--danger);
}

.toggle {
  min-width: 112px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--bark-line);
  background: var(--bg-deep);
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 600;
}

.toggle[aria-checked='true'] {
  border-color: var(--system);
  background: rgba(143, 227, 239, 0.14);
  color: var(--system-text);
}

.arena-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fight-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  margin: 0;
  padding: 10px 12px;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  font-size: 15px;
  line-height: 1.35;
  list-style: none;
}

.log-line--crit {
  color: var(--gold);
}

.log-line--kill {
  color: var(--text-muted);
  font-style: italic;
}

.log-line--effect,
.log-line--tick {
  color: #d8c49a;
}

.participants-scroll {
  overflow-x: auto;
}

.participants-table {
  border-collapse: collapse;
  font-family: var(--font-system);
  font-size: 12px;
}

.participants-table th,
.participants-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.participants-table thead th {
  color: var(--text);
}

.participants-table tbody th {
  color: var(--text-muted);
  font-weight: 400;
}

.fight-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fight-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 15px;
}

.fight-time {
  grid-row: span 2;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 12px;
}

.fight-result {
  color: var(--leaf);
  font-family: var(--font-system);
  font-size: 12px;
}

.fight-item--lost .fight-result {
  color: var(--danger);
}

.account {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  font-size: 15px;
  list-style: none;
}

.account li {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
}

.account-time {
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 12px;
  line-height: 1.8;
}

/* Journal */

.report-list,
.system-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.report-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.report-row-title {
  font-weight: 700;
}

.report-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 12px;
}

.report-row-meta .chip {
  padding: 1px 6px;
  font-size: 11px;
}

.report-row-date {
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 11px;
  text-align: right;
}

.system-history-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--system-line);
  background: var(--system-fill);
  font-family: var(--font-system);
}

.system-history-date {
  color: var(--system);
  font-size: 11px;
  letter-spacing: 0.08em;
}

/* Obóz: the materials, the board with a plot for each building, and a
   building's screen. */
.camp-materials {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Icon, then the name over the amount. */
.camp-material {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
  min-height: 40px;
  padding: 4px 8px;
  border: 1px solid var(--bark-line);
  color: var(--text-muted);
  font-family: var(--font-system);
}

.camp-material svg {
  grid-row: span 2;
}

.camp-material span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camp-material strong {
  color: var(--gold);
  font-size: 14px;
}

/* The board keeps the 360 × 400 shape of its picture; plots sit on it in
   percent of its size (camp-art.js). */
.camp-board {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  aspect-ratio: 360 / 400;
  overflow: hidden;
  border: 1px solid var(--bark-line);
  border-radius: 6px;
  background: #151d12;
}

.camp-board-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.camp-plot-wrap {
  position: absolute;
}

.camp-plot {
  position: relative;
  display: block;
  color: var(--text);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.camp-plot-art {
  display: block;
  width: 100%;
  aspect-ratio: 100 / 80;
  transition: transform 0.12s ease;
}

.camp-plot:active .camp-plot-art {
  transform: scale(0.95);
}

.camp-plot:focus-visible {
  outline: 2px solid var(--system);
  outline-offset: 2px;
}

/* The name and level under a plot; it may reach past the plot's width. */
.camp-plot-label {
  position: absolute;
  top: 100%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  transform: translate(-50%, -9px);
  background: rgba(13, 17, 11, 0.86);
  border: 1px solid var(--bark-line);
  font-family: var(--font-system);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.camp-plot-level {
  color: var(--gold);
  font-weight: 700;
}

.camp-plot--empty .camp-plot-label {
  border-style: dashed;
  color: var(--text-muted);
}

/* The time left of the building being built, over its plot. */
.camp-plot-timer {
  position: absolute;
  top: 0;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  transform: translateX(-50%);
  background: rgba(13, 17, 11, 0.88);
  border: 1px solid var(--system-line);
  color: var(--system);
  font-family: var(--font-system);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

/* What a production building's store holds: a tap collects it. */
.camp-bubble {
  position: absolute;
  top: -4px;
  right: -4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 44px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: rgba(13, 17, 11, 0.9);
  color: var(--gold);
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 700;
}

.camp-bubble[hidden] {
  display: none;
}

.camp-bubble--full {
  background: var(--gold);
  color: var(--bg-deep);
  animation: bubble-pulse 1.6s ease-in-out infinite;
}

@keyframes bubble-pulse {
  50% {
    box-shadow: 0 0 0 5px rgba(217, 180, 90, 0.25);
  }
}

.camp-hint {
  text-align: center;
}

.building-view {
  gap: 10px;
}

.building-art {
  margin: -4px -4px 0;
  background: radial-gradient(ellipse at 50% 60%, #2d3b24, #1a2416 70%);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.building-art svg {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.building-next-card {
  gap: 10px;
}

.building-effect,
.building-next,
.building-time {
  margin: 0;
  font-size: 15px;
}

.building-time {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.cost-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--bark-line);
  color: var(--text);
  font-family: var(--font-system);
  font-size: 13px;
}

.cost strong {
  color: var(--leaf);
}

.cost--missing strong {
  color: var(--danger);
}

.section-count--full {
  color: var(--danger);
}

/* The store of a production building. */
.store {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--bark-line);
}

.store-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-system);
  font-size: 14px;
}

.store-head span {
  flex: 1;
}

.store-head strong {
  color: var(--gold);
}

.store-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.bar-fill--gold {
  background: var(--gold);
  transition: width 1s linear;
}

/* The Stół rzemieślniczy: materials, the queue and parts, also in the report. */
.craft-card {
  display: grid;
  gap: 10px;
}

.craft-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.craft-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-deep);
}

.craft-row--none {
  opacity: 0.55;
}

.craft-art {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-muted);
}

.craft-art .sprite {
  width: 32px;
  height: 32px;
}

.craft-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.craft-count {
  color: var(--gold);
  font-family: var(--font-system);
  font-size: 16px;
}

.craft-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.craft-progress .bar {
  flex: 1;
}

.craft-countdown {
  color: var(--gold);
  font-family: var(--font-system);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Volume sliders in the settings */

.status-row--volume {
  align-items: center;
}

.status-row--volume dt {
  flex: none;
}

.status-row--volume dd {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  max-width: 230px;
}

.volume-slider {
  flex: 1;
  min-width: 0;
}

.volume-value {
  min-width: 42px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: right;
}

/* Pixel-art portraits: the full figure over the forest on the character
   screen, and the head and shoulders at the image's own size elsewhere. */

.portrait-art .portrait-svg {
  position: absolute;
  inset: 0;
}

.portrait-art .sprite--portrait {
  position: absolute;
  inset: 4% 0 0;
  width: 100%;
  height: 96%;
  object-fit: contain;
  object-position: 50% 100%;
}

.sprite--bust {
  width: 100%;
  height: 100%;
  object-fit: none;
  object-position: 50% 0;
}

/* Our characters stand on the card like the creatures, without a backdrop
   of their own (the author's request); the bust fades out at the bottom
   instead of ending in a hard cut. */
.unit-art .sprite--bust {
  width: 72px;
  height: 72px;
  -webkit-mask-image: linear-gradient(#000 72%, transparent);
  mask-image: linear-gradient(#000 72%, transparent);
}

.class-icon .sprite--bust {
  background: linear-gradient(#24301f, #141b11);
}

.status-row--look {
  align-items: center;
}

.status-row--look .segmented {
  min-width: 210px;
}

.class-icons {
  display: flex;
  gap: 6px;
}

/* "Przewiń": Punkty Czasu skip a wait (time.js). Gold like the hourglass,
   with the points it would use. */
.button--time {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--time);
  background: rgba(227, 155, 91, 0.12);
  color: var(--time);
}

.button--time:active:not(:disabled) {
  background: rgba(227, 155, 91, 0.22);
}

.time-cost {
  padding: 1px 7px;
  border: 1px solid currentColor;
  border-radius: 10px;
  font-size: 13px;
  letter-spacing: 0.04em;
}

/* The narrator: the ethereal figure above a scroll of parchment between two
   wooden rods. The parchment unrolls before the words and rolls up after
   them (narrator.js). */
.narrator {
  width: min(360px, calc(100vw - 2 * var(--gutter)));
  max-width: none;
  max-height: calc(100dvh - 16px);
  padding: 0;
  border: none;
  background: transparent;
  color: #33281c;
  overflow: visible;
}

.narrator::backdrop {
  background: rgba(5, 8, 4, 0.72);
}

/* The figure stands on the upper rod. */
.narrator-art {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  margin-bottom: -10px;
}

.sprite--narrator {
  width: 192px;
  height: 256px;
}

.narrator-scroll {
  display: grid;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.55));
}

.narrator-rod {
  position: relative;
  height: 14px;
  margin: 0 -10px;
  border-radius: 7px;
  background: linear-gradient(#a27b49, #6b4c2b 55%, #45301b);
  box-shadow: inset 0 1px 0 rgba(255, 236, 200, 0.35);
}

/* The knobs at both ends of a rod. */
.narrator-rod::before,
.narrator-rod::after {
  content: '';
  position: absolute;
  top: -3px;
  width: 12px;
  height: 20px;
  border-radius: 5px;
  background: linear-gradient(#80603a, #3b2a17);
}

.narrator-rod::before {
  left: -9px;
}

.narrator-rod::after {
  right: -9px;
}

.narrator-sheet {
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 250, 235, 0.55), transparent 70%),
    linear-gradient(#ece2c8, #dfd0ab);
  box-shadow:
    inset 0 10px 10px -8px rgba(60, 40, 20, 0.45),
    inset 0 -10px 10px -8px rgba(60, 40, 20, 0.45);
}

.narrator-page {
  display: grid;
  gap: 8px;
  max-height: calc(100dvh - 300px);
  padding: 14px 18px;
  overflow-y: auto;
  font-family: var(--font-world);
}

.narrator-label {
  margin: 0;
  color: #7a5c34;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

.narrator-text p {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.5;
}

.narrator-actions,
.guide-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* "Narrator" in the middle, "Ukryj" at the side. */
.narrator-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.narrator-head .narrator-label {
  grid-column: 2;
}

.narrator-head .narrator-hide {
  grid-column: 3;
  justify-self: end;
}

/* "Ukryj": the parchment rolls up to show the screen behind it. */
.narrator-hide {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 0 4px;
  border: none;
  background: none;
  color: #7a5c34;
  font-family: var(--font-world);
  font-size: 15px;
}

/* "Pokaż pergamin", at the bottom while the parchment is hidden. */
.narrator-show {
  display: none;
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 50%;
  align-items: center;
  gap: 8px;
  width: auto;
  padding: 10px 18px;
  transform: translateX(-50%);
  border: 1px solid #6d5233;
  border-radius: 4px;
  background: #3b2c1d;
  color: #f3e8cf;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  font-family: var(--font-world);
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  pointer-events: auto;
}

.narrator--hidden .narrator-show,
.guide-show {
  display: inline-flex;
}

.narrator--hidden::backdrop {
  background: transparent;
}

.narrator--hidden .narrator-art,
.narrator--hidden .narrator-scroll,
.guide-note--hidden,
.guide-note--waiting {
  visibility: hidden;
}

/* After the screen glides to a place the narrator steps in, and steps away
   after "Dalej". */
@keyframes guide-arrive {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.guide-note--arriving {
  animation: guide-arrive 0.5s ease-out;
}

.guide-note--leaving {
  opacity: 0;
  transition: opacity 0.25s ease-in;
}

.narrator-skip {
  padding: 10px 0;
  border: none;
  background: none;
  color: #7a5c34;
  font-family: var(--font-world);
  font-size: 15px;
  text-decoration: underline;
}

.narrator-next,
.guide-next {
  width: auto;
  margin-left: auto;
  padding: 10px 24px;
  border: 1px solid #6d5233;
  border-radius: 4px;
  background: #3b2c1d;
  color: #f3e8cf;
  font-family: var(--font-world);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

/* On short screens the figure is smaller and the page has more room. */
@media (max-height: 739px) {
  .sprite--narrator {
    width: 96px;
    height: 128px;
  }

  .narrator-page {
    max-height: calc(100dvh - 172px);
  }
}

/* The light of the first steps: shades take every tap but the one on the
   lit place, the ring pulses around it and the narrator stands beside it,
   with the line in a bubble. */
/* Above the toasts, so that none covers the narrator's "Dalej". */
.guide {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

/* One shade over the whole screen, with a hole for each lit place
   (clip-path, set in narrator.js): taps in a hole reach the game. */
.guide-shade {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 4, 0.62);
  pointer-events: auto;
  touch-action: none;
}

.guide-shade--see-through {
  pointer-events: none;
}

.guide-ring {
  position: fixed;
  border: 2px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(217, 180, 90, 0.25), 0 0 18px rgba(217, 180, 90, 0.55);
  animation: guide-pulse 1.6s ease-in-out infinite;
}

.guide-ring--nudge {
  animation:
    guide-nudge 0.4s ease-in-out 1,
    guide-pulse 1.6s ease-in-out 0.4s infinite;
}

@keyframes guide-pulse {
  50% {
    box-shadow: 0 0 0 7px rgba(217, 180, 90, 0.18), 0 0 26px rgba(217, 180, 90, 0.7);
  }
}

@keyframes guide-nudge {
  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

/* The narrator alone, without the scroll: the figure and the bubble. */
.guide-note {
  position: fixed;
  right: var(--gutter);
  left: var(--gutter);
  display: flex;
  align-items: flex-end;
  gap: 4px;
  max-width: 380px;
  margin: 0 auto;
}

.guide-note .sprite--narrator {
  flex: none;
  width: 72px;
  height: 96px;
  animation: narrator-float 3.2s ease-in-out infinite;
}

@keyframes narrator-float {
  50% {
    transform: translateY(-3px);
  }
}

.guide-bubble {
  position: relative;
  display: grid;
  flex: 1;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid #b59a6a;
  border-radius: 8px;
  background: #eadfc3;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  color: #33281c;
  font-family: var(--font-world);
  font-size: 16px;
  line-height: 1.4;
  pointer-events: auto;
}

.guide-bubble p {
  margin: 0;
}

.guide-next {
  padding: 8px 20px;
  font-size: 16px;
}

/* The tail of the bubble, toward the lit place. */
.guide-bubble::before {
  content: '';
  position: absolute;
  left: calc(var(--tail-x, 50%) - 8px);
  width: 16px;
  height: 10px;
  background: #eadfc3;
}

.guide-note--below .guide-bubble::before {
  top: -10px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.guide-note--above .guide-bubble::before {
  bottom: -10px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* The narrator with a small scroll beside the lit place. */
.guide-note--scroll {
  align-items: flex-start;
}

.guide-scroll {
  display: grid;
  flex: 1;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
  pointer-events: auto;
}

.guide-scroll .narrator-rod {
  height: 10px;
  margin: 0 -6px;
  border-radius: 5px;
}

.guide-scroll .narrator-rod::before,
.guide-scroll .narrator-rod::after {
  top: -2px;
  width: 8px;
  height: 14px;
  border-radius: 4px;
}

.guide-scroll .narrator-rod::before {
  left: -6px;
}

.guide-scroll .narrator-rod::after {
  right: -6px;
}

.guide-sheet {
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 250, 235, 0.55), transparent 70%),
    linear-gradient(#ece2c8, #dfd0ab);
  box-shadow:
    inset 0 8px 8px -7px rgba(60, 40, 20, 0.45),
    inset 0 -8px 8px -7px rgba(60, 40, 20, 0.45);
}

.guide-page {
  display: grid;
  gap: 8px;
  max-height: 45vh;
  padding: 10px 14px;
  overflow-y: auto;
  color: #33281c;
  font-family: var(--font-world);
  font-size: 16px;
  line-height: 1.45;
}

.guide-page p {
  margin: 0;
}

.guide-skip {
  position: fixed;
  top: calc(max(8px, env(safe-area-inset-top)) + 4px);
  left: var(--gutter);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(18, 23, 15, 0.92);
  color: var(--text-muted);
  font-family: var(--font-world);
  font-size: 14px;
  pointer-events: auto;
}

/* With the animations off in the settings (motion.js) the pulsing and
   sliding stop; the fight playback stays, in a calmer form (see arena.js).
   Last in the file, so it wins over the rules it calms. */
.calm .activity--done,
.calm .camp-bubble--full,
.calm .guide-ring,
.calm .guide-ring--nudge,
.calm .guide-note .sprite--narrator {
  animation: none;
}

.calm .camp-plot-art,
.calm .meter-fill,
.calm .bar-fill,
.calm .portrait-art,
.calm .arena-banner {
  transition: none;
}
