/*
 * PiXiEED Design System
 *
 * Shared visual foundation for the public site, future tools, and games.
 * The existing page styles stay responsible for layout details; this layer
 * supplies the common app-like tone, tokens, surfaces, controls, and motion.
 */
:root {
  --pixieed-bg: #f7f8f6;
  --pixieed-surface: #ffffff;
  --pixieed-surface-muted: #eef1ef;
  --pixieed-ink: #1b2025;
  --pixieed-muted: #737b83;
  --pixieed-line: rgba(27, 32, 37, .11);
  --pixieed-accent: #e75445;
  --pixieed-link: #315fd0;
  --pixieed-dark: #17232d;
  --pixieed-header-height: 64px;
  --pixieed-radius-sm: 8px;
  --pixieed-radius-md: 16px;
  --pixieed-radius-lg: 22px;
  --pixieed-content-max: 1200px;
  --pixieed-ease: cubic-bezier(.2, .8, .2, 1);

  --paper: var(--pixieed-bg);
  --paper-deep: var(--pixieed-surface-muted);
  --white: var(--pixieed-surface);
  --ink: var(--pixieed-ink);
  --ink-soft: var(--pixieed-muted);
  --line: var(--pixieed-line);
  --blue: var(--pixieed-link);
  --blue-deep: var(--pixieed-dark);
  --coral: var(--pixieed-accent);
  --shadow: 0 18px 48px rgba(27, 32, 37, .08);
  --radius-sm: var(--pixieed-radius-sm);
  --radius-md: var(--pixieed-radius-md);
  --radius-lg: var(--pixieed-radius-lg);
  --max: var(--pixieed-content-max);
  --header-h: var(--pixieed-header-height);
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

html {
  scroll-padding-top: calc(var(--pixieed-header-height) + 1rem);
}

body {
  background: var(--pixieed-bg);
  color: var(--pixieed-ink);
  letter-spacing: .005em;
}

body::before { display: none; }

h1, h2, h3 {
  font-family: inherit;
  font-weight: 750;
  letter-spacing: -.035em;
}

h1 { font-size: clamp(2.45rem, 6.5vw, 5.4rem); }
h2 { font-size: clamp(1.9rem, 4.5vw, 3.4rem); }

.container { width: min(var(--pixieed-content-max), calc(100% - 3rem)); }
.narrow { width: min(780px, calc(100% - 3rem)); }
.section { padding-block: clamp(3.5rem, 7vw, 6rem); }
.section--tight { padding-block: clamp(2.2rem, 5vw, 3.5rem); }
.section--paper-deep { background: var(--pixieed-surface-muted); }

.eyebrow {
  gap: .35rem;
  margin-bottom: .8rem;
  color: var(--pixieed-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .68rem;
  letter-spacing: .11em;
}

.eyebrow::before { display: none; }
.lead { color: var(--pixieed-muted); }

/* Shared app shell */
.site-header {
  min-height: var(--pixieed-header-height);
  border-bottom: 0;
  background: rgba(247, 248, 246, .97);
  box-shadow: 0 1px 0 rgba(27, 32, 37, .035);
}

.header-inner { min-height: var(--pixieed-header-height); }

.brand {
  gap: .55rem;
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: .015em;
}

.brand-mark {
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: .45rem;
  color: #fff;
  background: var(--pixieed-accent);
  font-family: inherit;
  font-size: .78rem;
  font-weight: 800;
  transform: none;
}

.site-nav { gap: .1rem; }
.site-nav a {
  min-height: 2.4rem;
  padding: .55rem .65rem;
  border-radius: .55rem;
  color: var(--pixieed-muted);
  font-size: .82rem;
  transition: color .18s var(--pixieed-ease), background .18s var(--pixieed-ease);
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current='page'] {
  color: var(--pixieed-ink);
  background: transparent;
}

.site-nav a[aria-current='page']::after {
  right: .65rem;
  bottom: .18rem;
  left: .65rem;
  height: 2px;
  border-radius: 999px;
  background: var(--pixieed-accent);
}

.site-nav__secondary,
.site-nav__secondary:hover,
.site-nav__secondary:focus-visible,
.site-nav__secondary[aria-current='page'] {
  margin-left: .45rem;
  padding-inline: .35rem !important;
  border: 0;
  color: var(--pixieed-accent) !important;
  background: transparent !important;
}

.site-nav__secondary[aria-current='page']::after { display: none; }

.mobile-nav {
  border: 0;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 12px 32px rgba(27, 32, 37, .12);
}

.mobile-nav a { border-radius: 12px; }
.mobile-nav a[aria-current='page'] { color: var(--pixieed-accent); background: rgba(231, 84, 69, .08); }

/* Controls */
.button {
  min-height: 2.75rem;
  padding: .68rem .95rem;
  border: 0;
  border-radius: .65rem;
  box-shadow: none;
  transition: transform .18s var(--pixieed-ease), color .18s var(--pixieed-ease), background .18s var(--pixieed-ease);
}

.button:hover { transform: translateY(-1px); }
.button--primary { background: var(--pixieed-accent); box-shadow: none; }
.button--primary:hover { background: #d9483b; }
.button--quiet { color: var(--pixieed-ink); border: 0; background: var(--pixieed-surface-muted); }
.button--quiet:hover { border: 0; background: #e4e9e6; }
.button--light { color: var(--pixieed-dark); background: #fff; }
.button--like, .button--stamp { border: 0; }

.button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(49, 95, 208, .35);
  outline-offset: 3px;
}

.tag {
  min-height: 1.65rem;
  padding: .25rem .55rem;
  border: 0;
  border-radius: .45rem;
  background: var(--pixieed-surface-muted);
}

.tag--accent, .tag--event { border: 0; background: rgba(231, 84, 69, .09); }
.tag--sample, .tag--event-kind { border: 0; background: rgba(49, 95, 208, .08); }

input, select, textarea {
  border: 0 !important;
  border-radius: .65rem !important;
  background: var(--pixieed-surface-muted) !important;
}

/* Borderless content surfaces */
.page-hero { padding-block: clamp(3rem, 7vw, 5rem) 2.5rem; border-bottom: 0; }
.app-page:not(.app-page--field) .page-hero { padding-block: clamp(2.5rem, 5vw, 4rem) 1.8rem; }
.filter-bar { border: 0; border-radius: var(--pixieed-radius-md); background: var(--pixieed-surface); box-shadow: none; }

.art-card,
.store-card,
.market-card,
.route-card,
.tool-card,
.shop-panel:not(.shop-panel--dark),
.store-mini,
.progress-card,
.contact-card,
.faq-list details,
.collection-item {
  border: 0;
  border-radius: var(--pixieed-radius-md);
  background: var(--pixieed-surface);
  box-shadow: none;
}

.art-card:hover,
.art-card:focus-within,
.store-card:hover,
.store-card:focus-within,
.market-card:hover,
.market-card:focus-within,
.tool-card:hover,
.tool-card:focus-within {
  box-shadow: 0 14px 32px rgba(27, 32, 37, .08);
  transform: translateY(-2px);
}

.art-card__image,
.market-card__image,
.collection-item__image { background: var(--pixieed-surface-muted); }
.market-card__meta { padding-top: .45rem; border-top: 0; }
.feature-note { border: 0; background: rgba(255, 255, 255, .06); }
.today-card { border: 0; box-shadow: none; }

.step-list li::before { border: 0; background: var(--pixieed-surface-muted); }
.empty-state, .collection-empty { border: 1px dashed var(--pixieed-line); background: transparent; }
.tool-note { border-top: 0; padding-inline: 0; }
.site-footer { border-top: 0; }

/* A small vocabulary for future tools and games. */
.pixieed-shell { min-height: 100svh; background: var(--pixieed-bg); }
.pixieed-stage { min-height: 320px; border-radius: var(--pixieed-radius-lg); background: var(--pixieed-surface); }
.pixieed-toolbar { display: flex; align-items: center; gap: .5rem; padding: .65rem; border-radius: .8rem; background: var(--pixieed-surface); }
.pixieed-sheet { border: 0; border-radius: var(--pixieed-radius-lg); background: var(--pixieed-surface); box-shadow: var(--shadow); }
.pixieed-control { display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; padding: .55rem .7rem; border: 0; border-radius: .6rem; color: var(--pixieed-ink); background: transparent; }
.pixieed-control:hover, .pixieed-control[aria-pressed='true'], .pixieed-control[aria-selected='true'] { background: var(--pixieed-surface-muted); }
.pixieed-control--accent { color: var(--pixieed-accent); }

@media (max-width: 860px) {
  :root { --pixieed-header-height: 60px; --header-h: var(--pixieed-header-height); }
  .container, .narrow { width: min(100% - 2rem, var(--pixieed-content-max)); }
  .site-nav__secondary { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Visual-first discovery surfaces: the map and cards carry the meaning. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.map-explorer__top--visual {
  align-items: center;
  justify-content: flex-start;
  min-height: 2.75rem;
  margin-bottom: .9rem;
}

.map-explorer__visual-stack {
  position: relative;
  display: inline-block;
  width: 2.1rem;
  height: 2.1rem;
  margin-right: .25rem;
  transform: rotate(-8deg);
}

.map-explorer__visual-stack i {
  position: absolute;
  display: block;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: .35rem;
  background: var(--pixieed-accent);
  box-shadow: 0 0 0 3px var(--pixieed-bg);
}

.map-explorer__visual-stack i:nth-child(1) { top: .1rem; left: .05rem; opacity: .42; }
.map-explorer__visual-stack i:nth-child(2) { top: .35rem; left: .38rem; opacity: .7; }
.map-explorer__visual-stack i:nth-child(3) { top: .6rem; left: .72rem; opacity: 1; }

.map-explorer__visual-counts {
  display: flex;
  align-items: stretch;
  gap: .35rem;
}

.map-explorer__visual-counts span {
  display: inline-grid;
  min-width: 3.7rem;
  gap: .08rem;
  padding: .38rem .55rem .34rem;
  border-radius: .7rem;
  background: var(--pixieed-surface);
  color: var(--pixieed-ink-muted);
  text-align: center;
}

.map-explorer__visual-counts strong {
  color: var(--pixieed-ink);
  font-family: 'DM Mono', monospace;
  font-size: .92rem;
  font-weight: 650;
  line-height: 1;
}

.map-explorer__visual-counts small {
  font-size: .62rem;
  line-height: 1.1;
}

.map-explorer__legend span[title] { cursor: help; }

@media (max-width: 560px) {
  .map-explorer__top--visual { margin-bottom: .65rem; }
  .map-explorer__visual-stack { transform: scale(.88) rotate(-8deg); transform-origin: left center; }
  .map-explorer__visual-counts span { min-width: 3.35rem; padding-inline: .4rem; }
}

/* Unified public app shell: three destinations, everything else in the menu. */
.app-page { padding-bottom: calc(5.4rem + env(safe-area-inset-bottom)); }
.app-page .header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.app-page .site-nav { display: none; }
.app-tabs { position: fixed; right: 50%; bottom: max(.7rem, env(safe-area-inset-bottom)); z-index: 30; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .18rem; width: min(28rem, calc(100% - 1.2rem)); padding: .35rem; border: 0; border-radius: 1.1rem; background: rgba(255, 255, 255, .98); box-shadow: 0 12px 34px rgba(27, 32, 37, .16); transform: translateX(50%); }
.app-tabs a { display: grid; gap: .12rem; place-items: center; min-height: 3.1rem; border-radius: .8rem; color: var(--pixieed-muted); font-size: .67rem; text-decoration: none; transition: color .18s var(--pixieed-ease), background .18s var(--pixieed-ease), transform .18s var(--pixieed-ease); }
.app-tabs a span { font-size: 1.1rem; line-height: 1; }
.app-tabs a strong { font-size: .68rem; font-weight: 650; }
.app-tabs a:hover, .app-tabs a:focus-visible { color: var(--pixieed-ink); transform: translateY(-1px); }
.app-tabs a[aria-current='page'] { color: var(--pixieed-accent); background: rgba(231, 84, 69, .09); }
body.is-menu-open { overflow: hidden; overscroll-behavior: none; }
.menu-toggle { display: grid; place-items: center; width: 2.55rem; height: 2.55rem; padding: 0; border: 0; border-radius: .72rem; color: var(--pixieed-ink); background: transparent; cursor: pointer; }
.menu-toggle:hover, .menu-toggle:focus-visible { color: var(--pixieed-accent); background: rgba(231, 84, 69, .08); }
.menu-toggle__lines { display: grid; gap: .25rem; width: 1.1rem; }
.menu-toggle__lines i { display: block; height: 1.5px; border-radius: 999px; background: currentColor; transition: transform .2s ease, opacity .2s ease; }
.is-menu-open .menu-toggle__lines i:nth-child(1) { transform: translateY(.35rem) rotate(45deg); }
.is-menu-open .menu-toggle__lines i:nth-child(2) { opacity: 0; }
.is-menu-open .menu-toggle__lines i:nth-child(3) { transform: translateY(-.35rem) rotate(-45deg); }
.site-menu-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(16, 24, 30, .30); }
.site-menu-backdrop[hidden], .site-menu[hidden] { display: none; }
.site-menu { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; display: grid; align-content: start; width: min(22.5rem, 100vw); padding: 1.4rem 1.25rem calc(6rem + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; color: var(--pixieed-ink); background: rgba(247, 248, 246, .98); box-shadow: -18px 0 45px rgba(27, 32, 37, .12); animation: pixieed-menu-in .24s var(--pixieed-ease) both; }
.site-menu__head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.site-menu__head h2 { margin: .15rem 0 0; font-size: 1.6rem; }
.site-menu__close { display: grid; place-items: center; width: 2.35rem; height: 2.35rem; padding: 0; border: 0; border-radius: 50%; color: var(--pixieed-muted); background: var(--pixieed-surface-muted); font-size: 1.35rem; line-height: 1; cursor: pointer; }
.site-menu__close:hover, .site-menu__close:focus-visible { color: var(--pixieed-accent); }
.site-menu__profile { display: flex; align-items: center; gap: .75rem; min-height: 4.3rem; padding: .75rem; border-radius: 1rem; color: inherit; background: var(--pixieed-surface-muted); text-decoration: none; }
.site-menu__profile > span:nth-child(2) { display: grid; flex: 1; gap: .18rem; }
.site-menu__profile strong { font-size: .9rem; }
.site-menu__profile small { color: var(--pixieed-muted); font-size: .72rem; }
.site-menu__avatar, .profile-avatar { display: grid; place-items: center; width: 2.35rem; height: 2.35rem; border-radius: .65rem; color: #fff; background: var(--pixieed-accent); font-size: .82rem; font-weight: 800; }
.site-menu__nav { display: grid; gap: 1.1rem; margin-top: 1.35rem; }
.site-menu__group { display: grid; gap: .12rem; }
.site-menu__label { margin: 0 0 .25rem .15rem; color: var(--pixieed-muted); font-size: .65rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.site-menu__group a, .site-menu__group button { display: flex; align-items: center; min-height: 2.55rem; padding: .5rem .65rem; border: 0; border-radius: .65rem; color: var(--pixieed-ink); background: transparent; font: inherit; font-size: .84rem; text-align: left; text-decoration: none; cursor: pointer; }
.site-menu__group a:hover, .site-menu__group a:focus-visible, .site-menu__group button:hover, .site-menu__group button:focus-visible { color: var(--pixieed-accent); background: rgba(231, 84, 69, .07); }
.profile-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; }
.profile-head h1 { margin: .15rem 0 .45rem; font-size: clamp(2.2rem, 6vw, 4.2rem); }
.profile-tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 2rem; }
.profile-tabs a { padding: .55rem .75rem; border-radius: .7rem; color: var(--pixieed-muted); font-size: .78rem; text-decoration: none; }
.profile-tabs a:hover, .profile-tabs a:focus-visible, .profile-tabs a[aria-current='page'] { color: var(--pixieed-accent); background: rgba(231, 84, 69, .08); }
.profile-content { min-height: 12rem; }
.profile-content h2 { margin-bottom: 1rem; font-size: 1.15rem; }
.profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.profile-card { display: grid; gap: .4rem; min-height: 8rem; padding: 1rem; border-radius: .9rem; color: inherit; background: var(--pixieed-surface-muted); text-decoration: none; transition: transform .18s var(--pixieed-ease), background .18s var(--pixieed-ease); }
.profile-card:hover, .profile-card:focus-visible { background: rgba(231, 84, 69, .08); transform: translateY(-2px); }
.profile-card strong { font-family: 'DM Mono', monospace; font-size: 1.35rem; }
.profile-card > span:last-child { color: var(--pixieed-muted); font-size: .74rem; }
.profile-record { display: grid; gap: .7rem; max-width: 32rem; padding: 1.25rem; border-radius: 1rem; background: var(--pixieed-surface-muted); }
.profile-record strong { font-size: 1.25rem; }
.profile-record p { margin: 0; color: var(--pixieed-muted); line-height: 1.7; }
.profile-note { margin-top: 2rem; color: var(--pixieed-muted); font-size: .72rem; }
.map-work button, button.map-work { width: 100%; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.map-work--detail { cursor: default; }
@keyframes pixieed-menu-in { from { opacity: 0; transform: translateX(1.1rem); } to { opacity: 1; transform: translateX(0); } }

@media (max-width: 620px) {
  .profile-head { align-items: start; }
  .profile-grid { grid-template-columns: 1fr; }
  .site-menu { width: min(22.5rem, 88vw); padding-top: max(1.25rem, calc(env(safe-area-inset-top) + .75rem)); padding-right: 1rem; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); padding-left: 1rem; border-radius: 0; animation-name: pixieed-menu-in; }
}

@media (prefers-reduced-motion: reduce) {
  .site-menu, .app-tabs a, .menu-toggle__lines i { animation: none; transition: none; }
}

/* 固定UIは不透明な面で描画し、スクロール中の再合成コストを抑える。 */
@media (hover: none), (pointer: coarse) {
  .site-header { background: rgba(247, 248, 246, .97); }
  .app-tabs { background: rgba(255, 255, 255, .98); }
  .site-menu-backdrop { background: rgba(16, 24, 30, .32); }
}
