/* NEO guide (js/neo-guide.js, 2026-11-14): a round "N" in the bottom-left corner opens a small console of questions and
   answers. On phones the console becomes a sheet across the bottom of the screen, over a dimmed page. The guide keeps
   its own dark colours (the light theme does not change it), so tiffany and gold are written out here. */
.neo-guide {
  --guide-tiffany: #78f7e8;
  --guide-gold: #ffe27a;
  --guide-line: rgba(120, 247, 232, .22);
  position: fixed;
  left: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  font-family: 'Noto Sans JP', sans-serif;
}

/* ---- The corner button ---- */
.neo-guide-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 4px 18px 4px 4px;
  border: 1px solid rgba(120, 247, 232, .5);
  border-radius: 999px;
  background: rgba(4, 9, 12, .94);
  color: #fff;
  font: 700 .875rem/1 'Noto Sans JP', sans-serif;
  letter-spacing: .08em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45), 0 0 18px rgba(120, 247, 232, .16);
  transition: border-color .2s ease, box-shadow .2s ease, transform .12s ease;
}
.neo-guide-toggle:hover { border-color: var(--guide-tiffany); box-shadow: 0 8px 24px rgba(0, 0, 0, .45), 0 0 24px rgba(120, 247, 232, .3); }
.neo-guide-toggle:active { transform: scale(.97); }
.neo-guide-toggle:focus-visible, .neo-guide-panel button:focus-visible, .neo-guide-go:focus-visible, .neo-guide-form:focus-within {
  outline: 2px solid var(--guide-gold);
  outline-offset: 2px;
}
.neo-guide-form input:focus-visible { outline: 0; }
.neo-guide.is-open .neo-guide-toggle { display: none; }

/* The face: an "N" inside a ring of light that turns slowly while motion is on. */
.neo-guide-face {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(120, 247, 232, .32), #02070a 72%);
  color: var(--guide-tiffany);
  font: 700 1.125rem/1 'Chakra Petch', sans-serif;
  text-shadow: 0 0 8px rgba(120, 247, 232, .8);
}
.neo-guide-face::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--guide-tiffany), rgba(120, 247, 232, .1) 35%, var(--guide-gold) 55%, rgba(120, 247, 232, .1) 75%, var(--guide-tiffany));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
}
html[data-motion="on"] .neo-guide-face::before { animation: neo-guide-turn 6s linear infinite; }
html[data-motion="on"] .neo-guide-toggle .neo-guide-face { animation: neo-guide-pulse 3.2s ease-in-out infinite; }
@keyframes neo-guide-turn { to { transform: rotate(1turn); } }
@keyframes neo-guide-pulse { 50% { box-shadow: 0 0 0 5px rgba(120, 247, 232, .1), 0 0 16px rgba(120, 247, 232, .5); } }

/* ---- The console ---- */
.neo-guide-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(392px, calc(100vw - 32px));
  max-height: min(620px, calc(100dvh - 120px));
  overflow: hidden;
  border: 1px solid rgba(120, 247, 232, .4);
  background:
    linear-gradient(rgba(120, 247, 232, .035) 1px, transparent 1px) 0 0 / 100% 24px,
    linear-gradient(90deg, rgba(120, 247, 232, .035) 1px, transparent 1px) 0 0 / 24px 100%,
    radial-gradient(ellipse 90% 50% at 0 0, rgba(120, 247, 232, .1), transparent 70%),
    #03080b;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .6), 0 0 32px rgba(120, 247, 232, .1);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
}
.neo-guide-panel[hidden] { display: none; }
/* A line of light along the top edge, tiffany into gold, with a glint that crosses it. */
.neo-guide-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 18px;
  z-index: 1;
  height: 2px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, .9), transparent) -40% 0 / 30% 100% no-repeat,
    linear-gradient(90deg, var(--guide-tiffany), var(--guide-gold) 70%, transparent);
  pointer-events: none;
}
html[data-motion="on"] .neo-guide-panel::before { animation: neo-guide-glint 4.5s ease-in-out infinite; }
@keyframes neo-guide-glint {
  0%, 35% { background-position: -40% 0, 0 0; }
  75%, 100% { background-position: 140% 0, 0 0; }
}
html[data-motion="on"] .neo-guide-panel:not([hidden]) { animation: neo-guide-rise .28s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes neo-guide-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.neo-guide-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 12px 16px; border-bottom: 1px solid var(--guide-line); }
.neo-guide-head .neo-guide-face { width: 42px; height: 42px; font-size: 1.25rem; }
.neo-guide-head p { display: flex; flex-direction: column; flex: 1; gap: 3px; min-width: 0; margin: 0; }
.neo-guide-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(120, 247, 232, .85);
  font: 600 .6875rem/1.2 'Chakra Petch', sans-serif;
  letter-spacing: .22em;
}
.neo-guide-online { display: inline-flex; align-items: center; gap: 5px; color: var(--guide-gold); letter-spacing: .16em; }
.neo-guide-online::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #5dffa8; box-shadow: 0 0 8px #5dffa8; }
html[data-motion="on"] .neo-guide-online::before { animation: neo-guide-blink 2s ease-in-out infinite; }
@keyframes neo-guide-blink { 50% { opacity: .35; } }
.neo-guide-head strong { color: #fff; font-size: 1.0625rem; letter-spacing: .04em; }
.neo-guide-close {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 226, 122, .45);
  background: rgba(255, 226, 122, .04);
  color: #fff;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  transition: background-color .2s ease, border-color .2s ease;
}
.neo-guide-close:hover { border-color: var(--guide-gold); background: rgba(255, 226, 122, .12); }

