* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #04030b; color: #f3eee2; overflow: hidden;
  font-family: "Zen Old Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
#wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#stage { position: relative; width: 390px; height: 720px; transform-origin: center center; flex: none; overflow: hidden; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px; text-align: center; }
.hidden { display: none !important; }
.brush { font-family: "Yuji Syuku", "Hiragino Mincho ProN", serif; }

/* タイトル */
#title { justify-content: flex-start; padding-top: 92px; background: linear-gradient(rgba(4,3,12,.15), rgba(4,3,12,.0) 40%, rgba(4,3,12,.55) 80%); }
.logo { font-family: "Yuji Syuku", serif; font-size: 62px; line-height: 1.1; letter-spacing: 0; white-space: nowrap; color: #f1fbff;
  text-shadow: 0 0 10px #8fdcff, 0 0 30px #2f7cff, 0 0 60px rgba(47,124,255,.6), 3px 4px 0 rgba(0,0,0,.6); }
.sub { font-family: "Yuji Syuku", serif; font-size: 23px; color: #d4eeff; margin-top: -2px; letter-spacing: .2em;
  text-shadow: 0 2px 6px #000; }
.sp { height: 6px; }
.rule { font-size: 17px; line-height: 1.85; color: #f1e9d6; text-shadow: 0 1px 4px #000, 0 0 12px rgba(0,0,0,.9);
  background: rgba(6,5,20,.45); padding: 10px 16px; border-radius: 6px; }
button { font-family: inherit; color: #fff; cursor: pointer; }
button.big { font-family: "Yuji Syuku", serif; font-size: 26px; letter-spacing: .2em; padding: 12px 40px 12px 48px;
  border: 1px solid rgba(255,220,180,.7); border-radius: 4px;
  background: linear-gradient(#c8323e, #8e1626); box-shadow: 0 0 0 3px rgba(20,5,10,.6), 0 0 22px rgba(255,90,80,.45), inset 0 1px 0 rgba(255,255,255,.3);
  text-shadow: 0 1px 2px rgba(0,0,0,.5); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 3px rgba(20,5,10,.6), 0 0 34px rgba(255,120,100,.7), inset 0 1px 0 rgba(255,255,255,.3); } }
button.big:active { transform: scale(.97); }
button.mid { font-size: 17px; padding: 9px 22px; border: 1px solid rgba(190,225,255,.55); border-radius: 4px; background: rgba(20,40,90,.55); }
.fz { font-size: 15px; color: #e5ddc8; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center;
  text-shadow: 0 1px 3px #000; }
.fz button { font-size: 15px; padding: 5px 12px; border: 1px solid rgba(190,225,255,.45); border-radius: 4px; background: rgba(10,14,40,.6); }
.fz button.on { background: #2c5fc0; border-color: #cfeaff; }
.ver { position: absolute; bottom: 12px; right: 14px; font-size: 13px; color: #a29cb0; }

/* 結果：和紙の巻物 */
#result, #over { background: rgba(4,3,12,.55); }
.paper { width: 330px; padding: 20px 22px 18px; color: #2a1d12; border-radius: 3px; position: relative;
  background: radial-gradient(ellipse at 30% 20%, #fbf3df, #efe2c2 70%, #e2d0a8);
  box-shadow: 0 10px 40px rgba(0,0,0,.7), inset 0 0 30px rgba(140,100,40,.25); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.paper::before, .paper::after { content: ""; position: absolute; left: -8px; right: -8px; height: 12px; border-radius: 6px;
  background: linear-gradient(#5a2a14, #2a120a); }
.paper::before { top: -8px; } .paper::after { bottom: -8px; }
.rtitle { font-family: "Yuji Syuku", serif; font-size: 30px; color: #1a1210; letter-spacing: .1em; }
#over .rtitle { color: #f1fbff; text-shadow: 0 0 14px #4fb6ff; font-size: 34px; }
#over .rule { background: rgba(6,5,20,.6); }
.rank { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.rank .rk { font-size: 14px; color: #7a5a3a; letter-spacing: .3em; }
.rank b { font-family: "Yuji Syuku", serif; font-weight: normal; font-size: 40px; color: #b0182c; }
.rank .rs { font-size: 15px; color: #4a3826; margin-top: 4px; }
.rows { font-size: 17px; line-height: 1.7; width: 100%; border-top: 1px solid rgba(90,60,30,.35); padding-top: 6px; }
.rows div { display: flex; justify-content: space-between; gap: 20px; }
.rows .one span:last-child { color: #b0182c; font-family: "Yuji Syuku", serif; }
.rows .sum { border-top: 1px solid rgba(90,60,30,.35); margin-top: 4px; padding-top: 4px; font-weight: 700; }
.share { font-size: 14px; color: #3a2a1a; white-space: pre-line; background: rgba(120,80,30,.1); padding: 8px 12px; border-radius: 3px; width: 100%; }
.btns { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 18px; }

.hint { position: absolute; left: 10px; right: 10px; top: 10px; z-index: 20; font-size: 15px; line-height: 1.6;
  background: rgba(16,20,44,.95); border: 1px solid #6fa8ff; border-radius: 8px; padding: 10px 40px 10px 12px; color: #fff; }
.hint.bottom { top: auto; bottom: 10px; }
.hint .x { position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; padding: 0; font-size: 18px; background: none; border: none; }

#rotate { position: fixed; inset: 0; z-index: 50; background: #04030b; display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #dff4ff; padding: 20px; text-align: center; }

/* 文字の大きさ（大＝1.15倍、特大＝1.3倍） */
#stage.fz1 .screen > *:not(.logo):not(.paper), #stage.fz1 .hint { zoom: 1.15; }
#stage.fz2 .screen > *:not(.logo):not(.paper), #stage.fz2 .hint { zoom: 1.3; }
/* 結果の巻物は、文字を大きくしても画面に収まるように、行の間を詰める */
#stage.fz1 .paper > * { zoom: 1.1; }
#stage.fz2 .paper > * { zoom: 1.18; }
#stage.fz1 .paper, #stage.fz2 .paper { width: 350px; gap: 6px; padding: 14px 18px 12px; }
#stage.fz1 .rows, #stage.fz2 .rows { line-height: 1.45; }
#stage.fz2 .rank b { font-size: 34px; }
#stage.fz1 #result, #stage.fz2 #result { gap: 10px; }
#stage.fz1 .btns, #stage.fz2 .btns { margin-top: 8px; gap: 8px; }
#result { overflow-y: auto; }
