/* 院内探訪 相性診断 のデザイン（1998年風） 配色: 赤 #bb0001 / ミント #d3f8ed */
:root {
  --red: #bb0001; --red-dark: #6e0001; --mint: #d3f8ed; --mint-deep: #8fd6bf;
  --pink: #ff9db0; --paper: #fffdfa; --ink: #3b0b0e; --hi: #fff;
  --font-jp: "DotGothic16", "MS Gothic", "IPAGothic", "Osaka-Mono", monospace;
  --font-px: "Press Start 2P", "DotGothic16", "MS Gothic", monospace;
}
* { box-sizing: border-box; }
html, body { cursor: url(../img/cursor/arrow.png) 0 0, default; }
a, a *, button, .btn, input[type=text] { cursor: url(../img/cursor/hand.png) 8 0, pointer; }
html.busy, html.busy * { cursor: url(../img/cursor/wait.png) 12 14, wait !important; }
body {
  margin: 0; padding: 14px 12px 28px; color: var(--ink);
  font-family: var(--font-jp); font-size: 15px; line-height: 1.7;
  -webkit-font-smoothing: none;
  background-color: var(--mint);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' shape-rendering='crispEdges'%3E%3Crect width='32' height='32' fill='%23d3f8ed'/%3E%3Crect x='6' y='6' width='2' height='2' fill='%23ffffff'/%3E%3Crect x='22' y='22' width='2' height='2' fill='%23ffffff'/%3E%3C/svg%3E");
}
a { color: var(--red); }
a:hover { background: var(--red); color: var(--mint); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px dashed var(--red); outline-offset: 2px; }
img { max-width: 100%; }

.gwrap {
  max-width: 760px; margin: 0 auto; background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: inset 3px 3px 0 var(--hi), inset -3px -3px 0 var(--mint-deep), 6px 6px 0 var(--red);
}
.ghead {
  background: var(--red); color: var(--mint); border-bottom: 3px solid var(--ink);
  padding: 12px 14px; display: flex; align-items: center; gap: 14px;
  background-image: repeating-linear-gradient(90deg, transparent 0 14px, rgba(255,255,255,.07) 14px 16px);
}
.ghead { position: relative; }
.ghead .logo { flex: 0 0 150px; line-height: 0; background: none; }
.ghead .logo:hover { background: none; }
.ghead .logo img { width: 100%; height: auto; filter: drop-shadow(2px 2px 0 var(--ink)) drop-shadow(4px 4px 0 var(--pink)); }
.gtitle { margin: 0; font-size: 20px; line-height: 1.4; text-shadow: 2px 2px 0 var(--red-dark); }
/* 日本語 / English の切り替えボタン（右上） */
.langsw {
  position: absolute; top: 8px; right: 8px; display: inline-flex;
  border: 2px solid var(--ink); background: var(--paper); box-shadow: 2px 2px 0 var(--red-dark);
}
.langsw button {
  font: inherit; font-size: 12px; line-height: 1.5; padding: 1px 10px; border: 0; border-radius: 0;
  background: var(--paper); color: var(--red); touch-action: manipulation;
}
.langsw button + button { border-left: 2px solid var(--ink); }
.langsw button[aria-pressed="true"] { background: var(--red); color: var(--mint); }
.langsw button:hover { background: var(--pink); color: var(--ink); }
.langsw button:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
html[lang="en"] .gtitle { letter-spacing: 0; }
.gtitle span { display: block; font-size: 12px; margin-top: 4px; color: var(--paper); }
main { padding: 14px; }
.ns { background: #fff3c9; border: 2px solid var(--ink); padding: 8px 10px; }

.btn {
  display: inline-block; text-decoration: none; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--mint-deep), 3px 3px 0 var(--ink);
  padding: 6px 12px; font-family: var(--font-jp); font-size: 14px; line-height: 1.5; text-align: center;
}
.btn:hover { background: var(--pink); color: var(--ink); }
.btn:active { box-shadow: inset 2px 2px 0 var(--mint-deep); transform: translate(3px, 3px); }
.btn.big { font-size: 18px; padding: 10px 22px; }

.screen[hidden] { display: none; }
.title .paper {
  border: 2px solid var(--ink); background: var(--paper); padding: 18px 16px; text-align: center;
  background-image: radial-gradient(var(--mint) 1.5px, transparent 1.5px); background-size: 14px 14px;
}
.lead { margin: 0 0 12px; font-size: 16px; }
.lead b { background: linear-gradient(transparent 55%, var(--pink) 55%); }
.howto { list-style: none; padding: 8px 12px; margin: 0 auto 16px; display: inline-block; text-align: left; font-size: 13px; background: var(--paper); border: 2px dashed var(--red); }
.howto li::before { content: "♥ "; color: var(--red); }
.small { font-size: 12px; margin: 14px 0 0; }

