/* Frame the centered title with the creator and guest; advisers sit below. */
#screen-title {
  display: flex;
  flex-direction: column;
  color: #e8e9df;
  background:
    radial-gradient(ellipse at 50% 42%, #0000 0%, #0a130f55 65%, #07100cb0 100%),
    linear-gradient(180deg, #0b161255, transparent 35%, #07100c88 100%);
}
#screen-title[hidden] {
  display: none;
}
#screen-title .title-content {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(0, 3.4fr) minmax(160px, 1fr);
  grid-template-areas: 'production hero guest' 'production planning guest';
  grid-template-rows: minmax(300px, 1fr) auto;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  /* Match the footer below so both side columns center on the whole screen. */
  padding: 30px 40px 0;
  gap: 24px;
  flex: 1 0 auto;
  align-items: center;
}
.title-hero {
  grid-area: hero;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  justify-content: center;
}
#screen-title .title-content:has([data-credits='public']) {
  grid-template-areas: 'production hero guest';
  grid-template-rows: minmax(300px, 1fr);
}
#screen-title:has([data-credits='public']) .title-art {
  height: clamp(200px, min(62dvh, calc(100dvh - 180px)), 600px);
}
#screen-title .title-logo {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-width: 0;
  max-width: 100%;
}
#screen-title .title-logo::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: var(--title-art) center / 100% 100% no-repeat;
  opacity: 0.95;
  filter: brightness(0) invert(1) blur(clamp(8px, 1.4vw, 18px));
}
#screen-title .title-logo h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.title-art {
  display: block;
  width: auto;
  max-width: 100%;
  height: clamp(200px, min(52dvh, calc(100dvh - 480px)), 600px);
  object-fit: contain;
  filter: drop-shadow(0 8px 18px #0009);
}
.title-welcome {
  width: min(280px, 100%);
}
.title-fullscreen {
  position: absolute;
  top: 16px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #dbc89555;
  border-radius: 4px;
  background: #14211bd9;
  color: #f0dfb6;
}
.title-fullscreen:hover,
.title-fullscreen:focus-visible,
.title-fullscreen.gamepad-focus {
  background: #364438;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#screen-title .title-menu {
  min-width: 0;
  gap: 6px;
}
#screen-title .menu-item {
  min-height: 44px;
}
#screen-title #title-language {
  flex-direction: row;
  gap: 10px;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.title-language span[lang] {
  opacity: 0.6;
}
.title-language[data-language='ja'] [lang='ja'],
.title-language[data-language='en'] [lang='en'] {
  color: var(--accent);
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.title-credits {
  display: contents;
}
.title-credits h2 {
  margin: 0 0 12px;
  color: #d6c79a;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-align: center;
}
.credit-production {
  grid-area: production;
  min-width: 0;
}
.credit-production h2 {
  font-size: 22px;
}
.credit-planning {
  grid-area: planning;
  min-width: 0;
  width: min(900px, 100%);
  justify-self: center;
  padding-top: 16px;
  border-top: 1px solid #dbc89540;
}
.credit-side {
  grid-area: guest;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4dvh, 42px);
  min-width: 0;
}
.credit-guest,
.credit-support {
  min-width: 0;
}
.credit-people {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}
.credit-person {
  display: flex;
  margin: 0;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.credit-person img {
  display: block;
  flex-shrink: 0;
}
.credit-avatar {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border: 2px solid #dbc895b3;
  border-radius: 50%;
  background: #17221c;
  box-shadow: 0 3px 12px #0005;
}
.credit-qr {
  width: 74px;
  height: 74px;
  background: white;
  image-rendering: pixelated;
  box-shadow: 0 2px 10px #513a260c;
}
.credit-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
  color: #f1ead8;
}
.credit-production .credit-qr {
  width: 148px;
  height: 148px;
}
.credit-production .credit-avatar {
  width: 112px;
  height: 112px;
}
.credit-production .credit-name {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0.04em;
}
#screen-title .title-footer {
  position: static;
  flex-shrink: 0;
  width: 100%;
  height: 30px;
  padding: 8px 24px 10px;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  color: #a8b49b;
  font-size: 8px;
  line-height: 12px;
  letter-spacing: 0.1em;
}
@media (max-width: 1000px) {
  #screen-title .title-content {
    padding: 30px 24px 0;
    gap: 16px;
  }
  .credit-people {
    gap: 16px;
  }
}
@media (max-width: 700px) {
  #screen-title .title-content {
    grid-template-columns: minmax(148px, 1fr) minmax(0, 1fr);
    grid-template-areas: 'hero hero' 'production guest' 'planning planning';
    grid-template-rows: auto;
    padding: 66px 18px 0;
    gap: 28px 20px;
  }
  #screen-title .title-content:has([data-credits='public']) {
    grid-template-areas: 'hero hero' 'production guest';
    grid-template-rows: auto;
  }
  #screen-title:has([data-credits='public']) .title-art {
    width: min(620px, 100%);
    height: auto;
  }
  .title-art {
    width: min(620px, 100%);
    height: auto;
  }
  #screen-title .title-footer {
    padding: 8px 18px 10px;
    font-size: 7px;
  }
}
@media (max-width: 560px) {
  .credit-people {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 18px;
  }
}
@media (max-height: 600px) and (min-width: 701px) {
  .title-art {
    height: 200px;
  }
  .title-welcome {
    padding: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  #screen-title,
  #screen-title .title-content {
    animation: none;
  }
}

