@import url("https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+New:wght@400;500;700;900&family=DotGothic16&display=swap");

:root {
  --navy: #14263d;
  --navy-deep: #0c1728;
  --grid-line: rgba(154, 196, 224, 0.14);
  --grid-line-strong: rgba(154, 196, 224, 0.26);
  --paper: #ede3cd;
  --paper-edge: #c9bb98;
  --ink: #241c14;
  --ink-soft: #6b6046;
  --amber: #e8952f;
  --amber-deep: #a9660f;
  --steel: #3d6b8f;
  --cream: #f4efe4;
  --cream-dim: rgba(244, 239, 228, 0.68);
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--navy);
  color: var(--cream);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.sheet {
  position: relative;
  min-height: 100vh;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    linear-gradient(var(--grid-line-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-strong) 1px, transparent 1px),
    radial-gradient(ellipse at 50% -10%, var(--navy) 0%, var(--navy-deep) 78%);
  background-size: 16px 16px, 16px 16px, 96px 96px, 96px 96px, 100% 100%;
  overflow-x: hidden;
}

.bg-icons {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.bg-icons svg {
  position: absolute;
  color: var(--cream);
  opacity: 0.055;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cream-dim);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  margin-bottom: 48px;
}
.mark svg {
  width: 22px;
  height: 22px;
  color: var(--amber);
  flex-shrink: 0;
}
.mark span {
  flex: 1;
}
.mark a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 239, 228, 0.3);
}
.mark a:hover {
  border-color: var(--amber);
  color: var(--cream);
}
.mark .list-link {
  flex-shrink: 0;
  padding: 7px 18px;
  border: none;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--amber);
  color: var(--navy-deep);
}
.mark .list-link:hover {
  background: #f2a747;
  color: var(--navy-deep);
}

/* ---------- hero ---------- */

.hero {
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 6.5vw, 2.5rem);
  font-weight: 900;
  line-height: 1.45;
  letter-spacing: 0.01em;
  margin: 0 0 14px;
}
.hero h1 a {
  color: inherit;
  text-decoration: none;
}
.hero h1 a:hover {
  color: var(--amber);
}

.hero p.lead {
  color: var(--cream-dim);
  font-size: 0.95rem;
  margin: 0 0 36px;
}

.dial {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: var(--navy-deep);
  border: 1px solid rgba(154, 196, 224, 0.3);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.dial .step {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 1px solid rgba(154, 196, 224, 0.35);
  background: transparent;
  color: var(--cream);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dial .step:hover {
  border-color: var(--amber);
  background: rgba(232, 149, 47, 0.12);
}
.dial .step:active {
  transform: translateY(1px);
}

.dial label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.dial .unit {
  font-size: 0.7rem;
  color: var(--cream-dim);
}

#year {
  width: 130px;
  background: transparent;
  border: none;
  color: var(--amber);
  font-family: "DotGothic16", "Zen Kaku Gothic New", monospace;
  font-size: 2.1rem;
  letter-spacing: 0.08em;
  text-align: center;
  -moz-appearance: textfield;
}
#year::-webkit-outer-spin-button,
#year::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#year:focus {
  outline: none;
}
#year:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
  border-radius: 2px;
}

.range-row {
  max-width: 420px;
  margin: 18px auto 0;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--amber);
  cursor: pointer;
}
.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--cream-dim);
  margin-top: 4px;
}

.options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin: 20px 0 0;
  font-size: 0.85rem;
  color: var(--cream-dim);
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--amber);
  cursor: pointer;
}

