* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #f5f3ee; color: #1b1b1d; touch-action: manipulation;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic", sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
#app { touch-action: none; position: fixed; inset: 0; max-width: 560px; margin: 0 auto; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* the first time: a finger flicking up (anywhere works) */
#hint { position: absolute; left: 50%; bottom: 52%; width: 0; height: 0; pointer-events: none; }
#hint[hidden] { display: none; }
#hint i { position: absolute; width: 30px; height: 38px; margin: -19px -15px; border-radius: 50% 50% 46% 46%; border: 3px solid #1b1b1d; background: rgba(255,255,255,.9);
  animation: flick 1.1s cubic-bezier(.5,0,.2,1) infinite; }
#hint b { position: absolute; left: -60px; width: 120px; top: 34px; text-align: center; font-size: 20px; letter-spacing: 2px;
  -webkit-text-stroke: 5px #fff; paint-order: stroke; }
@keyframes flick { 0% { transform: translateY(40px); opacity: 0; } 15% { opacity: 1; } 45% { transform: translateY(40px); } 62% { transform: translateY(-50px); opacity: 1; } 80%, 100% { transform: translateY(-60px); opacity: 0; } }

.panel { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(245,243,238,.9); overflow-y: auto; overscroll-behavior: contain; padding: 16px; z-index: 10; }
.panel[hidden] { display: none; }
#title { background: rgba(245,243,238,.96); }
.box { width: 100%; max-width: 360px; text-align: center; margin: auto; }
.box.wide { max-width: 480px; }
#tart { width: 100%; height: clamp(150px, 30vh, 240px); display: block; margin: 0 auto 4px; }
h1 { font-size: 52px; letter-spacing: 6px; margin: 0 0 4px; -webkit-text-stroke: 8px #f5f3ee; paint-order: stroke; }
.sub { margin: 0 0 24px; font-size: 16px; font-weight: 700; }
button, .button { font: inherit; font-size: 16px; font-weight: 700; color: #1b1b1d; background: #fff; border: 2px solid #1b1b1d; border-radius: 0;
  padding: 10px 18px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
button.primary, .button.primary { background: #1b1b1d; color: #fff; }
button.big { width: 100%; padding: 14px; font-size: 18px; margin-top: 12px; }
.row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.row > * { flex: 1; }
button.link { background: none; border: 0; padding: 4px; font-size: 14px; text-decoration: underline; color: #45433e; }
.zk { margin: 10px 0 0; display: flex; justify-content: center; align-items: center; gap: 8px; }

/* the result */
#result { background: #f5f3ee; padding: 10px 12px 0; align-items: flex-start; overflow-x: hidden; }
#result .box { padding-bottom: 0; min-height: 100%; display: flex; flex-direction: column; }
#result #r-after { margin-bottom: auto; margin-top: 18px; }
#sheet { background: #fbfaf6; border: 3px solid #1b1b1d; padding: 6px 14px 12px; position: relative; }
#r-dish { width: 100%; height: clamp(110px, 22vh, 190px); display: block; }
#r-title { margin: 2px 0 0; display: flex; justify-content: center; align-items: center; gap: 8px; }
#r-name { font-style: normal; color: #d23a2c; border: 3px solid #d23a2c; padding: 2px 12px; font-weight: 900; font-size: 20px; transform: rotate(-3deg);
  animation: hanko .35s cubic-bezier(.2,1.6,.4,1) .2s both; }
#r-pb { font-style: normal; color: #d23a2c; background: #fff6d8; border: 2px solid #d23a2c; padding: 1px 7px; font-weight: 900; font-size: 13px; transform: rotate(4deg); }
#r-pb[hidden] { display: none; }
@keyframes hanko { from { transform: rotate(-3deg) scale(2.2); opacity: 0; } }
#r-score { margin: 4px 0 0; line-height: 1; }
#r-score b { font-size: 52px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
#r-score small { font-size: 18px; font-weight: 700; margin-left: 4px; }
#r-rank { margin: 6px 0 0; display: inline-block; padding: 2px 10px; border: 2px solid #d23a2c; color: #d23a2c; font-size: 15px; font-weight: 900; transform: rotate(-2deg); }
#r-rank[hidden] { display: none; }
#r-best { margin: 8px 0 0; font-size: 17px; font-weight: 900; line-height: 1.35; }
#r-best span { color: #d23a2c; margin-left: 6px; }
#r-best small { display: block; font-size: 12px; color: #45433e; font-weight: 700; }
#r-stats { margin: 6px 0 0; font-size: 12.5px; font-weight: 700; color: #6f6c64; }
#r-post { flex: 1.7; background: #1b1b1d; color: #fff; font-size: 18px; padding: 13px 8px; white-space: nowrap; }
#r-post svg { width: 18px; height: 18px; }
#again { flex: 1; font-size: 15px; padding: 10px 4px; white-space: nowrap; }
#r-share { position: sticky; bottom: 0; z-index: 3; margin: 14px -12px 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); gap: 6px;
  background: #f5f3ee; box-shadow: 0 -8px 10px -8px rgba(27,27,29,.28); }
#r-clip { margin-top: 12px; }
#r-clip-v { display: block; max-width: 100%; height: min(56vh, 480px); aspect-ratio: 9 / 16; margin: 0 auto; border: 2px solid #1b1b1d; background: #f5f3ee; }
#r-clip .row { margin-top: 8px; }
#r-clip-save { flex: 0 1 auto; font-size: 14px; padding: 8px 18px; }
/* the post button: a thin line along its bottom while the video is made, then a 動画 tag */
#r-post { position: relative; overflow: hidden; }
#r-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #fff; transform-origin: left; transform: scaleX(0); }
#r-prog[hidden], #r-vtag[hidden] { display: none; }
#r-vtag { font-size: 11px; font-weight: 900; color: #1b1b1d; background: #fff; padding: 1px 5px; margin-left: 6px; animation: hanko .3s cubic-bezier(.2,1.6,.4,1) both; }
#r-row .sn-row { flex-wrap: nowrap; overflow: hidden; justify-content: center; gap: 3px; margin-top: 10px; max-width: none; font-size: 12.5px; }
#r-row .sn-row > span { flex: none; font-size: 10.5px; }
#r-row .sn-chip { flex: none; gap: 3px; padding: 4px 6px 4px 3px; white-space: nowrap; }
#r-row .sn-chip:last-child { flex: 0 1 auto; min-width: 0; }
#r-row .sn-chip b { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#r-row .sn-chip img { flex: none; width: 20px; height: 20px; }
@media (max-height: 640px) {
  #r-dish { height: 96px; }
  #r-score b { font-size: 42px; }
  #r-best { font-size: 15px; margin-top: 5px; }
}

/* 言語（lang.js）: 日本語のほかは表を読むまで隠す・切り替え・その言語の字 */
html.lang-wait #app, html.lang-wait .panel { visibility: hidden; }
.langsw { position: relative; display: inline-flex; align-items: center; gap: 4px; margin-top: 14px; padding: 5px 10px; border: 1.5px solid #1b1b1d; border-radius: 99px; font-size: 13px; font-weight: 800; }
.langsw svg { width: 15px; height: 15px; }
.langsw select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; cursor: pointer; }
:lang(ko) body { font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans CJK KR", "Malgun Gothic", sans-serif; }
:lang(zh-Hans) body { font-family: "PingFang SC", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif; }
:lang(zh-Hant) body { font-family: "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei", sans-serif; }
:lang(en) body, :lang(es) body, :lang(pt) body, :lang(fr) body, :lang(de) body { font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "Noto Sans", sans-serif; }
:lang(en) h1, :lang(es) h1, :lang(pt) h1, :lang(fr) h1, :lang(de) h1 { font-size: 42px; letter-spacing: 1px; }
:lang(ko) h1 { font-size: 46px; letter-spacing: 3px; }
