/* ===========================================================================
   theme.css — design tokens, resets, typography, shared primitives.
   Black ground, neon Great Wave, red rising sun.
   =========================================================================== */

:root {
  --bg: #050507;
  --ink: #eef2f6;
  --dim: #9aa6b2;
  --cyan: #00f0ff;
  --blue: #3d7bff;
  --magenta: #ff2fd0;
  --sun: #ff2b2b;
  --card: rgba(255, 255, 255, .035);
  --line: rgba(0, 240, 255, .22);

  --radius: 14px;
  --gutter: 16px;
  --maxw: 1100px;
  --glow: 0 0 18px rgba(0, 240, 255, .22);
  --glow-strong: 0 0 26px rgba(0, 240, 255, .38), 0 0 60px rgba(61, 123, 255, .16);

  --jp: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --jp-serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --lat: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--lat);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  min-height: 100vh;
  /* faint deep-sea wash behind everything */
  background-image:
    radial-gradient(1200px 520px at 78% -8%, rgba(255, 43, 43, .10), transparent 60%),
    radial-gradient(900px 500px at 12% 0%, rgba(61, 123, 255, .10), transparent 60%);
  background-attachment: fixed;
}

h1, h2, h3, h4 {
  font-family: var(--jp-serif);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 .4em;
  letter-spacing: .01em;
}
h1 { font-size: clamp(1.8rem, 6vw, 3rem); }
h2 { font-size: clamp(1.25rem, 4vw, 1.7rem); }
h3 { font-size: 1.1rem; }

p { margin: 0 0 .9em; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }
code { background: rgba(0, 240, 255, .08); padding: .1em .35em; border-radius: 5px; color: var(--cyan); }
pre.err { white-space: pre-wrap; color: var(--magenta); font-size: .8rem; }

hr { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0; opacity: .6; }

/* ------------------------------------------------------------ utilities */
.jp { font-family: var(--jp); }
.jp-serif { font-family: var(--jp-serif); }
.jp-lg { font-family: var(--jp); font-size: 1.6rem; line-height: 1.5; }
.jp-xl { font-family: var(--jp-serif); font-size: clamp(3.5rem, 14vw, 5rem); line-height: 1.1; }

.dim { color: var(--dim); }
.small { font-size: .82rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: .75rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; }
.sun-text { color: var(--sun); }
.cy { color: var(--cyan); }
.mg { color: var(--magenta); }

.eyebrow {
  font-family: var(--lat);
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cyan);
  opacity: .85;
  margin-bottom: .35rem;
}

.tag {
  display: inline-block;
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .08em .55em;
  vertical-align: middle;
  white-space: nowrap;
}

/* -------------------------------------------------------------- furigana */
ruby { ruby-position: over; }
rt {
  font-size: .5em;
  color: var(--dim);
  font-weight: 400;
  letter-spacing: 0;
}
body.no-furigana rt { display: none; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}
.card.pad { padding: clamp(14px, 3vw, 22px); }
.card:hover, .card:focus-within { border-color: rgba(0, 240, 255, .5); box-shadow: var(--glow); }
.card.tap { cursor: pointer; }
.card.tap:active { transform: translateY(1px); box-shadow: var(--glow-strong); }

/* ---------------------------------------------------------------- buttons */
.btn {
  font-family: var(--lat);
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .5em 1em;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, transform .1s ease;
  line-height: 1.3;
}
.btn:hover:not(:disabled) { border-color: rgba(0, 240, 255, .6); box-shadow: var(--glow); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.solid {
  background: linear-gradient(180deg, rgba(0, 240, 255, .18), rgba(61, 123, 255, .14));
  border-color: rgba(0, 240, 255, .55);
  color: #fff;
}
.btn.solid:hover:not(:disabled) { box-shadow: var(--glow-strong); }
.btn.tiny { font-size: .78rem; padding: .34em .7em; border-radius: 8px; }
.btn.tiny.on { border-color: var(--cyan); box-shadow: var(--glow); color: var(--cyan); }
.btn.ghost-bad { border-color: rgba(255, 47, 208, .38); color: var(--magenta); }
.btn.ghost-bad:hover:not(:disabled) { border-color: var(--magenta); box-shadow: 0 0 18px rgba(255, 47, 208, .25); }
.btn.danger { border-color: rgba(255, 43, 43, .5); color: var(--sun); }

input[type="number"], input[type="text"], select, textarea {
  font-family: var(--lat);
  font-size: .9rem;
  color: var(--ink);
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .4em .6em;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* -------------------------------------------------------------- progress */
.progress {
  height: 4px;
  background: rgba(255, 255, 255, .07);
  border-radius: 999px;
  overflow: hidden;
  margin: .5rem 0 1rem;
}
.progress > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  box-shadow: 0 0 12px rgba(0, 240, 255, .5);
  transition: width .3s ease;
}

/* ------------------------------------------------------------- animations */
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.pop { animation: pop .34s ease; }

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