/* Reconstructed sanctuary materials. Continuous native geometry at every size.
   Illustration belongs to the scene, never to a control's hit area. */
:root {
  --relic-ink: #053f43;
  --relic-teal: #00858a;
  --relic-teal-light: #19d6d2;
  --relic-teal-deep: #00555b;
  --relic-gold: #f6c45d;
  --relic-gold-light: #fff3b5;
  --relic-gold-edge: #996324;
  --relic-stone: #e7bd78;
  --relic-paper: #fff0ca;
  --relic-muted: #74603d;
  --relic-success: #397d3b;
  --relic-error: #ac4146;
  --relic-radius: 18px;
  --relic-tap: 44px;
  --relic-press: 100ms;
  --relic-settle: 180ms;
  --relic-reward: 520ms;
  --relic-gilding: linear-gradient(
    172deg,
    #fff8d1 0%,
    #ffdb76 14%,
    #d3972f 40%,
    #ffe498 72%,
    #a66d22 100%
  );
  --relic-enamel: linear-gradient(
    177deg,
    #21bfb6 0%,
    #00868b 19%,
    #00757b 52%,
    #00525b 100%
  );
  --relic-parchment: radial-gradient(
    ellipse at 35% 0,
    #fffbe3,
    #fff0ca 70%,
    #efd49a
  );
  --relic-control-shadow:
    inset 0 0 0 1px #ffedaa, inset 0 2px 0 1px #7de9db70,
    inset 0 -3px 0 #003c4a55, 0 0 0 1px #986225, 0 3px 0 #a36f2c,
    0 6px 9px #58371038;
  --ink: var(--relic-ink);
  --surface: #fff2d0;
  --blue: #00858a;
  --blue-top: #11aaa8;
  --blue-deep: #00636d;
  --blue-edge: #005b65;
  --blue-base: #004d57;
  --blue-paper: #d5f2e5;
  --gold: var(--relic-gold);
  --gold-paper: var(--relic-paper);
}
/* One complete object, including the rounded caps: no sliced pixels. Scoped
   selectors bridge legacy screens without changing their composition. */
