* { 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; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }

/* the order on the left, the bill and the five seats on the right */
#hud { min-height: 70px; flex: 1 1 70px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px; }
#hud.off { visibility: hidden; }
#odai { min-width: 0; transition: opacity .15s; }
#hud:not(.show) #odai { opacity: 0; }
#odai b { display: inline-block; font-size: 12px; border: 2px solid #1b1b1d; padding: 1px 6px; background: #fff; }
#order { margin: 3px 0 0; font-size: 18px; line-height: 1.3; font-weight: 800; }
#order small { font-size: 13px; color: #45433e; margin-left: 2px; }
#sum { flex: none; text-align: right; line-height: 1.1; }
#sum small { display: block; font-size: 11px; font-weight: 700; color: #45433e; }
#sum b { font-size: 22px; color: #d23a2c; font-variant-numeric: tabular-nums; white-space: nowrap; }
#dots { display: flex; gap: 4px; justify-content: flex-end; margin-top: 5px; }
#dots i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #1b1b1d; background: #fff; }
#stage { position: relative; flex: 1; min-height: 0; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* a tall phone: the order is a big speech bubble */
#hud.tall { flex-direction: column; justify-content: center; align-items: stretch; gap: 10px; padding: 6px 16px 4px; }
#hud.tall #odai { display: flex; flex-direction: column; align-items: flex-start; }
#hud.tall #order { position: relative; font-size: 22px; background: #fff; border: 2px solid #1b1b1d; border-radius: 14px; padding: 8px 14px; margin-top: 8px; align-self: stretch; }
#hud.tall #sum { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#hud.tall #sum small { display: inline; font-size: 13px; }
#hud.tall #sum b { font-size: 26px; margin-right: auto; }
#hud.tall #dots { margin: 0; }

/* the first time: a finger going down through the meat */
#hint { position: absolute; left: 62%; top: 47%; 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,.88);
  animation: down 1.1s ease-in-out infinite; }
#hint b { position: absolute; left: 22px; top: -14px; font-size: 22px; letter-spacing: 2px; -webkit-text-stroke: 5px #fff; paint-order: stroke; }
@keyframes down { 0% { transform: translateY(-80px); opacity: 0; } 15% { opacity: 1; } 70% { transform: translateY(70px); opacity: 1; } 100% { transform: translateY(70px); opacity: 0; } }

