#result-card { position: relative; flex: none; width: 100%; max-width: 480px; margin: 0 auto; padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(43, 27, 14, .94); border-radius: 18px 18px 0 0; text-align: center; animation: rise .25s ease-out; }
@keyframes rise { from { transform: translateY(30px); opacity: .2; } }
#result-card h2 { display: inline-block; font-size: 22px; line-height: 1.2; color: #ffd488; border: 3px solid currentColor; border-radius: 999px; padding: 2px 18px; box-shadow: inset 0 0 0 2px rgba(43, 27, 14, .94), inset 0 0 0 3px currentColor; transform: rotate(-4deg); animation: stamp .3s ease-out; }
#result-card h2[data-tier="spotless"], #stamp[data-tier="spotless"] { color: #ffd45e; }
#result-card h2[data-tier="clean"], #stamp[data-tier="clean"] { color: #9fdcf0; }
#result-card h2[data-tier="pass"], #stamp[data-tier="pass"] { color: #a8dd8c; }
#result-card h2[data-tier="almost"], #stamp[data-tier="almost"] { color: #ffb257; }
#result-card h2[data-tier="streaky"], #stamp[data-tier="streaky"] { color: #d8cdc0; }
@keyframes stamp { from { transform: rotate(-12deg) scale(1.7); opacity: 0; } 70% { transform: rotate(-3deg) scale(.95); opacity: 1; } to { transform: rotate(-4deg) scale(1); } }
#tier-scale { display: flex; align-items: stretch; gap: 3px; list-style: none; margin-top: 18px; }
#tier-scale li[data-step] { flex: 1; min-width: 0; font-size: 10px; line-height: 18px; white-space: nowrap; color: #b9a891; background: rgba(255, 246, 230, .08); border-radius: 4px; }
#tier-scale li.ok { background: rgba(168, 221, 140, .16); color: #d3e6c2; }
#tier-scale li[data-now] { font-weight: 800; font-size: 11px; color: #2b1b0e; background: #d8cdc0; box-shadow: 0 0 0 2px #fff6e6; }
#tier-scale li[data-now][data-step="almost"] { background: #ffb257; }
#tier-scale li[data-now][data-step="pass"] { background: #a8dd8c; }
#tier-scale li[data-now][data-step="clean"] { background: #9fdcf0; }
#tier-scale li[data-now][data-step="spotless"] { background: #ffd45e; }
#tier-scale .gate { position: relative; width: 3px; flex: none; margin: -3px 3px; background: #a8dd8c; border-radius: 2px; }
#tier-scale .gate span { position: absolute; left: 0; bottom: 100%; white-space: nowrap; font-size: 10px; font-weight: 700; line-height: 12px; color: #a8dd8c; }
/* 文は語の切れ目で折る。日本語は言語ファイルの区切りと、対応するブラウザの文節の切れ目だけで改行する */
#result-card p { font-size: 14px; line-height: 1.4; margin-top: 3px; text-wrap: balance; line-break: strict; }
:lang(ja) #result-card p { word-break: keep-all; overflow-wrap: anywhere; }
#result-card p[data-testid^="result-comment"].pointed::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 5px; border: 2.5px solid #ffd45e; border-radius: 50%; box-shadow: 0 0 6px #ffd45e; vertical-align: -1px; }
#result-card p[data-testid^="result-comment"].pointed { color: #ffd45e; font-weight: 700; }
/* 2つ目の印は、窓の2つ目の輪と同じく細くする */
#result-card p[data-testid="result-comment2"].pointed::before { border-width: 1.5px; }
#result-card [data-testid="result-streak"] { font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 5px; }
#result-card p[data-testid^="result-comment"] { color: #ffe9c6; }
/* 一言が2つの時は、360×640 でもボタンが画面の中に残るように、段の下と一言を詰める */
#result-card[data-two] p[data-testid^="result-comment"] { font-size: 13px; line-height: 1.35; }
@media (max-height: 700px) {
  #result-card[data-two] #tier-scale { margin-top: 16px; }
  #result-card[data-two] [data-testid="result-streak"] { margin-top: 2px; }
  #result-card[data-two] p { margin-top: 2px; }
}
/* 名人の的がない窓のぴかぴか: 塗らない小さい札 */
#result-card[data-top] #result-master { font-size: 12px; border-width: 1.5px; }
/* 360 幅の英語は2行にして、右上の「窓を見る」にかけない */
@media (max-width: 380px) { #result-card[data-top] #result-master { max-width: 70px; margin-left: 2px; padding: 1px 2px; font-size: 10px; line-height: 1.2; } }
#result-card #result-goal { font-size: 12px; font-weight: 700; color: #ffe48a; }
#app.peek #result-card #result-goal { display: none; }
#result-card #result-tip { font-size: 13px; color: #2b1b0e; background: #ffe3a8; border-radius: 8px; padding: 2px 8px; }
#result-card #result-best, #result-card #result-note { font-size: 12px; color: #cdb99c; }
#result-card #result-best.fresh { color: #ffd45e; font-weight: 700; }
#result-card p:empty { display: none; }
/* 名人のぴかぴか: 判を金で塗り、横に札を添える。いちばんのごほうび */
#result-card[data-master] h2[data-tier="spotless"] { color: #4a2a00; background: linear-gradient(135deg, #fff2b8, #ffd24a 55%, #f0ac1e); border-color: #fff6cf; box-shadow: inset 0 0 0 2px #e5a21c, 0 0 18px rgba(255, 210, 74, .75); }
#result-card #result-master { display: inline-block; vertical-align: middle; margin: 0 0 0 8px; padding: 2px 10px; font-size: 13px; font-weight: 800; color: #ffe48a; border: 2px solid #ffd24a; border-radius: 6px; transform: rotate(4deg); animation: stamp .3s .25s ease-out both; }
#result-card #result-master[hidden] { display: none; }
/* 上の段への向き（窓2・3・5）。ほめた後の誘いなので、枠だけの金の札 */
#result-card #result-note.up { font-size: 13px; font-weight: 700; color: #ffe48a; border: 1.5px solid rgba(255, 210, 74, .8); border-radius: 8px; padding: 2px 8px; }
#app.peek #result-card #result-master { display: none; }
#result-card .row { display: flex; gap: 8px; margin-top: 8px; justify-content: center; }
#result-card .row button { flex: 1; min-height: 48px; font-size: 14px; line-height: 1.2; padding: 2px 6px; }
#result-card .row button.primary { flex: 1.5; font-size: 16px; }
#result-card .row [data-testid="btn-retry-result"].primary { order: -1; }
/* 全部合格の札: 7枚の合計と今日の窓の入口 */
#result-all { display: flex; gap: 8px; align-items: stretch; margin-top: 8px; }
#result-all .totals { flex: 1; gap: 4px; }
#result-all .totals p { margin: 0; padding: 2px; }
#result-card #result-all .totals span { font-size: 10px; }
#result-all button { flex: none; max-width: 38%; min-height: 44px; font-size: 13px; font-weight: 700; line-height: 1.2; padding: 2px 8px; border-color: #ffd488; color: #ffe48a; }
#app.peek #result-card #result-all { display: none; }
#result-card [data-testid="btn-peek"] { position: absolute; right: 8px; top: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44px; padding: 2px 6px; font-size: 10px; line-height: 1.2; }
/* 札を下げて窓を見る: 戻るボタンだけ残す */
#app.peek #result-card { padding-top: 6px; }
#app.peek #result-card > h2, #app.peek #tier-scale, #app.peek #result-card > p, #app.peek #result-card .row { display: none; }
#app.peek #result-card [data-testid="btn-peek"] { position: static; flex-direction: row; gap: 8px; width: 100%; min-height: 52px; font-size: 14px; }
#focus-ring { position: absolute; border: 2.5px solid #ffd45e; border-radius: 50%; box-shadow: 0 0 10px #ffd45e; pointer-events: none; animation: ring .8s ease-out 1, ring-beat .6s ease-in-out .9s 2; }
@keyframes ring { from { transform: scale(1.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes ring-beat { 50% { transform: scale(1.35); box-shadow: 0 0 18px 3px #ffd45e; } }
#app.peek #focus-ring { opacity: .6; }
#stamp { position: absolute; width: 92px; height: 92px; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 800; font-size: 18px; line-height: 1.15; padding: 4px; color: #ffd488; background: rgba(43, 27, 14, .72); border: 5px solid currentColor; border-radius: 50%; pointer-events: none; transform: rotate(-6deg); animation: press .25s ease-out; }
@keyframes press { from { transform: rotate(-14deg) scale(1.8); opacity: 0; } 70% { transform: rotate(-5deg) scale(.94); opacity: 1; } to { transform: rotate(-6deg) scale(1); } }
#share-sheet { position: absolute; inset: 0; z-index: 6; background: rgba(20, 12, 6, .97); display: flex; align-items: center; justify-content: center; padding: 96px 16px 16px; }
#share-sheet .sheet { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 420px; max-height: 100%; }
#share-sheet img { flex: 0 1 auto; min-height: 0; max-width: 100%; max-height: calc(100dvh - 220px); border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
#share-sheet p { font-size: 13px; color: #e8d3b5; min-height: 18px; text-align: center; text-wrap: balance; }
:lang(ja) #share-sheet p { word-break: keep-all; overflow-wrap: anywhere; }
#share-sheet p.said { color: #2b1b0e; background: #ffe3a8; font-weight: 700; border-radius: 12px; padding: 5px 14px; animation: said .4s ease-out; }
@keyframes said { from { transform: scale(.8); opacity: .2; } 60% { transform: scale(1.08); } to { transform: scale(1); opacity: 1; } }
#share-sheet .row { display: flex; gap: 8px; width: 100%; }
#share-sheet .row button { flex: 1; min-height: 48px; }
@media (orientation: landscape) and (max-height: 559px) {
  #app[data-screen="result"] #result-card { position: absolute; right: 0; top: 48px; bottom: 0; width: 300px; overflow: auto; border-radius: 18px 0 0 18px; }
  #app[data-screen="result"] #stage { margin-right: 300px; }
  #app[data-screen="result"].peek #result-card { top: auto; width: 150px; }
  #app[data-screen="result"].peek #stage { margin-right: 150px; }
  #app[data-screen="result"] #result-card [data-testid="btn-peek"] { right: auto; left: 8px; }
  #app[data-screen="result"].peek #result-card [data-testid="btn-peek"] { left: auto; }
}