/* ---- The conversation ---- */
.neo-guide-log { display: flex; flex-direction: column; gap: 12px; min-height: 120px; padding: 16px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(120, 247, 232, .3) transparent; }
.neo-guide-msg { position: relative; max-width: 90%; padding: 10px 14px 12px; font-size: .9375rem; line-height: 1.7; }
.neo-guide-msg::before { display: block; margin-bottom: 4px; font: 600 .625rem/1 'Chakra Petch', sans-serif; letter-spacing: .24em; }
.neo-guide-msg.is-neo {
  align-self: flex-start;
  border: 1px solid rgba(120, 247, 232, .28);
  border-left: 2px solid var(--guide-tiffany);
  background: linear-gradient(100deg, rgba(120, 247, 232, .1), rgba(120, 247, 232, .02) 70%);
  color: #f4fbfa;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
}
.neo-guide-msg.is-neo::before { content: "NEO //"; color: var(--guide-tiffany); }
.neo-guide-msg.is-you {
  align-self: flex-end;
  border: 1px solid rgba(255, 226, 122, .35);
  border-right: 2px solid var(--guide-gold);
  background: rgba(255, 226, 122, .07);
  color: #fff;
  text-align: left;
}
.neo-guide-msg.is-you::before { content: "YOU"; color: var(--guide-gold); text-align: right; }
.neo-guide-msg.is-typing::after { content: "▍"; color: var(--guide-tiffany); }
html[data-motion="on"] .neo-guide-msg.is-typing::after { animation: neo-guide-caret .8s steps(2, jump-none) infinite; }
@keyframes neo-guide-caret { 50% { opacity: 0; } }
.neo-guide-go {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 12px;
  border: 1px solid rgba(120, 247, 232, .45);
  background: rgba(120, 247, 232, .08);
  color: var(--guide-tiffany);
  font-weight: 700;
  font-size: .875rem;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease;
}
.neo-guide-go::after { content: "→"; font-family: 'Chakra Petch', sans-serif; transition: transform .2s ease; }
.neo-guide-go:hover { background: var(--guide-tiffany); color: #03211e; }
.neo-guide-go:hover::after { transform: translateX(3px); }

/* ---- The questions: numbered like a console menu ---- */
.neo-guide-asks { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 16px 14px; counter-reset: ask; }
.neo-guide-asks button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 14px 6px 10px;
  border: 1px solid rgba(120, 247, 232, .32);
  background: rgba(3, 8, 11, .8);
  color: #f4fbfa;
  font: 500 .875rem/1.3 'Noto Sans JP', sans-serif;
  text-align: left;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.neo-guide-asks button::before {
  counter-increment: ask;
  content: counter(ask, decimal-leading-zero);
  color: var(--guide-gold);
  font: 600 .6875rem/1 'Chakra Petch', sans-serif;
  letter-spacing: .08em;
}
.neo-guide-asks button:hover { border-color: var(--guide-tiffany); background: rgba(120, 247, 232, .12); }
.neo-guide-asks button:active { background: rgba(120, 247, 232, .22); }

/* ---- The input line, like a command prompt ---- */
.neo-guide-form {
  display: flex;
  align-items: center;
  margin: 0 16px 16px;
  border: 1px solid rgba(120, 247, 232, .35);
  background: #010507;
}
.neo-guide-prompt { flex: none; padding-left: 12px; color: var(--guide-tiffany); font: 700 1rem/1 'Chakra Petch', sans-serif; }
.neo-guide-form input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1rem;
  caret-color: var(--guide-tiffany);
}
.neo-guide-form input::placeholder { color: rgba(232, 240, 239, .45); }
.neo-guide-form button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  background: var(--guide-tiffany);
  color: #03211e;
  font: 700 .9375rem/1 'Noto Sans JP', sans-serif;
  cursor: pointer;
  transition: filter .2s ease;
}
.neo-guide-form button:hover { filter: brightness(1.1); }
.neo-guide-form button:active { filter: brightness(.92); }

/* The dimmed page behind the sheet on phones; a tap on it closes the guide. */
.neo-guide-scrim { display: none; }

/* Phones: the button sits clear of the sound button, and the console is a sheet across the bottom. */
@media (max-width: 760px) {
  .neo-guide { left: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .neo-guide-toggle { min-height: 52px; }
  .neo-guide.is-open { left: 0; right: 0; bottom: 0; }
  .neo-guide.is-open .neo-guide-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(0, 3, 5, .62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
  }
  /* The open sheet covers the corner where the sound button floats. */
  html.neo-guide-open .sound-toggle--float { display: none; }
  .neo-guide-panel { width: 100%; max-height: 80dvh; padding-bottom: env(safe-area-inset-bottom, 0px); border-width: 1px 0 0; clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%); }
  .neo-guide-panel::before { right: 22px; }
  .neo-guide-asks button { font-size: .9375rem; }
}
/* The site's own menu and dialogs cover the guide while they are open. */
body.nav-open .neo-guide, html.neo-os-open .neo-guide { display: none; }
@media (prefers-reduced-motion: reduce) {
  .neo-guide *, .neo-guide *::before, .neo-guide *::after { animation: none !important; }
}

/* 2026-11-15: while the home page's row of discipline tiles fills the bottom of a phone, the corner button steps aside
   (js/neo-guide.js), and comes back as soon as the visitor scrolls on. */
.neo-guide { transition: opacity 200ms ease, transform 200ms ease, visibility 0s linear 0s; }
.neo-guide.is-tucked {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease, visibility 0s linear 200ms;
}