.submit {
  display: inline-block;
  margin-top: 28px;
  padding: 13px 34px;
  background: var(--amber);
  color: var(--navy-deep);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.submit:hover {
  background: #f2a747;
}
.submit:active {
  transform: translateY(1px);
}
.submit:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

/* ---------- result card ---------- */

.result {
  margin-top: 56px;
}
.result[hidden] {
  display: none;
}

.card {
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  padding: 30px 26px 26px;
  box-shadow: 0 18px 40px rgba(6, 12, 22, 0.45);
}
.card ~ .ledger {
  margin-top: 24px;
}
.card.replay {
  animation: stamp-in 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes stamp-in {
  0% {
    opacity: 0;
    transform: scale(0.92) rotate(-1deg);
  }
  60% {
    opacity: 1;
    transform: scale(1.02) rotate(0.3deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--paper-edge);
  padding-bottom: 10px;
  margin-bottom: 18px;
  font-family: "DotGothic16", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.card-head .file-no {
  color: var(--amber-deep);
}

.fallback-note {
  background: rgba(169, 102, 15, 0.1);
  border: 1px solid rgba(169, 102, 15, 0.3);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.robot-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.robot-icon {
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  border: 1px solid var(--paper-edge);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(36, 28, 20, 0.03);
}
.robot-icon svg {
  width: 52px;
  height: 52px;
  color: var(--ink);
}

.robot-main h2 {
  margin: 0 0 2px;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.3;
}
.robot-main .name-en {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

.spec {
  list-style: none;
  margin: 16px 0;
  padding: 14px 0 0;
  border-top: 1px dashed var(--paper-edge);
  display: grid;
  grid-template-columns: auto 1fr;
  row-gap: 6px;
  column-gap: 14px;
  font-size: 0.88rem;
}
.spec dt {
  color: var(--ink-soft);
}
.spec dd {
  margin: 0;
  font-weight: 500;
}

.blurb {
  margin: 16px 0 0;
  font-size: 0.95rem;
}

.share-option {
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}
.share-option[hidden] {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s;
}
.btn:hover {
  opacity: 0.85;
}
.btn-share {
  background: var(--ink);
  color: var(--cream);
}
.btn-share svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}
.btn-image {
  background: transparent;
  border-color: var(--ink-soft);
  color: var(--ink);
}
.btn-image svg {
  width: 16px;
  height: 16px;
}
.btn-amazon {
  background: #ff9900;
  color: #14263d;
}
.btn-amazon svg {
  width: 16px;
  height: 16px;
}
/* ---------- filter bar + ledger (list.html / search results) ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-pill {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(154, 196, 224, 0.35);
  background: transparent;
  color: var(--cream-dim);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.filter-pill:hover {
  border-color: var(--amber);
}
.filter-pill.is-active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--navy-deep);
  font-weight: 700;
}

.ledger {
  background: var(--paper);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(6, 12, 22, 0.4);
  overflow: hidden;
}

.ledger-row {
  display: grid;
  grid-template-columns: 4.2em 1fr auto;
  gap: 4px 14px;
  align-items: baseline;
  padding: 11px 18px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px dashed var(--paper-edge);
  border-left: 4px solid transparent;
}
button.ledger-row {
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
  border-top: none;
  border-right: none;
  border-bottom: 1px dashed var(--paper-edge);
  appearance: none;
  -webkit-appearance: none;
}
.ledger-row:last-child,
.ledger-row.is-last-visible {
  border-bottom: none;
}
.ledger-row[hidden] {
  display: none;
}
.ledger-row:hover {
  filter: brightness(0.96);
}
.ledger-row.is-selected {
  outline: 2px solid var(--amber);
  outline-offset: -2px;
}

.ledger-year {
  font-family: "DotGothic16", monospace;
  font-size: 1rem;
  color: var(--amber-deep);
}

.ledger-name {
  font-weight: 700;
  font-size: 0.92rem;
}
.ledger-en {
  display: block;
  font-weight: 400;
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.ledger-cat {
  grid-column: 2;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.ledger-kind {
  grid-row: 1 / span 2;
  grid-column: 3;
  align-self: center;
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--paper-edge);
  color: var(--ink-soft);
  white-space: nowrap;
}
.ledger-kind.is-fiction {
  border-color: var(--amber-deep);
  color: var(--amber-deep);
}
.ledger-kind.is-competition {
  border-color: var(--steel);
  color: var(--steel);
}
.ledger-kind.is-exact {
  border-color: var(--amber-deep);
  color: var(--amber-deep);
}

@media (max-width: 420px) {
  .ledger-row {
    grid-template-columns: 3.6em 1fr;
  }
  .ledger-kind {
    grid-row: 3;
    grid-column: 2;
    justify-self: start;
    margin-top: 2px;
  }
}

footer {
  margin-top: 60px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--cream-dim);
}
footer a {
  color: var(--cream-dim);
  border-bottom: 1px solid rgba(244, 239, 228, 0.3);
  text-decoration: none;
}
footer a:hover {
  color: var(--amber);
  border-color: var(--amber);
}
footer .footer-logo {
  display: inline-block;
  border-bottom: none;
  margin-bottom: 16px;
  opacity: 0.85;
  transition: opacity 0.15s;
}
footer .footer-logo:hover {
  opacity: 1;
}
footer .footer-logo img {
  height: 56px;
  width: auto;
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .card.replay {
    animation: none;
  }
}

@media (max-width: 420px) {
  .dial {
    padding: 10px 12px;
    gap: 8px;
  }
  #year {
    width: 108px;
    font-size: 1.7rem;
  }
  .robot-row {
    flex-direction: column;
  }
}