.panel { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(245,243,238,.86); overflow-y: auto; overscroll-behavior: contain; padding: 16px; z-index: 10; }
.panel[hidden] { display: none; }
#title { background: rgba(245,243,238,.97); }
.box { width: 100%; max-width: 360px; text-align: center; margin: auto; }
.box.wide { max-width: 520px; }
#tart { width: 100%; height: clamp(120px, 24vh, 190px); display: block; margin: 0 auto 6px; }
h1 { font-size: 60px; letter-spacing: 8px; margin: 0 0 4px; -webkit-text-stroke: 8px #f5f3ee; paint-order: stroke; }
.sub { margin: 0 0 26px; 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; }
.big { font-size: 20px; font-weight: 700; }
.row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.row > * { flex: 1; }
#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-after { margin-top: 18px; }
/* the post / save row is the last thing and sticks to the bottom (ルスバンと同じ: it never comes unstuck) */
#r-share { gap: 6px; position: sticky; bottom: 0; z-index: 3; margin: 14px -12px 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #f5f3ee; box-shadow: 0 -8px 10px -8px rgba(27,27,29,.28); }
#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; }
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; }
.new { color: #d23a2c; font-weight: 700; font-size: 13px; }

#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; }

/* the slip */
#sheet { background: #fffdf7; border: 3px solid #1b1b1d; outline: 1px solid #1b1b1d; outline-offset: -7px; padding: 12px 14px 10px; text-align: left; position: relative; }
.r-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; border-bottom: 2px solid #1b1b1d; padding-bottom: 4px; }
.r-head b { font-size: 22px; letter-spacing: 3px; white-space: nowrap; }
.r-head span { font-size: 12px; font-weight: 800; text-align: right; line-height: 1.3; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-sub { display: flex; align-items: center; gap: 8px; margin: 4px 0 1px; min-height: 16px; }
#r-no { margin-left: auto; font-size: 10px; color: #6f6c64; text-align: right; }
#r-list { list-style: none; margin: 2px 0 0; padding: 0; }
#r-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid rgba(27,27,29,.15); }
#r-list .th { flex: none; width: 58px; height: 40px; }
#r-list .o { flex: 1; min-width: 0; line-height: 1.2; }
#r-list .o small { display: block; font-size: 11px; color: #6f6c64; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#r-list .o span { display: block; font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#r-list .g { flex: none; text-align: right; line-height: 1.15; font-variant-numeric: tabular-nums; }
#r-list .g b { display: block; font-size: 17px; }
#r-list .g small { font-size: 11.5px; font-weight: 800; }
#r-list .up { color: #d23a2c; } #r-list .down { color: #2f5d9b; } #r-list .zero { color: #c8961e; }
#r-list .v { flex: none; width: 56px; text-align: center; font-style: normal; font-weight: 900; font-size: 13px; border: 2px solid currentColor; border-radius: 4px; padding: 2px 0; transform: rotate(-4deg); }
.v.just { color: #c8961e; background: #fff3c4; } .v.close { color: #2f7d4f; }
.v.more, .v.big, .v.huge { color: #d23a2c; } .v.less, .v.tiny, .v.air { color: #2f5d9b; }
.r-total { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-top: 6px; position: relative; }
.r-total p { margin: 0; line-height: 1.1; }
.r-total small { display: block; font-size: 11.5px; font-weight: 700; }
.r-total b { font-size: 24px; font-variant-numeric: tabular-nums; }
.r-total em { display: block; font-style: normal; font-size: 12px; font-weight: 800; color: #c8961e; }
.r-total .bill { text-align: right; }
.r-total .bill b { color: #d23a2c; font-size: 32px; }
.r-total .bill b small { display: inline; font-size: 16px; margin-left: 2px; }
/* 自己ベスト更新: on the line under the head, left of the number (it used to sit over the bill) */
#r-best { flex: none; color: #d23a2c; background: #fff6d8; border: 2.5px solid #d23a2c; padding: 1px 7px; font-style: normal; font-weight: 900; font-size: 12.5px;
  transform: rotate(-3deg); transform-origin: 0 50%; animation: hanko2 .35s cubic-bezier(.2,1.6,.4,1) .6s both; white-space: nowrap; }
@keyframes hanko2 { from { transform: rotate(-3deg) scale(2); opacity: 0; } }
#r-best[hidden] { display: none; }
.r-foot { margin-top: 8px; border-top: 2px solid #1b1b1d; padding: 6px 66px 0 0; position: relative; min-height: 62px; }
.r-foot p { margin: 0; }
.r-foot small { display: block; font-size: 11px; font-weight: 700; color: #6f6c64; }
#r-comment { font-size: 17px; font-weight: 800; line-height: 1.35; }
#r-stamp { position: absolute; right: 0; top: 6px; width: 58px; height: 58px; border: 3px solid #d23a2c; border-radius: 50%; color: #d23a2c;
  font-style: normal; font-weight: 800; font-size: 18px; display: flex; align-items: center; justify-content: center; transform: rotate(-14deg);
  box-shadow: inset 0 0 0 4px #fffdf7, inset 0 0 0 5px #d23a2c; opacity: .9; animation: hanko .35s cubic-bezier(.2,1.6,.4,1) .25s both; }
#r-stamp.gold { color: #c8961e; border-color: #c8961e; box-shadow: inset 0 0 0 4px #fffdf7, inset 0 0 0 5px #c8961e; font-size: 26px; }
@keyframes hanko { from { transform: rotate(-14deg) scale(2.4); opacity: 0; } }
@media (max-height: 700px) {
  #r-list li { padding: 2px 0; }
  #r-list .th { height: 32px; }
  .r-total .bill b { font-size: 28px; }
  #r-comment { font-size: 15px; }
}

#zukan { z-index: 20; background: #f5f3ee; align-items: flex-start; }
#z-list { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; text-align: center; font-size: 12px; }
#z-list li { border: 2px solid #d9a520; background: #fff; padding: 4px; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#z-list li canvas { width: 60px; height: 60px; }
#z-list li b { display: block; font-size: 12px; line-height: 1.25; }
#z-list li small { color: #45433e; font-size: 10px; line-height: 1.3; }
#z-list li.no { border: 2px dashed #a9a59b; color: #a9a59b; background: transparent; font-size: 22px; font-weight: 700; }

/* languages (src/lang.js). Not Japanese: hidden until the table is in */
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; }
/* words longer than ピッタリ / 毎度 */
:lang(en) h1, :lang(es) h1, :lang(pt) h1, :lang(fr) h1, :lang(de) h1, :lang(ko) h1 { font-size: 46px; letter-spacing: 2px; }
:lang(en) .r-head b, :lang(es) .r-head b, :lang(pt) .r-head b, :lang(fr) .r-head b, :lang(de) .r-head b, :lang(ko) .r-head b { font-size: 18px; letter-spacing: 0; }
:lang(en) #r-list .v, :lang(es) #r-list .v, :lang(pt) #r-list .v, :lang(fr) #r-list .v, :lang(de) #r-list .v, :lang(ko) #r-list .v { width: auto; min-width: 56px; max-width: 84px; padding: 2px 4px; font-size: 11px; line-height: 1.15; }
:lang(en) #r-stamp, :lang(es) #r-stamp, :lang(pt) #r-stamp, :lang(fr) #r-stamp, :lang(de) #r-stamp, :lang(ko) #r-stamp { font-size: 12px; text-align: center; line-height: 1.05; padding: 0 4px; }
:lang(en) #r-stamp.gold, :lang(es) #r-stamp.gold, :lang(pt) #r-stamp.gold, :lang(fr) #r-stamp.gold, :lang(de) #r-stamp.gold, :lang(ko) #r-stamp.gold { font-size: 14px; }
:lang(en) #r-post, :lang(es) #r-post, :lang(pt) #r-post, :lang(fr) #r-post, :lang(de) #r-post { font-size: 16px; }
