/* ==========================================================
   neur0doku-neur0loom.css
   Layout for the neur0loom hub only (World/Game/About/Updates).
   Colors come from neur0doku-theme.css — nothing here should
   hardcode a color or reach for a site --token. This page also
   loads neur0doku-modals.css for the shared .nd-modal shell —
   the detail popup for every tile reuses that, not a custom
   overlay built here.
   ========================================================== */

.neur0doku-loom {
  max-width: 460px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* ---------- topbar ---------- */
.nd-loom-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.nd-loom-title {
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--nd-accent);
  margin: 0;
  text-align: center;
  flex: 1;
}
.nd-loom-topbar-spacer { width: 2.5rem; flex-shrink: 0; }

/* ---------- top-level tabs ---------- */
.nd-loom-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}
.nd-loom-tab {
  flex: 1;
  padding: 0.55rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--nd-button-border);
  background: var(--nd-surface);
  color: var(--nd-text-soft);
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.nd-loom-tab.is-active {
  background: var(--nd-button-bg);
  border-color: var(--nd-button-border);
  color: var(--nd-button-ink);
}
.nd-loom-tab:focus-visible { outline: 2px solid var(--nd-focus); outline-offset: 2px; }

.nd-loom-panel[hidden] { display: none; }

/* ---------- World hero ---------- */
.nd-loom-hero {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 1.1rem;
  box-shadow: 0 6px 18px var(--nd-shadow);
  margin-bottom: 1rem;
  display: block;
}

/* ---------- World's own sub-tabs — visually lighter/smaller than
   the top-level tabs so the hierarchy reads at a glance ---------- */
.nd-loom-subtabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  margin-bottom: 1rem;
  scrollbar-width: none;
}
.nd-loom-subtabs::-webkit-scrollbar { display: none; }
.nd-loom-subtab {
  flex-shrink: 0;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--nd-border);
  background: var(--nd-surface-soft);
  color: var(--nd-text-soft);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.nd-loom-subtab.is-active {
  background: var(--nd-accent);
  border-color: var(--nd-accent);
  color: var(--nd-surface);
}
.nd-loom-subtab:focus-visible { outline: 2px solid var(--nd-focus); outline-offset: 2px; }
.nd-loom-subpanel[hidden] { display: none; }

/* ---------- tile grid — reused by Characters, Poems, Game, About ---------- */
.nd-loom-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.nd-loom-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.4rem 0.65rem;
  border-radius: 1rem;
  background: var(--nd-surface);
  border: 1px solid var(--nd-border);
  box-shadow: 0 3px 8px var(--nd-shadow);
  cursor: pointer;
  font: inherit;
  text-align: center;
  color: var(--nd-text);
  transition: transform 0.15s ease;
}
.nd-loom-tile:hover { transform: translateY(-1px); }
.nd-loom-tile:focus-visible { outline: 2px solid var(--nd-focus); outline-offset: 2px; }