/* お薬手帳バー */
.bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--red); color: var(--mint); border: 2px solid var(--ink); border-bottom: 0; padding: 4px 8px; font-size: 13px; }
.bar-t { font-weight: normal; }
.stamps { display: inline-flex; gap: 3px; }
.stamps i { width: 16px; height: 16px; display: inline-block; background: rgba(255,255,255,.18); border: 1px solid var(--mint); }
.stamps i.on { background: var(--pink); border-color: var(--paper); box-shadow: inset -3px -3px 0 var(--red); }
.hint { margin-left: auto; font-size: 12px; color: var(--paper); }
.hint.blink { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: .35; } }

.canvas-wrap { border: 2px solid var(--ink); background: #222; line-height: 0; }
#cv { width: 100%; height: auto; display: block; image-rendering: pixelated; touch-action: manipulation; }
.dpad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; max-width: 360px; margin-inline: auto; }
.dpad button { font-family: var(--font-jp); font-size: 20px; padding: 8px 0; background: var(--paper); border: 2px solid var(--ink); box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--mint-deep), 3px 3px 0 var(--ink); color: var(--red); touch-action: manipulation; user-select: none; }
.dpad button:active { transform: translate(2px, 2px); box-shadow: inset 2px 2px 0 var(--mint-deep); }
@media (hover: hover) and (min-width: 760px) { .dpad { display: none; } }

/* 会話シーン */
#scene .bar { background: var(--red-dark); }
/* ノベルゲーム風ステージ：背景＋立ち絵、その下半分に会話ウィンドウがかぶさる */
.vnbox { --ar: .5625; border: 2px solid var(--ink); border-top: 0; background: var(--paper); }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background-color: var(--room, #ffe3ea); isolation: isolate; }
.st-bg, .st-dim { position: absolute; inset: 0; }
.st-bg { background-size: cover; background-position: center; background-repeat: no-repeat;
  background-image: linear-gradient(45deg, rgba(255,255,255,.55) 25%, transparent 25% 75%, rgba(255,255,255,.55) 75%), linear-gradient(45deg, rgba(255,255,255,.55) 25%, transparent 25% 75%, rgba(255,255,255,.55) 75%);
  background-size: 24px 24px; background-position: 0 0, 12px 12px; }
.st-bg.has { background-size: cover; background-position: center; }
.st-dim { pointer-events: none; }
.st-chars { position: absolute; inset: 0; }
.sc { position: absolute; z-index: 1; transition: filter .15s, transform .15s; animation: sc-in .35s steps(5) both; pointer-events: none; }
.sc img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.sc.dim { filter: brightness(.8) saturate(.75); }
.sc.talk { z-index: 3; transform: translateY(-1.2%); }
@keyframes sc-in { from { opacity: 0; transform: translateY(5%); } to { opacity: 1; } }
.dlg { position: relative; z-index: 5; margin-top: calc(var(--ov, 30) * var(--ar) * -1%); border: 0; border-top: 2px solid var(--ink);
  background: rgba(255, 253, 250, var(--wa, .92)); background: linear-gradient(rgba(255, 253, 250, var(--wa, .92)), rgb(255, 253, 250) var(--dpx, 130px)); padding: 16px 12px 12px; min-height: 150px;
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--mint-deep); }
.who-tag { position: absolute; left: 10px; top: -14px; background: var(--red); color: var(--mint); border: 2px solid var(--ink); padding: 0 10px; font-size: 14px; box-shadow: 2px 2px 0 var(--ink); }
.who-tag:empty { display: none; }
.said { margin: 4px 0 8px; min-height: 3.4em; font-size: 16px; line-height: 1.75; white-space: pre-wrap; }
.said.me { color: var(--red-dark); }
.choices { display: grid; gap: 7px; }
.choices .btn { text-align: left; padding: 7px 12px; }
.choices .btn::before { content: "♥ "; color: var(--red); }
.next { position: absolute; right: 10px; bottom: 6px; background: none; border: 0; color: var(--red); font-size: 18px; animation: bob .8s steps(2) infinite; padding: 4px 8px; }
.next[hidden] { display: none; }
@keyframes bob { 50% { transform: translateY(4px); } }
.inputrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.inputrow[hidden] { display: none; }
.inputrow label { flex: 1 0 100%; font-size: 13px; }
.inputrow input { flex: 1 1 160px; min-width: 0; font-family: var(--font-jp); font-size: 16px; padding: 6px 8px; border: 2px solid var(--ink); background: #fff; box-shadow: inset 2px 2px 0 var(--mint-deep); }

/* 結果 */
.diag { text-align: center; padding: 40px 10px; border: 2px solid var(--ink); background: var(--paper); }
.diag p { margin: 0; font-size: 18px; }
.diag .dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.card { border: 3px solid var(--ink); background: var(--paper); box-shadow: 5px 5px 0 var(--red); }
.card-h { background: var(--red); color: var(--mint); padding: 6px 12px; font-size: 14px; border-bottom: 2px solid var(--ink); }
.card-b { display: grid; grid-template-columns: 200px 1fr; gap: 14px; padding: 14px; }
.card-pic { aspect-ratio: 3 / 4; overflow: hidden; border: 2px solid var(--ink); position: relative;
  background-color: var(--mint);
  background-image: linear-gradient(45deg, rgba(255,255,255,.7) 25%, transparent 25% 75%, rgba(255,255,255,.7) 75%), linear-gradient(45deg, rgba(255,255,255,.7) 25%, transparent 25% 75%, rgba(255,255,255,.7) 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px; }
.card-pic img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card h2 { margin: 0; font-size: 24px; line-height: 1.3; color: var(--red); text-shadow: 2px 2px 0 var(--mint); }
.card .post { margin: 2px 0 8px; font-size: 13px; }
.pct { font-family: var(--font-px); font-size: 22px; color: var(--red); margin: 4px 0; }
.pct small { font-family: var(--font-jp); font-size: 12px; color: var(--ink); margin-left: 6px; }
.reason { margin: 6px 0 0; white-space: pre-line; }
.rx { margin: 0 14px 14px; border: 2px dashed var(--red); background: #fff; padding: 8px 12px; font-size: 14px; white-space: pre-line; }
.rx b { color: var(--red); }
.traits { margin: 0 14px 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; font-size: 12px; }
.traits div { display: grid; grid-template-columns: 6.2em 1fr; align-items: center; gap: 6px; }
.traits .bt { height: 10px; background: var(--mint); border: 1px solid var(--ink); position: relative; }
.traits .bt i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--red); }
.runner { margin: 0 14px 14px; font-size: 13px; }
.runner ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }
.runner li { display: flex; align-items: center; gap: 6px; border: 2px solid var(--ink); background: #fff; padding: 3px 8px 3px 3px; }
.runner li img { width: 36px; height: 36px; object-fit: cover; border: 1px solid var(--ink); background: var(--mint); }
.acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; justify-content: center; }
.back { text-align: center; margin: 0; padding: 0 14px 12px; font-size: 13px; }
.gfoot { text-align: center; font-size: 11px; padding: 8px; border-top: 2px solid var(--ink); background: var(--mint); }

