/* ==========================================================================
   風来  style.css
   浅葱（あさぎ）の空に、木札と筆文字。明るい和風ポップ。
   ========================================================================== */
:root {
  --bg: #EAF6F4;         /* 浅葱の空 */
  --paper: #FFFFFF;
  --ink: #1F2B33;        /* 墨 */
  --muted: #62727B;
  --asagi: #139B96;      /* 浅葱 */
  --asagi-d: #0D7C78;
  --shu: #E4432B;        /* 朱 */
  --yamabuki: #F4B11A;   /* 山吹 */
  --sakura: #D6456A;
  --wood: #F5E6C8;       /* 木札 */
  --wood-edge: #D8BC89;

  --radius-l: 22px;
  --radius-m: 14px;
  --font: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
  --brush: 'Yuji Syuku', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
[hidden] { display: none !important; }

/* 読み仮名 */
rt { font-family: var(--font); font-weight: 700; font-size: .5em; letter-spacing: .05em; }
.verdict__word rt { font-size: .36em; }
.overlay__word rt { font-size: .17em; color: var(--ink); }
.hanko rt { font-size: .4em; }
.hanko { line-height: 1.1; }

/* 文字が枠からはみ出さないように */
.tag__name, .member__name, .question, .verdict, .overlay__sub, .rank__name {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
}

/* ---------- 上の帯 ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 4px 0 8px; }
.topbar__brand {
  font-weight: 900; font-size: 14px; text-decoration: none;
  color: var(--asagi-d); background: var(--paper);
  padding: 2px 12px; border-radius: 999px;
}
.topbar__logo { display: block; height: 30px; width: auto; }

/* ---------- 立て札（木の板） ---------- */
.board {
  position: relative;
  background-color: var(--wood);
  background-image: repeating-linear-gradient(0deg, rgba(150, 105, 45, .07) 0 2px, transparent 2px 11px);
  border-radius: 10px;
  box-shadow: inset 0 0 0 3px var(--wood-edge), 0 4px 0 #C9A66E;
  color: var(--ink);
}
.board::before, .board::after {           /* 釘 */
  content: ''; position: absolute; top: 10px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #9C7A45; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25);
}
.board::before { left: 10px; }
.board::after  { right: 10px; }

/* ---------- トップ ---------- */
.hero { text-align: center; padding: 26px 0 16px; }
.hero__lead { margin: 0; font-weight: 700; color: var(--muted); }
.hero__title { margin: 8px 0 0; line-height: 1; }
.hero__logo { display: block; width: min(66%, 260px); height: auto; margin: 0 auto; }
.hero__sub { margin: 6px 0 0; font-weight: 900; color: var(--asagi-d); letter-spacing: .06em; }
.hero__img { display: block; width: 100%; height: auto; margin: 14px 0 0; }

.howto { margin-top: 28px; padding: 20px 22px 18px; }
.howto__title { margin: 0 0 4px; font-size: 17px; text-align: center; letter-spacing: .2em; }
.howto__steps { margin: 0; padding-left: 1.3em; }
.howto__steps li { margin: 10px 0; }
.howto__steps b { display: block; }
.howto__out {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, .6); font-size: 13px; line-height: 1.8; text-align: center;
}
.howto__note { margin: 10px 0 0; font-size: 13px; color: #6E5A3A; text-align: center; }
.w-uchi { color: var(--shu); font-style: normal; font-weight: 900; }
.w-inu  { color: var(--shu); font-style: normal; font-weight: 900; }
.w-miki { color: #B07A00; font-style: normal; font-weight: 900; }

/* ---------- ボタン ---------- */
.btn {
  display: block; width: 100%; margin-top: 12px;
  border: 0; border-radius: 999px;
  font: inherit; font-weight: 900; font-size: 17px;
  padding: 15px 20px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s;
}
.btn:active { transform: translateY(2px); }
.btn:focus-visible { outline: 3px solid var(--yamabuki); outline-offset: 3px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.is-busy { opacity: .6; }
.btn--primary { background: var(--asagi); color: #fff; box-shadow: 0 4px 0 var(--asagi-d); }
.btn--primary:active { box-shadow: 0 2px 0 var(--asagi-d); }
.btn--ghost { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn--text {
  width: fit-content; margin: 8px auto 0; padding: 8px 12px;
  background: none; color: var(--muted); font-size: 14px; font-weight: 700;
}
.subnav { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-row .btn { font-size: 15px; padding: 13px 8px; }
.btn--line { background: #06C755; color: #fff; box-shadow: 0 4px 0 #04A247; }
.btn--x { background: var(--ink); color: #fff; box-shadow: 0 4px 0 #0A1217; }
.img-modal__img { display: block; width: 100%; height: auto; border-radius: 14px; margin-top: 12px; box-shadow: 0 0 0 1px #d5e6e3; }
#share-sheet { max-height: 92vh; overflow-y: auto; }
.subnav .btn--text { margin: 0; }

/* ---------- 入力 ---------- */
.screen__title { font-size: 20px; margin: 10px 0 14px; }
.field { display: block; margin-bottom: 16px; }
.field__label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.input {
  width: 100%; font: inherit; font-size: 18px;
  padding: 12px 16px; border-radius: var(--radius-m);
  border: 2px solid #cde3e0; background: var(--paper); color: var(--ink);
}
.input:focus { outline: none; border-color: var(--asagi); }
.input--code { font-size: 30px; font-weight: 900; letter-spacing: .4em; text-align: center; }
.avatars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.avatar-opt {
  display: flex; align-items: center; justify-content: center;
  min-width: 0; aspect-ratio: 1; padding: 1px; overflow: hidden;
  font-size: 26px;
  border-radius: 16px; border: 3px solid transparent;
  background: transparent; cursor: pointer;
}
.avatar-opt.is-on { border-color: var(--asagi); background: #d3efeb; }
.avatar-opt img { display: block; width: 100%; height: auto; max-height: 100%; object-fit: contain; }

/* アイコン画像の大きさ */
.member__avatar img { display: block; width: 36px; height: 36px; object-fit: contain; }
.tag__avatar img { display: block; width: 56px; height: 56px; object-fit: contain; margin: 0 auto; }
.rank__avatar img { display: block; width: 30px; height: 30px; object-fit: contain; }

/* ---------- 待合室 ---------- */
.codebox { background: var(--paper); border-radius: var(--radius-l); text-align: center; padding: 12px; }
.codebox__label { display: block; font-size: 13px; color: var(--muted); font-weight: 700; }
.codebox__code { font-size: 44px; font-weight: 900; letter-spacing: .25em; line-height: 1.2; }
.members { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.member {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border-radius: var(--radius-m); padding: 10px 14px;
}
.member__avatar { font-size: 24px; }
.member__name { font-weight: 700; flex: 1; }
.member__badge { font-size: 12px; font-weight: 700; background: var(--yamabuki); padding: 2px 8px; border-radius: 999px; }
.member__you { font-size: 12px; font-weight: 700; color: var(--asagi-d); }
.hint { font-size: 14px; color: var(--muted); text-align: center; margin: 12px 0 0; }

/* ---------- お題 ---------- */
.round-no { font-family: var(--brush); font-size: 22px; text-align: center; margin: 4px 0 0; color: var(--asagi-d); }
.question { font-size: 22px; line-height: 1.5; text-align: center; margin: 4px 0 12px; font-weight: 900; }
.rule { font-size: 13px; text-align: center; margin: 0 0 14px; padding: 12px 22px 10px; }
.progress { text-align: center; font-weight: 900; font-size: 15px; margin: 4px 0 0; }

/* ---------- 絵馬（名前札） ---------- */
.tags { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 12px; padding-top: 10px; }
.tag {
  --plate: var(--wood); --edge: var(--wood-edge); --drop: #C9A66E; --edge-w: 3px;
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  min-height: 136px; padding: 32px 8px 12px;
  background: none; border: 0;
  font: inherit; color: var(--ink); text-align: center;
  -webkit-tap-highlight-color: transparent;
}
button.tag { cursor: pointer; }
button.tag:focus-visible { outline: 3px solid var(--asagi); outline-offset: 3px; }

/* 絵馬の板（屋根の形） */
.tag__plate {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  filter: drop-shadow(0 4px 0 var(--drop));
}
.tag__plate::before, .tag__plate::after {
  content: ''; position: absolute;
  clip-path: polygon(50% 0, 100% 22%, 100% 100%, 0 100%, 0 22%);
}
.tag__plate::before { inset: 0; background: var(--edge); }
.tag__plate::after {
  inset: var(--edge-w);
  background-color: var(--plate);
  background-image: repeating-linear-gradient(0deg, rgba(150, 105, 45, .07) 0 2px, transparent 2px 11px);
}

/* 紐の穴と赤い紐 */
.tag__hole {
  position: absolute; top: 14px; left: 50%; z-index: 1;
  width: 8px; height: 8px; margin-left: -4px; border-radius: 50%;
  background: #8A6A3A;
}
.tag__hole::before {
  content: ''; position: absolute; bottom: 3px; left: 50%;
  width: 16px; height: 24px; margin-left: -8px;
  border: 3px solid var(--shu); border-bottom: 0; border-radius: 9px 9px 0 0;
}

.tag__avatar { font-size: 30px; line-height: 1.25; position: relative; z-index: 1; }
.tag__name { font-weight: 900; font-size: 17px; line-height: 1.4; position: relative; z-index: 1; }
.tag.is-me .tag__name::after { content: '（自分）'; font-size: 11px; color: var(--muted); }
.tag__meta { font-size: 12px; font-weight: 700; color: var(--muted); position: relative; z-index: 1; }
.tag__count {
  position: absolute; top: 34px; right: 10px; z-index: 2;
  min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px;
  background: var(--ink); color: #fff; font-weight: 900; font-size: 14px; line-height: 26px;
}

/* 状態ごとの色 */
.tag.is-selected { --plate: #FFF1C2; --edge: var(--yamabuki); --drop: #D59A0A; --edge-w: 4px; }
.tag.is-selected .tag__meta { color: #986800; }
.tag.is-uchijini { --plate: #FFE2DC; --edge: #EFA192; --drop: #E08472; }
.tag.is-inujini  { --plate: #E7EBED; --edge: #B9C3C8; --drop: #A3AEB4; }
.tag.is-mikitta  { --plate: #FFF1C2; --edge: var(--yamabuki); --drop: #D59A0A; --edge-w: 4px; }
.tag.is-mikitta .tag__meta { color: #986800; }

/* 刺さったクナイ：刃先は板の中に埋まって見えない */
.tag__stuck { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.stuck {
  position: absolute;
  left: calc(var(--x, 30%) - 60px); top: calc(var(--y, 50%) - 9px);
  width: 60px; height: 18px; overflow: hidden;
  transform-origin: 100% 50%;
  transform: rotate(var(--r, 20deg));
  filter: drop-shadow(3px 5px 0 rgba(31, 43, 51, .2));
}
.stuck img { display: block; width: 76px; height: auto; max-width: none; }
.stuck::after {                      /* 刺さった穴の割れ目 */
  content: ''; position: absolute; right: 0; top: 50%;
  width: 4px; height: 18px; margin-top: -9px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(90, 55, 20, .25), rgba(90, 55, 20, .8));
}
.stuck.is-fall { animation: fall .6s ease-in forwards; }
@keyframes fall { to { transform: translateY(140px) rotate(200deg); opacity: 0; } }

.tag.is-hit { animation: hit .25s; }
@keyframes hit {
  30% { transform: translateX(-3px) rotate(-1.5deg); }
  60% { transform: translateX(3px) rotate(1.5deg); }
}

/* 三度笠（札に引っかけてある） */
.tag__kasa {
  position: absolute; top: -18px; left: -12px; z-index: 4;
  width: 80px; pointer-events: none;
  transform: rotate(-14deg);
  filter: drop-shadow(0 3px 0 rgba(31, 43, 51, .18));
}
.tag__kasa img { display: block; width: 100%; height: auto; }
.tag__kasa.is-drop { animation: kasaDrop .42s cubic-bezier(.3, 1.45, .5, 1); }
@keyframes kasaDrop {
  from { transform: translate(40px, -180px) rotate(-60deg); opacity: 0; }
  60%  { opacity: 1; }
}

/* はんこ */
.hanko {
  position: absolute; right: -6px; bottom: -10px; z-index: 3;
  font-family: var(--brush); font-size: 24px; line-height: 1.1;
  padding: 6px 6px 4px; border: 3px solid currentColor; border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  transform: rotate(-12deg);
  color: var(--shu);
}
.hanko.is-stamp { animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp { from { transform: rotate(-12deg) scale(2.4); opacity: 0; } }

/* 見切った！の一閃 */
.tag.is-focus { z-index: 45; }
.tag.is-slash::before {
  content: ''; position: absolute; z-index: 4;
  left: -12%; right: -12%; top: 50%; height: 4px;
  background: #fff; box-shadow: 0 0 14px 5px #fff;
  transform: rotate(-18deg) scaleX(0);
  animation: slash .45s ease-out forwards;
}
@keyframes slash {
  0%   { transform: rotate(-18deg) scaleX(0); opacity: 1; }
  45%  { transform: rotate(-18deg) scaleX(1); opacity: 1; }
  100% { transform: rotate(-18deg) scaleX(1); opacity: 0; }
}

/* ---------- 結果 ---------- */
.verdicts { display: grid; gap: 8px; margin: 0 0 14px; }
.verdict {
  display: flex; align-items: center; gap: 12px; margin: 0;
  background: var(--paper); border-radius: var(--radius-m);
  padding: 10px 14px; font-weight: 900; font-size: 17px;
}
.verdict__word { font-family: var(--brush); font-weight: 400; font-size: 30px; line-height: 1; flex: none; }
.verdict--uchi .verdict__word { color: var(--shu); }
.verdict--inu .verdict__word { color: var(--shu); }
.verdict--mikiri .verdict__word { color: #C48A00; }
.verdict--celebrate { background: #FFE6EC; }
.verdict small { font-size: 13px; color: var(--muted); font-weight: 700; }
.verdict--celebrate .verdict__word { color: var(--sakura); }
.verdict--draw .verdict__word { color: var(--muted); }

/* ---------- 演出の重ね板 ---------- */
.fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 30; }
.flying-kunai { position: absolute; left: 0; top: 0; width: 76px; transform-origin: 100% 50%; }
.flying-kunai img { display: block; width: 100%; height: auto; }

.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; pointer-events: none;
}
.overlay.is-dim { background: rgba(31, 43, 51, .72); }
.overlay.is-word { background: rgba(255, 255, 255, .6); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.overlay__word {
  font-family: var(--brush); line-height: 1; margin: 0;
  font-size: clamp(96px, 34vw, 160px);
  opacity: 0;
}
.overlay__word.is-in { opacity: 1; animation: word .5s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes word { from { transform: scale(2.2) rotate(-6deg); opacity: 0; } }
.overlay__sub {
  margin: 16px 0 0; font-weight: 900; font-size: 18px;
  background: var(--paper); padding: 6px 18px; border-radius: 999px;
}
.overlay.is-dim .overlay__sub { display: none; }
.overlay--uchi .overlay__word { color: var(--shu); }
.overlay--inu  .overlay__word { color: var(--shu); }
.overlay--mikiri { background: rgba(255, 236, 170, .78); }
.overlay--mikiri .overlay__word { color: var(--ink); font-size: clamp(52px, 15vw, 100px); white-space: nowrap; }
.overlay--celebrate { background: rgba(255, 222, 232, .85); }
.overlay--celebrate .overlay__word { color: var(--sakura); font-size: clamp(72px, 24vw, 128px); }
.overlay--draw .overlay__word { color: var(--muted); font-size: clamp(72px, 24vw, 128px); }

.mikiri-mark {
  position: fixed; z-index: 50;
  font-family: var(--brush); font-size: 88px; line-height: 1;
  color: var(--yamabuki);
  transform: translate(-50%, -100%);
  animation: pop .3s ease-out;
}
@keyframes pop { from { transform: translate(-50%, -100%) scale(.2); } }

/* ---------- 今夜のアウト回数（中身の作りは前のランキングのまま） ---------- */
.ranking {
  border: 0; border-radius: var(--radius-l); padding: 20px;
  width: min(92vw, 400px); color: var(--ink); font-family: var(--font);
}
.ranking::backdrop { background: rgba(31, 43, 51, .5); }
.ranking__title { margin: 0; font-size: 19px; text-align: center; }
.ranks { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.rank { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 12px; padding: 8px 12px; }
.rank__no { font-weight: 900; width: 1.5em; text-align: center; }
.rank__avatar { font-size: 22px; }
.rank__name { flex: 1; font-weight: 700; }
.rank__count { font-weight: 900; color: var(--shu); }

/* ---------- そのほか ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 80;
  max-width: 90vw; padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; text-align: center;
}
.foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 36px; }
.foot a { color: var(--asagi-d); font-weight: 700; }
.foot__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; }
.foot__links a { color: var(--muted); font-weight: 500; }
.foot__credit { margin: 8px 0 0; }

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

/* ---------- プレミアム ---------- */
.premium-banner {
  display: block; width: 100%; margin-top: 14px; padding: 12px 16px;
  border: 2px dashed #E5B84A; border-radius: 999px;
  background: #FFF7DC; color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.premium-banner b { color: #B07A00; }
.toggle {
  display: flex; align-items: center; gap: 10px; margin: 0 0 6px;
  background: #FFF7DC; border-radius: var(--radius-m); padding: 12px 14px;
  font-weight: 700; cursor: pointer;
}
.toggle input { width: 22px; height: 22px; accent-color: var(--shu); }
.toggle small { font-size: 12px; color: var(--muted); }
#create-premium-hint { margin: 0 0 4px; }
#create-premium-hint a, .mode-badge a { color: #B07A00; font-weight: 900; }
.mode-badge {
  margin: 10px 0 0; padding: 8px 12px; border-radius: var(--radius-m);
  background: var(--paper); text-align: center; font-size: 13px; font-weight: 700; color: var(--muted);
}
.mode-badge.is-spicy { background: #FFE2DC; color: var(--shu); }
.mode-badge.is-plus  { background: #FFF1C2; color: #986800; }
.teaser { margin: 18px 0 0; padding: 16px 20px 14px; text-align: center; }
.teaser__label { margin: 4px 0 0; font-size: 13px; font-weight: 900; color: #986800; }
.teaser__q { margin: 6px 0 0; font-size: 18px; font-weight: 900; line-height: 1.5; overflow-wrap: anywhere; }
.teaser__note { margin: 6px 0 0; font-size: 12px; color: #6E5A3A; }
.teaser .btn { margin-top: 10px; padding: 10px; font-size: 15px; }
.premium__list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.premium__list li { background: var(--bg); border-radius: 12px; padding: 10px 14px; font-size: 13px; color: var(--muted); }
.premium__list b { display: block; font-size: 15px; color: var(--ink); }
.premium__price { margin: 14px 0 0; text-align: center; font-size: 30px; font-weight: 900; }
.premium__price small { font-size: 13px; color: var(--muted); font-weight: 700; }
.premium__warn { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: #FFE2DC; color: #B8321D; font-size: 13px; font-weight: 700; }
.premium__owned { margin: 14px 0 0; text-align: center; font-weight: 900; line-height: 1.8; }
.premium { max-height: 92vh; overflow-y: auto; }

/* 部屋を作る：2つのボタン */
.btn--2line { line-height: 1.35; }
.btn--2line small { display: block; font-size: 12px; font-weight: 700; opacity: .85; margin-top: 2px; }
.btn--spicy { background: var(--shu); color: #fff; box-shadow: 0 4px 0 #B8321D; }
.btn--spicy:active { box-shadow: 0 2px 0 #B8321D; }