.nd-loom-tile-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 0.7rem;
  overflow: hidden;
  background: var(--nd-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nd-loom-tile-art img { width: 100%; height: 100%; object-fit: cover; }
.nd-loom-tile-emoji { font-size: 1.7rem; }

.nd-loom-tile.is-locked .nd-loom-tile-art img { filter: grayscale(1); opacity: 0.45; }
.nd-loom-tile.is-locked .nd-loom-tile-emoji { opacity: 0.4; }
.nd-loom-tile-lock {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--nd-surface);
  box-shadow: 0 2px 4px var(--nd-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
}

.nd-loom-tile-name {
  display: block;
  width: 100%;
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.2;
}
.nd-loom-tile-sub {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: var(--nd-text-soft);
  margin-top: 0.15rem;
}
.nd-loom-tile-swatch {
  display: inline-block;
  flex-shrink: 0;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 0.25rem;
  border: 1px solid var(--nd-border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .nd-loom-tile { transition: none; }
}

/* ---------- World: Creatures placeholder + Locations map ---------- */
.nd-loom-placeholder {
  background: var(--nd-surface-soft);
  border: 1px dashed var(--nd-border);
  border-radius: 1rem;
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--nd-text-soft);
  font-size: 0.88rem;
  line-height: 1.6;
}
.nd-loom-placeholder p { margin: 0 0 0.5rem; }
.nd-loom-placeholder p:last-child { margin-bottom: 0; }

.nd-loom-map-wrap {
  border-radius: 1.1rem;
  overflow: hidden;
  box-shadow: 0 6px 18px var(--nd-shadow);
  margin-bottom: 0.75rem;
}
.nd-loom-map-link { position: relative; display: block; }
.nd-loom-map-img { width: 100%; display: block; }
.nd-loom-map-hint {
  position: absolute;
  left: 50%;
  bottom: 0.75rem;
  transform: translateX(-50%);
  background: var(--nd-surface);
  color: var(--nd-text);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  box-shadow: 0 3px 8px var(--nd-shadow);
  white-space: nowrap;
}
.nd-loom-map-note {
  font-size: 0.78rem;
  color: var(--nd-text-soft);
  text-align: center;
  margin: 0;
}

/* ---------- Updates feed ---------- */
.nd-loom-update-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.nd-loom-update-card {
  background: var(--nd-surface);
  border: 1px solid var(--nd-border);
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  box-shadow: 0 3px 8px var(--nd-shadow);
}
.nd-loom-update-card.is-milestone { border-color: var(--nd-accent); }
.nd-loom-update-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--nd-accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}
.nd-loom-update-date {
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--nd-text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nd-loom-update-title {
  margin: 0 0 0.35rem;
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--nd-text);
}
.nd-loom-update-card.is-milestone .nd-loom-update-title { color: var(--nd-accent); }
.nd-loom-update-body { margin: 0; font-size: 0.88rem; line-height: 1.5; color: var(--nd-text); }
.nd-loom-update-empty { text-align: center; padding: 1.5rem 1rem; color: var(--nd-text-soft); font-size: 0.85rem; }

/* ---------- Modal content — poems, About prose, game tips ----------
   The modal SHELL (.nd-modal / .nd-modal-panel / .nd-modal-header
   etc.) comes from neur0doku-modals.css. Everything below only
   styles what gets injected into .nd-modal-body. */

.nd-loom-modal-caption {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--nd-text-soft);
  margin: 0 0 0.75rem;
}

.nd-loom-poem {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--nd-text);
  background: var(--nd-surface-soft);
  border-left: 3px solid var(--nd-accent);
  border-radius: 0 0.6rem 0.6rem 0;
  padding: 0.6rem 0.9rem;
  margin: 0 0 0.5rem;
}
.nd-loom-poem-note {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--nd-text-soft);
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.nd-loom-modal-tip-img {
  width: 100%;
  border-radius: 0.8rem;
  margin-bottom: 0.75rem;
  display: block;
}

/* About prose, injected as .nd-loom-about wrapper */
.nd-loom-about h3 {
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--nd-text);
  margin: 1.25rem 0 0.4rem;
}
.nd-loom-about h3:first-child { margin-top: 0; }
.nd-loom-about h4 {
  font-family: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--nd-text);
  margin: 1rem 0 0.35rem;
}
.nd-loom-about p {
  font-size: 0.87rem;
  line-height: 1.6;
  color: var(--nd-text);
  margin: 0 0 0.7rem;
}
.nd-loom-about ul {
  margin: 0 0 0.8rem;
  padding-left: 1.2rem;
  color: var(--nd-text);
}
.nd-loom-about li {
  font-size: 0.87rem;
  line-height: 1.5;
  margin-bottom: 0.3rem;
}
.nd-loom-closing {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--nd-border);
  text-align: center;
  font-style: italic;
  font-weight: 600;
  color: var(--nd-accent) !important;
  line-height: 1.6 !important;
}