@media (max-width: 640px) {
  .ghead { flex-direction: column; align-items: flex-start; padding-top: 14px; }
  .ghead .langsw { top: 8px; right: 8px; }
  .ghead .logo { flex-basis: auto; width: 150px; }
  .vnbox { --ar: .6667; }
  .stage { aspect-ratio: 3 / 2; }
  .card-b { grid-template-columns: 1fr; }
  .card-pic { width: 190px; margin: 0 auto; }
  .traits { grid-template-columns: 1fr; }
  .said { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .next, .hint.blink, .diag .dots::after, .sc { animation: none; }
}

/* ===== シェアページ（r/） ===== */
.langsw .cur, .langsw a { display: block; font: inherit; font-size: 12px; line-height: 1.5; padding: 1px 10px; text-decoration: none; }
.langsw .cur { background: var(--red); color: var(--mint); }
.langsw a { background: var(--paper); color: var(--red); border-left: 2px solid var(--ink); }
.langsw a:hover { background: var(--pink); color: var(--ink); }
.sharepage .cta { margin-top: 18px; border: 3px dashed var(--red); background: #fff; padding: 16px 14px 12px; text-align: center; }
.sharepage .cta p { margin: 0; }
.cta-lead { font-size: 19px; line-height: 1.5; color: var(--red); text-shadow: 2px 2px 0 var(--mint); }
.cta-sub { margin-top: 6px !important; font-size: 13px; line-height: 1.7; }
.cta-btn { margin: 14px 0 10px !important; }
.cta-btn .btn { display: inline-block; text-decoration: none; }
.cta-tag { font-size: 12px; color: var(--red); }
.sharepage .cta .small { margin-top: 6px; font-size: 11px; }
.sharepage .acts { margin: 16px 0 4px; }
.sharepage .acts .btn { text-decoration: none; display: inline-block; }