/* ---- Contributors and mural people dialogs (the same cards) ---- */
.contributor-group h3 {
  margin: 18px 0 10px;
  color: #d6c79a;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3em;
}
.contributor-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.contributor {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #e0c99a26;
  border-radius: 12px;
  background: #ffffff06;
  color: inherit;
  text-decoration: none;
}
a.contributor:hover,
a.contributor:focus-visible,
a.contributor.gamepad-focus {
  border-color: #f3c77a99;
  background: #f3c77a14;
  outline: none;
}
.contributor strong {
  min-width: 0;
  color: #f2ead4;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.contributor-x {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-left: auto;
  color: #f2ead4;
}

/* The online home keeps the original logo and immediate menu, with no mural band. */
body #screen-title[data-variant='classic'] .title-content {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: 'hero';
  padding: max(56px, env(safe-area-inset-top)) 24px 16px;
  min-height: 0;
  flex: 1;
}
body #screen-title[data-variant='classic'] .title-hero {
  height: 100%;
  min-height: 0;
}
body #screen-title[data-variant='classic'] .title-logo {
  flex: 0 1 auto;
  min-height: 0;
}
body #screen-title[data-variant='classic'] .title-logo::before {
  background-size: contain;
}
body #screen-title[data-variant='classic'] .title-art {
  width: min(840px, 100%);
  height: clamp(120px, calc(100dvh - 310px), 560px);
  max-height: 100%;
}
body #screen-title[data-variant='classic'] .title-welcome {
  flex: none;
  width: min(340px, 100%);
}
body #screen-title[data-variant='classic'] .menu-item {
  white-space: nowrap;
  font-size: clamp(16px, 2.4vw, 22px);
}
/* Let phone artwork start beyond the viewport and settle without moving the menu. */
@keyframes title-logo-settle {
  from {
    transform: scale(1.2);
  }
  to {
    transform: scale(1);
  }
}
@media (max-width: 700px), (max-width: 1000px) and (max-height: 520px) and (pointer: coarse) {
  body #screen-title[data-variant='classic'] {
    overflow-x: hidden;
  }
  body #screen-title[data-variant='classic'] .title-logo {
    animation: title-logo-settle 8s ease-in-out both;
    transform-origin: center;
    pointer-events: none;
  }
}
@media (max-width: 700px) and (orientation: portrait) {
  body #screen-title[data-variant='classic'] .title-content {
    padding-inline: 0;
  }
  body #screen-title[data-variant='classic'] .title-logo,
  body #screen-title[data-variant='classic'] .title-art {
    width: 100%;
  }
  body #screen-title[data-variant='classic'] .title-welcome {
    width: min(340px, calc(100% - 48px));
  }
}
@media (prefers-reduced-motion: reduce) {
  body #screen-title[data-variant='classic'] .title-logo {
    animation: none;
  }
}
#loading-cave {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  touch-action: none;
  user-select: none;
  color: #fff7e4;
}
.loading-cave-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 32px
    max(24px, env(safe-area-inset-left));
  background: linear-gradient(#14120ecd, transparent);
}
.loading-cave-heading small {
  letter-spacing: 0.18em;
  font-size: 11px;
}
.loading-cave-heading h2 {
  margin: 6px 0;
  font: 500 24px/1.3 var(--display);
}
.loading-cave-heading .button {
  min-height: 44px;
  background: #1b211dcc;
}
.loading-cave-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.loading-cave-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 28px max(24px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  background: linear-gradient(transparent, #14120ee8);
  text-align: center;
}
.loading-cave-help {
  margin: 0;
  font-size: 12px;
  color: #ede1c9;
  text-shadow: 0 1px 4px #000;
}
/* One control: a spinner in a quiet pill while the world loads (and while entering it),
   then, in the same place, the button that can be pressed at once. No words, no bar. */
.loading-cave-proceed {
  position: relative;
  min-width: 160px;
  min-height: 48px;
}
.loading-cave-spinner {
  display: none;
}
.loading-cave-proceed[aria-busy='true'] {
  opacity: 1;
  border: 1px solid #f3e1b833;
  background: #1b211dcc;
  box-shadow: none;
  cursor: wait;
}
/* Kept for the accessible name, not shown. */
.loading-cave-proceed[aria-busy='true'] > span {
  opacity: 0;
}
.loading-cave-proceed[aria-busy='true'] .loading-cave-spinner {
  display: block;
  position: absolute;
  inset: 0;
  width: 22px;
  height: 22px;
  margin: auto;
  border: 2.5px solid #f3e1b840;
  border-top-color: #f3d8a0;
  border-radius: 50%;
  animation: loading-cave-spin 0.9s linear infinite;
}
@keyframes loading-cave-spin {
  to {
    transform: rotate(1turn);
  }
}
@media (prefers-reduced-motion: reduce) {
  .loading-cave-proceed[aria-busy='true'] .loading-cave-spinner {
    animation-duration: 2.4s;
  }
}
.loading-cave-wait {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: -1;
  background: #24251f;
}
.loading-cave-wait[hidden] {
  display: none;
}
.loading-cave-stick {
  position: absolute;
  left: max(24px, env(safe-area-inset-left));
  bottom: 170px;
  width: 112px;
  height: 112px;
  border: 1px solid #fff4d85c;
  border-radius: 50%;
  background: #191d173d;
  display: none;
  place-items: center;
}
.loading-cave-torch {
  position: absolute;
  right: max(24px, env(safe-area-inset-right));
  bottom: 170px;
  min-height: 48px;
  background: #1b211dcc;
}
.loading-cave-stick i {
  width: 44px;
  height: 44px;
  border: 1px solid #fff4d87a;
  border-radius: 50%;
  background: #fff4d82e;
}
.loading-cave-stick span {
  position: absolute;
  bottom: -24px;
  font-size: 12px;
  text-shadow: 0 1px 4px #000;
}
.touch-mode .loading-cave-stick {
  display: grid;
}
.touch-mode .loading-cave-help {
  font-size: 0;
}
.touch-mode .loading-cave-help::after {
  content: '左のパッドで移動 · 画面をドラッグして見回す';
  font-size: 11px;
}
:lang(en) .touch-mode .loading-cave-help::after {
  content: 'Left pad to move · Drag to look';
}
.loading-cave-active .scene-shade {
  display: none;
}
@media (max-width: 600px) {
  .loading-cave-heading {
    padding: max(12px, env(safe-area-inset-top)) 16px 24px;
    gap: 8px;
  }
  .loading-cave-heading h2 {
    font-size: 18px;
  }
  .loading-cave-heading .button {
    padding: 8px 10px;
    font-size: 11px;
  }
  .loading-cave-footer {
    padding: 24px 16px max(12px, env(safe-area-inset-bottom));
  }
}
/* A phone held upright stacks the two header buttons beside the cave's name. */
@media (max-width: 440px) {
  .loading-cave-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  body #screen-title[data-variant='classic'] .title-hero {
    flex-direction: row;
    gap: 24px;
  }
  body #screen-title[data-variant='classic'] .title-logo {
    width: min(50%, 560px);
    height: 100%;
  }
  body #screen-title[data-variant='classic'] .title-art {
    height: 100%;
  }
  body #screen-title[data-variant='classic'] .title-welcome {
    width: min(320px, 43%);
  }
  .loading-cave-heading {
    padding-top: 8px;
    padding-bottom: 12px;
  }
  .loading-cave-heading small {
    display: none;
  }
  .loading-cave-footer {
    padding-top: 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .loading-cave-footer {
    gap: 10px;
  }
  .loading-cave-stick {
    bottom: 104px;
    width: 88px;
    height: 88px;
  }
  .loading-cave-torch {
    bottom: 104px;
  }
}
