/* 見た目は X（ライトテーマ）のプロフィールに寄せ、カードは Tinder のように重ねる。
   文字 #0f1419・補助 #536471・罫線 #eff3f4・青 #1d9bf0・赤 #f4212e・緑 #00ba7c */
* { box-sizing: border-box; }
:root { --ink: #0f1419; --sub: #536471; --line: #eff3f4; --blue: #1d9bf0; --red: #f4212e; --green: #00ba7c; --gold: #f5b400; }
html, body { margin: 0; background: #e9edf0; color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
#app { max-width: 440px; margin: 0 auto; min-height: 100dvh; background: #fff; position: relative; overflow-x: clip; }
button { font: inherit; color: inherit; }
svg { flex: none; }
.btn { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; min-height: 50px; margin: 10px 0 0; padding: 10px 14px; border: 1px solid #cfd9de; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 700; font-size: 16px; text-align: center; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { border-color: transparent; color: var(--sub); font-weight: 500; }
.btn.xpost { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.xpost svg { width: 18px; height: 18px; fill: #fff; }
.lk { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.lk rect { fill: currentColor; stroke: none; }
.lk.open { color: #cfd9de; }

/* タイトル */
.title { padding: 64px 24px 32px; text-align: center; }
.title .logo .lk { width: 64px; height: 64px; color: var(--ink); }
.title h1 { font-size: 60px; margin: 6px 0 2px; letter-spacing: .06em; font-weight: 900; }
.catch { font-size: 19px; font-weight: 700; margin: 0 0 22px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 6px 0; }
.chips span { padding: 5px 11px; border-radius: 999px; background: #fde8ea; color: #b0121f; font-weight: 700; font-size: 14px; }
.chips.pass span { background: #e1f5ec; color: #00744f; }
.chips em { font-style: normal; color: var(--sub); font-size: 14px; }
.title .btn.primary { margin-top: 26px; font-size: 18px; min-height: 56px; }
.best { color: var(--sub); font-size: 14px; margin: 12px 0 0; }
.guide { margin-top: 14px; font-size: 13px; }
.note { font-size: 11px; color: var(--sub); margin-top: 18px; }

/* 日の始まり */
.intro { min-height: 100dvh; padding: 40px 22px 28px; display: flex; flex-direction: column; text-align: center; }
.premise { font-size: 14px; line-height: 1.7; color: var(--sub); margin: 0 0 8px; }
.prev { font-size: 14px; color: var(--sub); margin: 0; letter-spacing: .05em; }
.intro h2 { font-size: 40px; margin: 10px 0 14px; font-weight: 900; }
.newrule { border: 2px solid var(--red); border-radius: 16px; padding: 14px 14px 12px; background: #fff5f6; animation: pop .35s both; }
.newrule.pass { border-color: var(--green); background: #effaf5; }
.newrule small { display: block; font-size: 12px; font-weight: 700; color: var(--red); letter-spacing: .1em; }
.newrule.pass small { color: var(--green); }
.newrule b { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 24px; margin: 6px 0 4px; }
.newrule p { margin: 0; font-size: 15px; color: var(--sub); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.rlist { list-style: none; margin: 14px 0 0; padding: 0; text-align: left; }
.rlist li { display: grid; grid-template-columns: 28px 1fr; column-gap: 6px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.rlist li span { grid-row: span 2; font-size: 20px; }
.rlist li b { font-size: 15px; color: #b0121f; }
.rlist li.pass b { color: #00744f; }
.rlist li small { font-size: 12px; color: var(--sub); }
.howto { margin: auto 0 0; padding-top: 18px; font-size: 15px; color: var(--sub); }
.howto b { color: var(--ink); }
.locks { display: flex; gap: 2px; color: var(--ink); }
.locks.big { justify-content: center; margin-top: 14px; }
.locks.big .lk { width: 30px; height: 30px; }
.locks.break { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* プレイ */
.play { height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden; background: #f3f5f7; }
.hud { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 10px 0 14px; background: #fff; border-bottom: 1px solid var(--line); flex: none; }
.hud .dy { line-height: 1.1; }
.hud .dy b { display: block; font-size: 16px; }
.hud .dy small { font-size: 12px; color: var(--sub); }
.clock { flex: 1; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 17px; }
.rbtn { min-width: 44px; height: 38px; padding: 0 12px; border: 0; border-radius: 999px; background: #fff3b0; font-weight: 800; cursor: pointer; box-shadow: 0 1px 3px #0002; }
.rpanel { position: absolute; z-index: 40; top: 58px; right: 8px; left: 8px; max-width: 360px; margin-left: auto; padding: 4px 12px 8px; background: #fff8d6; border: 1px solid #ecdc8f; border-radius: 14px; box-shadow: 0 8px 24px #0003; transform: translateY(-10px); opacity: 0; pointer-events: none; transition: .18s; }
.rpanel.open { transform: none; opacity: 1; pointer-events: auto; }
.rpanel .rlist { margin: 0; }
.rpanel .rlist li { border-color: #efe3a8; }

.deck { flex: 1; position: relative; margin: 10px 12px 0; min-height: 0; }
.card { position: absolute; inset: 0; background: #fff; border-radius: 18px; box-shadow: 0 2px 12px #0f14191f; overflow: hidden auto; overscroll-behavior: contain; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; will-change: transform; }
.card.under { transform: scale(.95) translateY(10px); filter: brightness(.97); pointer-events: none; }
.card.top { animation: up .18s ease-out; cursor: grab; }
.card.drag { cursor: grabbing; transition: none; }
@keyframes up { from { transform: scale(.95) translateY(10px); } }
.card.wrong { box-shadow: 0 0 0 3px var(--red), 0 2px 12px #0f14191f; }
.req { display: flex; align-items: center; gap: 6px; padding: 9px 14px; font-size: 13px; font-weight: 700; color: var(--sub); background: #f7f9f9; border-bottom: 1px solid var(--line); }
.req svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.hero { height: 72px; }
.pf { padding: 0 16px 10px; position: relative; font-size: 15px; }
.av { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 34px; margin-top: -32px; border: 4px solid #fff; background: #e7ecf0; }
.av.egg { background: #cfd9de; }
.av.egg svg { width: 40px; height: 40px; fill: #fff; }
.nm { display: flex; align-items: center; gap: 3px; margin-top: 4px; font-size: 19px; font-weight: 800; line-height: 1.25; }
.badge { width: 20px; height: 20px; fill: var(--blue); }
.badge .ck { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hd { color: var(--sub); }
.bio { margin: 8px 0 0; line-height: 1.45; }
.meta { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--sub); font-size: 14px; }
.meta svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ff { margin-top: 6px; color: var(--sub); font-size: 14px; }
.ff b { color: var(--ink); }
.mu { display: flex; align-items: center; margin-top: 8px; color: var(--sub); font-size: 13px; }
.mav { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; background: #c8d3da; margin-right: -6px; }
.mav + .mav { background: #a9b8c2; margin-right: 6px; }
.tabs { display: flex; border-top: 1px solid var(--line); font-size: 14px; color: var(--sub); }
.tabs > * { flex: 1; text-align: center; padding: 10px 0 9px; }
.tabs b { color: var(--ink); box-shadow: inset 0 -3px 0 var(--blue); }
.post { border-top: 1px solid var(--line); padding: 10px 16px 12px; font-size: 15px; }
.ph { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph span { color: var(--sub); }
.tx { margin: 2px 0 0; line-height: 1.45; }
.orig { display: flex; gap: 8px; padding: 8px 10px; margin-bottom: 6px; border: 1px solid #e1e8ed; border-radius: 12px; font-size: 14px; }
.orig p { margin: 2px 0 0; line-height: 1.4; }
.oav { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e7ecf0; font-size: 15px; flex: none; }
.rto { font-size: 13px; color: var(--sub); margin-bottom: 2px; }
.rto span { color: var(--blue); }
.img { position: relative; margin-top: 8px; height: 170px; border-radius: 14px; border: 1px solid #e1e8ed; display: grid; place-items: center; overflow: hidden; cursor: pointer; }
.img .emo { font-size: 64px; letter-spacing: -.05em; }
.altb { position: absolute; left: 8px; bottom: 8px; padding: 2px 6px; border: 0; border-radius: 5px; background: #000000b8; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .03em; cursor: pointer; }
.alttext { position: absolute; inset: 0; padding: 12px 14px; background: #000000d9; color: #fff; font-size: 14px; line-height: 1.5; text-align: left; opacity: 0; transition: opacity .15s; overflow-wrap: anywhere; pointer-events: none; }
.alttext small { display: block; font-size: 11px; opacity: .7; margin-bottom: 4px; }
.img.open .alttext { opacity: 1; }
.acts { display: flex; justify-content: space-between; max-width: 260px; margin-top: 8px; color: var(--sub); font-size: 13px; }
.hl { border-radius: 6px; animation: hl 1.1s ease-in-out infinite alternate; }
.img.hl, .orig.hl { border-color: var(--red); }
@keyframes hl { from { box-shadow: 0 0 0 2px #f4212e55; background-color: #fff0f1; } to { box-shadow: 0 0 0 3px var(--red); background-color: #ffe0e3; } }
.av.hl { border-color: var(--red); }
.badge.hl { animation: none; filter: drop-shadow(0 0 3px var(--red)); }

.stamp { position: absolute; top: 56px; padding: 4px 12px; border: 4px solid; border-radius: 10px; font-size: 30px; font-weight: 900; letter-spacing: .1em; opacity: 0; pointer-events: none; background: #ffffffcc; }
.stamp.ok { left: 18px; color: var(--green); transform: rotate(-14deg); }
.stamp.rej { right: 18px; color: var(--red); transform: rotate(14deg); }
.swipehint { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: space-between; padding: 0 14px; pointer-events: none; }
.swipehint span { padding: 6px 12px; border-radius: 999px; background: #0f1419d9; color: #fff; font-size: 14px; font-weight: 700; animation: nudge 1.4s ease-in-out infinite; }
.swipehint span + span { animation-direction: reverse; }
@keyframes nudge { 50% { transform: translateX(-6px); } }

.ctrl { display: flex; justify-content: center; gap: 56px; padding: 12px 0 calc(14px + env(safe-area-inset-bottom)); flex: none; }
.cb { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 3px 10px #0f141926; cursor: pointer; position: relative; }
.cb svg { width: 28px; height: 28px; fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.cb.no svg { stroke: var(--red); }
.cb.yes svg { stroke: var(--green); }
.cb { align-content: center; gap: 1px; }
.cb small { font-size: 11px; font-weight: 700; color: var(--sub); line-height: 1; }
.cb:active { transform: scale(.92); }

.sheet { position: absolute; z-index: 50; left: 0; right: 0; bottom: 0; padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); background: #fff; border-radius: 20px 20px 0 0; box-shadow: 0 -6px 24px #0f141933; animation: sheet .22s ease-out; }
@keyframes sheet { from { transform: translateY(100%); } }
.sh-t { display: flex; align-items: center; gap: 6px; color: var(--red); font-weight: 800; font-size: 14px; }
.sh-t .lk { color: var(--red); width: 20px; height: 20px; }
.sheet b { display: block; font-size: 22px; margin-top: 4px; }
.sheet p { margin: 4px 0 0; color: var(--sub); font-size: 15px; line-height: 1.5; }

/* 結果 */
.result { padding: 36px 20px 28px; text-align: center; }
.rh { display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 18px; font-weight: 800; }
.rh .lk { width: 28px; height: 28px; }
.result.dead .rh { color: var(--red); }
.result.dead .rh .lk { color: var(--red); }
.result.clear .rh { color: #00744f; }
.headline { font-size: 25px; line-height: 1.4; margin: 14px 0 6px; font-weight: 900; }
.time { font-size: 46px; font-weight: 900; margin: 12px 0 2px; font-variant-numeric: tabular-nums; }
.sub { margin: 0; color: var(--sub); font-size: 15px; }
.sub b { color: #c27c00; }
.rows { margin: 14px auto 6px; font-size: 15px; line-height: 1.35; letter-spacing: 1px; white-space: pre-wrap; font-family: inherit; }
.notifs { margin: 14px 0 6px; text-align: left; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.notifs h3 { margin: 0; padding: 10px 14px; font-size: 15px; border-bottom: 1px solid var(--line); background: #f7f9f9; }
.notifs ul { list-style: none; margin: 0; padding: 0; }
.notifs li { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); animation: pop .3s both; }
.notifs li:nth-child(2) { animation-delay: .25s; }
.notifs li:nth-child(3) { animation-delay: .5s; }
.notifs li:last-child { border-bottom: 0; }
.notifs .av { width: 36px; height: 36px; font-size: 19px; margin: 0; border: 0; flex: none; }
.notifs p { margin: 0; font-size: 14px; line-height: 1.5; }
.calm { margin: 0; padding: 14px; color: var(--sub); font-size: 14px; }

/* 背の低い画面（iPhone SE など）: ALT のボタンまでスクロールなしで見えるように詰める */
@media (max-height: 720px) {
  .req { padding: 6px 14px; }
  .hero { height: 36px; }
  .av { width: 52px; height: 52px; font-size: 28px; margin-top: -24px; }
  .bio { margin-top: 4px; }
  .meta, .ff, .mu { margin-top: 4px; }
  .tabs > * { padding: 7px 0 6px; }
  .img { height: 120px; }
  .img .emo { font-size: 48px; }
  .ctrl { padding-top: 8px; }
  .cb { width: 60px; height: 60px; }
}

/* もっと背の低い画面（X のアプリ内ブラウザは下にポストのシートが残り、縦 530px ほどしかない）:
   ヘッダー画像とタブをやめ、アイコンを名前の横へ。画像の ALT まで、スクロールなしで見えるように */
@media (max-height: 640px) {
  .hud { height: 46px; }
  .hud .dy b { font-size: 15px; }
  .rbtn { height: 34px; }
  .rpanel { top: 50px; }
  .deck { margin-top: 6px; }
  .req { padding: 4px 12px; font-size: 12px; }
  .req svg { width: 15px; height: 15px; }
  .hero, .tabs { display: none; }
  .pf { display: grid; grid-template-columns: 46px 1fr; column-gap: 10px; padding: 8px 14px 6px; font-size: 14px; }
  .pf > * { grid-column: 1 / -1; }
  .pf > .av { grid-column: 1; grid-row: 1 / span 2; width: 46px; height: 46px; font-size: 25px; margin: 0; border: 0; }
  .pf > .av.egg svg { width: 30px; height: 30px; }
  .pf > .nm, .pf > .hd { grid-column: 2; }
  .nm { margin-top: 1px; font-size: 17px; }
  .hd { font-size: 14px; }
  .bio { margin-top: 5px; line-height: 1.35; }
  .meta, .ff, .mu { margin-top: 3px; font-size: 13px; }
  .post { padding: 7px 14px 8px; font-size: 14px; }
  .ph { font-size: 13px; }
  .orig { padding: 6px 8px; margin-bottom: 4px; font-size: 13px; }
  .img { height: 100px; margin-top: 6px; }
  .img .emo { font-size: 42px; }
  .acts { margin-top: 4px; font-size: 12px; }
  .stamp { top: 14px; font-size: 26px; }
  .ctrl { gap: 48px; padding: 6px 0 calc(8px + env(safe-area-inset-bottom)); }
  .cb { width: 54px; height: 54px; }
  .cb svg { width: 24px; height: 24px; }
  .streak { top: 52px; }
}

/* 手ごたえ: 判子が押される・連続正解・まちがいで画面が揺れて鍵が外れる */
.stamp.slam { animation: slam .2s cubic-bezier(.2, 1.6, .5, 1) both; }
.stamp.ok.slam { --r: -14deg; }
.stamp.rej.slam { --r: 14deg; }
@keyframes slam { from { transform: rotate(var(--r)) scale(2.2); opacity: 0; } to { transform: rotate(var(--r)) scale(1); opacity: 1; } }
.flash { position: absolute; inset: 0; pointer-events: none; z-index: 45; opacity: 0; }
.flash.ok { animation: fl .35s ease-out; box-shadow: inset 0 0 0 6px var(--green), inset 0 0 60px #00ba7c55; }
.flash.rej { animation: fl .35s ease-out; box-shadow: inset 0 0 0 6px var(--red), inset 0 0 60px #f4212e44; }
.flash.bad { opacity: 1; background: radial-gradient(ellipse at center, transparent 45%, #f4212e66); animation: bad .5s ease-out both; }
@keyframes fl { from { opacity: 1; } to { opacity: 0; } }
@keyframes bad { 0% { background-color: #f4212e55; } 100% { background-color: transparent; } }
.play.shake { animation: pshake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes pshake { 10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(5px, -2px); } 30%, 50%, 70% { transform: translate(-9px, 2px); } 40%, 60% { transform: translate(9px, -1px); } }
.locks .snap { display: inline-flex; animation: snap .7s cubic-bezier(.3, 1.4, .6, 1) both; color: var(--red); }
.locks .snap .lk.open { color: var(--red); }
@keyframes snap { 0% { transform: scale(1); } 30% { transform: scale(1.9) rotate(-18deg); } 100% { transform: scale(1) rotate(0); } }
.streak { position: absolute; z-index: 44; top: 64px; left: 50%; transform: translateX(-50%); padding: 4px 14px; border-radius: 999px; background: #0f1419; color: #fff; font-size: 15px; font-weight: 800; white-space: nowrap; opacity: 0; pointer-events: none; }
.streak b { color: #ffd34d; font-size: 18px; }
.streak.on { animation: streak .9s ease-out both; }
.streak.on.big { animation: streak 1.1s ease-out both; background: linear-gradient(90deg, #ff5f6d, #ffc371); }
.streak.on.big b { color: #fff; }
@keyframes streak { 0% { opacity: 0; transform: translate(-50%, 8px) scale(.7); } 18% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 30% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -6px); } }
.result.dead .rh .lk { animation: snap .8s .1s cubic-bezier(.3, 1.4, .6, 1) both; }
