* { 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; overflow: hidden; }
#app { touch-action: none; position: fixed; inset: 0; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }

/* the お題 on the left, the clipper's battery on the right */
#hud { flex: none; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px; }
#hud.off { visibility: hidden; }
#h-odai { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
#h-odai small { flex: none; font-size: 13px; font-weight: 800; color: #45433e; }
#h-odai b { font-size: min(20px, 4.6vw); font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#batt { position: relative; width: 52px; height: 24px; border: 2.5px solid #1b1b1d; border-radius: 4px; padding: 2px; }
#batt::after { content: ""; position: absolute; right: -7px; top: 6px; width: 4px; height: 8px; background: #1b1b1d; border-radius: 0 2px 2px 0; }
#batt i { display: block; height: 100%; width: 100%; background: #6cbf5b; transform-origin: left; }
#batt i.low { background: #d23a2c; }
#stage { position: relative; flex: 1; min-height: 0; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* できた: ends the run when the player is happy with the sheep (shown after the first stroke) */
#done { position: absolute; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); min-width: 132px; padding: 11px 22px; font-size: 17px; }
/* 大・中・小のバリカン（中と小は細かい所の微調整に） */
#mihon { position: absolute; left: 10px; top: 6px; width: 132px; height: 100px; background: rgba(255,255,255,.85); border: 2px solid #1b1b1d; border-radius: 8px; pointer-events: none; }
#mihon[hidden] { display: none; }
#blades { position: absolute; left: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); display: flex; }
#blades[hidden] { display: none; }
#blades button { width: 50px; padding: 11px 0; font-size: 17px; }
#blades button + button { border-left: 0; }
#blades button.on { background: #1b1b1d; color: #fff; }
#done[hidden] { display: none; }
/* the first time: a finger going up and down over the wool */
#hint { position: absolute; left: 44%; top: 46%; width: 0; height: 0; pointer-events: none; }
#hint[hidden] { display: none; }
#hint span { position: absolute; left: 0; top: 0; animation: zig 1.6s ease-in-out infinite; }
#hint i { position: absolute; left: 0; width: 30px; height: 38px; margin: -19px -15px; border-radius: 50% 50% 46% 46%; border: 3px solid #1b1b1d; background: rgba(255,255,255,.9); }
#hint b { position: absolute; left: -60px; top: 110px; font-size: 22px; letter-spacing: 2px; white-space: nowrap; -webkit-text-stroke: 5px #fff; paint-order: stroke; }
@keyframes zig { 0% { transform: translate(-70px, -50px); } 25% { transform: translate(-50px, 50px); } 50% { transform: translate(-25px, -50px); } 75% { transform: translate(0px, 50px); } 100% { transform: translate(-70px, -50px); } }

.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); }
#result { background: #f5f3ee; align-items: flex-start; }
.box { width: 100%; max-width: 360px; text-align: center; margin: auto; }
.box.wide { max-width: 520px; margin-top: 0; }
#tart { width: 100%; height: clamp(130px, 26vh, 200px); display: block; margin: 0 auto 6px; }
h1 { font-size: 60px; letter-spacing: 8px; margin: 0 0 4px; }
:lang(en) h1, :lang(es) h1, :lang(pt) h1, :lang(fr) h1, :lang(de) h1, :lang(ko) h1 { font-size: 50px; letter-spacing: 2px; }
.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; }
#hero { width: 100%; aspect-ratio: 1 / 1.12; max-height: 64vh; display: block; margin: 0 auto; }
#r-meta { margin: 2px 0 10px; text-align: center; font-weight: 700; font-size: 14px; color: #555; }
#r-rec { margin-left: 8px; color: #d23a2c; font-weight: 900; }
.row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
#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, #next { flex: 1; font-size: 15px; padding: 10px 4px; white-space: nowrap; }
#r-after { margin-top: 18px; }
#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); }
#r-row { margin-top: 8px; }

/* the お題: the sheep, still in full fleece, says what it wants */
.o-head { margin: 0; font-size: 15px; font-weight: 800; color: #45433e; letter-spacing: 4px; }
#o-art { width: 100%; height: clamp(170px, 34vh, 260px); display: block; margin: 4px auto 0; }
#o-say { margin: 4px 0 0; font-size: clamp(20px, 6.4vw, 28px); font-weight: 900; word-break: auto-phrase; text-wrap: pretty; }
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; }