:is(
  .study-button,
  .primary,
  body.has-play-dock #home-play-slot .primary,
  .character-dialog:has(.airport-offer) > .dialog-actions .primary,
  .character-dialog:has(.reading-artifact) > .dialog-actions .primary
) {
  border: var(--control-border, 3px solid transparent);
  border-image: none;
  border-radius: var(--control-radius, 999px);
  background: var(
    --control-background,
    var(--control-fill, var(--relic-enamel)) padding-box,
    var(--relic-gilding) border-box
  );
  color: var(--control-ink, #fffbea);
  box-shadow: var(--control-shadow, var(--relic-control-shadow));
  text-shadow: var(--control-text-shadow, 0 1px 1px #003c49);
  font-family: var(--control-font, var(--heading));
  font-weight: var(--control-weight, 650);
  text-decoration: var(--control-decoration, none);
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--relic-press) ease,
    box-shadow var(--relic-press) ease;
}
.study-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  min-width: 44px;
  max-width: 100%;
  padding: 12px 24px;
  font: 650 21px/1.2 var(--heading);
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
}
:is(
    .study-button,
    .primary,
    body.has-play-dock #home-play-slot .primary,
    .character-dialog:has(.airport-offer) > .dialog-actions .primary,
    .character-dialog:has(.reading-artifact) > .dialog-actions .primary
  ):is(:active, .is-pressed):not(:disabled) {
  transform: translateY(2px);
  box-shadow:
    inset 0 0 0 1px #ffecad,
    inset 0 3px 5px #003d5866,
    0 0 0 1px #986225,
    0 1px #8e6026;
}
:is(
  .study-button,
  .primary,
  .study-icon-button,
  .study-tab-rail button,
  body.has-play-dock .app-dock button
):focus-visible {
  outline: 3px solid #075a6b;
  outline-offset: 4px;
  box-shadow:
    0 0 0 4px #fff6cc,
    var(--relic-control-shadow);
}
:is(
  .study-button,
  .primary,
  body.has-play-dock #home-play-slot .primary,
  .character-dialog:has(.airport-offer) > .dialog-actions .primary,
  .character-dialog:has(.reading-artifact) > .dialog-actions .primary
):disabled {
  --control-fill: linear-gradient(#ead9b2, #d5c298);
  --control-ink: #675536;
  opacity: 1;
  filter: none;
  text-shadow: 0 1px #fff2d2;
  box-shadow:
    inset 0 0 0 1px #fff0c9,
    0 0 0 1px #a28a5d;
  cursor: not-allowed;
}
.study-button--secondary {
  --control-fill: var(--relic-parchment);
  --control-ink: var(--relic-ink);
  --control-text-shadow: 0 1px #fff9dc;
}
.study-button.study-button--secondary {
  min-height: 48px;
  font-size: 18px;
  text-shadow: 0 1px #fff9dc;
}
.study-button.study-button--quiet {
  --control-background: transparent;
  --control-ink: var(--relic-ink);
  --control-border: 1px solid transparent;
  --control-shadow: none;
  --control-text-shadow: none;
  --control-font: var(--body);
  --control-weight: 800;
  --control-decoration: underline;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 16px;
  line-height: 1.3;
  text-underline-offset: 4px;
}
.study-button[aria-busy="true"] {
  cursor: progress;
}
.secondary {
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: 18px;
  background:
    var(--relic-parchment) padding-box,
    var(--relic-gilding) border-box;
  color: var(--relic-ink);
  box-shadow:
    inset 0 1px #fff9de,
    0 2px #a37a3644;
}
.secondary.is-pressed {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 4px #a37a3633,
    0 1px #a37a3644;
}
.study-button[aria-busy="true"]::after {
  content: "";
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: relic-wait 900ms linear infinite;
}
@keyframes relic-wait {
  to {
    transform: rotate(360deg);
  }
}

.study-panel {
  position: relative;
  border: 4px solid transparent;
  border-image: none;
  border-radius: 22px;
  background:
    var(--relic-parchment) padding-box,
    var(--relic-gilding) border-box;
  box-shadow:
    inset 0 0 0 1px #fff9e1,
    inset 0 0 0 5px #dfb86640,
    0 0 0 1px #ae7b34,
    0 4px #ae7b3440;
  color: var(--relic-ink);
}
.study-panel--teal {
  background:
    var(--relic-enamel) padding-box,
    var(--relic-gilding) border-box;
  color: #fffbea;
}
.study-panel--crested::before {
  content: "";
  position: absolute;
  top: -23px;
  left: calc(50% - 74px);
  width: 148px;
  height: 50px;
  background: url("../assets/expedition/ui/relic-crest.svg") center / contain
    no-repeat;
  pointer-events: none;
}

body.has-play-dock .app-dock {
  border: 3px solid transparent;
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background:
    linear-gradient(165deg, #ffedab, #efc36a 65%, #d79838) padding-box,
    var(--relic-gilding) border-box;
  box-shadow:
    inset 0 0 0 1px #fff6ce,
    0 -1px #9e6a2c,
    0 -3px 16px #64491433;
  isolation: isolate;
}
body.has-play-dock .app-dock::before {
  display: none;
}
.study-tab-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border: 2px solid #bd8737;
  border-radius: 24px;
  background: var(--relic-gilding);
  box-shadow:
    inset 0 0 0 1px #fff6cc,
    0 3px #a67632;
}
body.has-play-dock .app-dock .bottom-nav {
  gap: 5px;
}
body.has-play-dock .app-dock .bottom-nav button,
.study-tab-rail button {
  border: 2px solid transparent;
  border-image: none;
  border-radius: 20px;
  background:
    linear-gradient(155deg, #ffedb5, #efc36a) padding-box,
    var(--relic-gilding) border-box;
  box-shadow:
    inset 0 1px #fffae1,
    inset 0 -2px #b6823333,
    0 1px #a87b35;
  color: #604019;
  padding: 5px 3px 8px;
}
.study-tab-rail button {
  position: relative;
  min-height: 82px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
}
body.has-play-dock .app-dock .bottom-nav button[aria-selected="true"],
.study-tab-rail button[aria-selected="true"] {
  background:
    var(--relic-enamel) padding-box,
    var(--relic-gilding) border-box;
  box-shadow:
    inset 0 0 0 1px #fff1ab88,
    inset 0 3px #7eece150,
    0 1px #996521;
  color: #fff9e5;
}
body.has-play-dock .app-dock .bottom-nav button:is(:active, .is-pressed),
.study-tab-rail button:is(:active, .is-pressed) {
  transform: translateY(1px);
}
body.has-play-dock .app-dock .bottom-nav button[aria-selected="true"]::before,
.study-tab-rail button[aria-selected="true"]::before {
  content: "";
  position: absolute;
  top: auto;
  bottom: 2px;
  width: 30px;
  left: calc(50% - 15px);
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(#fff2a1, #ffc535);
  box-shadow: 0 1px 3px #fabe35;
}
body.has-play-dock .app-dock .bottom-nav .illustrated-icon,
.study-tab-rail .illustrated-icon {
  width: 45px;
  height: 45px;
  filter: drop-shadow(0 2px 2px #7b4b2240);
}
.illustrated-icon[data-art="achievements"] .book-gold-ribbon,
.illustrated-icon[data-art="achievements"] .book-gold-seal {
  display: none;
}
body.has-play-dock .app-dock .nav-label,
.study-tab-rail .nav-label {
  font: 650 13px/1.15 var(--heading);
}

body:is([data-screen="journey"], [data-screen="journey-choice"]) .game-header {
  background: linear-gradient(#fff1cde8, #f2d18bc9);
  box-shadow: 0 2px 9px #6b4b2526;
  border-bottom: 1px solid #b8883e;
}
body:is(
    [data-screen="journey"],
    [data-screen="journey-choice"],
    [data-screen="game"]
  )
  :is(.icon-btn, .coin-pill) {
  color: var(--relic-ink);
  border-color: #ba8940;
  background: linear-gradient(140deg, #fff9de, #f4d795);
  box-shadow:
    inset 0 0 0 2px #fff7db,
    0 3px #ac7d3340;
}
.coin-pill > .icon {
  background: url("../assets/expedition/ui/relic-coin.svg") center / contain
    no-repeat;
}
.coin-pill > .icon > use {
  visibility: hidden;
}
.study-icon-button,
body.playing.study-challenge-playing :is(#challenge-home, #pause) {
  display: inline-grid;
  place-items: center;
  width: 48px;
  min-width: 44px;
  height: 48px;
  min-height: 44px;
  padding: 0;
  border: 3px solid transparent;
  border-image: none;
  border-radius: 15px;
  color: #fff5d4;
  background:
    var(--relic-enamel) padding-box,
    var(--relic-gilding) border-box;
  box-shadow:
    inset 0 0 0 1px #fff2b580,
    0 0 0 1px #966026,
    0 3px #8c5c2555;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--relic-press) ease;
}
.study-icon-button > .icon {
  width: 25px;
  height: 25px;
}
.study-icon-button--round,
body.playing.study-challenge-playing[data-study-challenge="olga"]
  :is(#challenge-home, #pause) {
  border-radius: 50%;
}
.study-icon-button:is(:active, .is-pressed),
body.playing.study-challenge-playing
  :is(#challenge-home, #pause):is(:active, .is-pressed) {
  transform: translateY(2px);
}
.study-caption {
  color: var(--relic-muted);
  font: 700 13px/1.4 var(--body);
}
body.playing.study-challenge-playing .game-header {
  background: transparent;
  box-shadow: none;
}
body.playing.study-challenge-playing :is(#challenge-home, #pause) {
  width: 44px;
  height: 44px;
}
body.playing.study-challenge-playing :is(#challenge-home, #pause) > .icon {
  visibility: visible;
  width: 23px;
  height: 23px;
  stroke-width: 2.5;
}
body.playing.study-challenge-playing #wallet {
  border: 2px solid transparent;
  color: #fff6d8;
  background:
    var(--relic-enamel) padding-box,
    var(--relic-gilding) border-box;
  box-shadow:
    inset 0 0 0 1px #fff1af,
    0 2px #6a452766;
}
body.playing.study-challenge-playing #inventory-summary {
  background: #ffedbccc;
}
.study-meter {
  height: 12px;
  background: #d1bb84;
  border: 1px solid #b69350;
  border-radius: 12px;
  box-shadow:
    inset 0 2px #92743c44,
    0 1px #fff8d4;
  overflow: hidden;
}
.study-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(#2cd9cc, #008c91);
  box-shadow: inset 0 1px #b0fff2;
}
.study-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 4px 12px;
  border: 2px solid transparent;
  border-radius: 15px;
  color: var(--relic-ink);
  background:
    var(--relic-parchment) padding-box,
    var(--relic-gilding) border-box;
  box-shadow:
    inset 0 1px #fff9dd,
    0 2px #9b743e55;
  font-weight: 850;
}
@media (max-width: 350px), (max-height: 600px) {
  body.has-play-dock .app-dock .bottom-nav .illustrated-icon {
    width: 34px;
    height: 34px;
  }
  body.has-play-dock .app-dock .nav-label {
    font-size: 11px;
  }
  body.has-play-dock #home-play-slot .primary {
    min-height: 52px;
    font-size: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .study-button,
  .study-icon-button,
  .primary,
  body.has-play-dock #home-play-slot .primary,
  body.has-play-dock .app-dock .bottom-nav button {
    transition: none;
  }
  .study-button[aria-busy="true"]::after {
    animation: none;
  }
}
