:root {
  --blue: #2b5fb4;
  --blue2: #3d7be0;
  --ink: #1f2a3a;
  --muted: #64748b;
  --panel: rgba(255, 255, 255, 0.94);
  --line: #d6dde6;
  --ok: #1f9d55;
  --ng: #d0452f;
  --bar-h: 50px;
  font-family: 'M PLUS Rounded 1c', system-ui, -apple-system, 'Hiragino Maru Gothic ProN', 'Hiragino Sans', sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #e7ebef;
  overscroll-behavior: none;
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  touch-action: manipulation;
}
button:hover:not(:disabled) {
  border-color: #9fb3cc;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button.primary {
  background: linear-gradient(180deg, var(--blue2), var(--blue));
  border-color: var(--blue);
  color: #fff;
  font-weight: 700;
}
button.on {
  background: #e3edfc;
  border-color: var(--blue2);
  color: var(--blue);
  font-weight: 700;
}
button.icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-weight: 700;
}
button.wide {
  width: 100%;
}
button.small {
  padding: 4px 8px;
  font-size: 12px;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}

#topbar {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(180deg, #2f66c2, #2756a6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 5;
}
.brand {
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 16px;
}
#tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
#tabs button {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 7px 12px;
}
#tabs button.active {
  background: #fff;
  color: var(--blue);
  font-weight: 800;
}
#topbar .icon {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

main {
  position: absolute;
  top: calc(var(--bar-h) + env(safe-area-inset-top));
  left: 0;
  right: 0;
  bottom: 0;
}
.screen {
  position: absolute;
  inset: 0;
  display: none;
}
.screen.active {
  display: block;
}

/* ---------- 折る ---------- */
#fold-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
}
.hint-bubble {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 30, 60, 0.78);
  color: #fff;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  max-width: calc(100% - 24px);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hint-bubble.low {
  top: auto;
  bottom: 210px;
}
.fold-bottom .hint-bubble {
  position: static;
  transform: none;
  align-self: center;
  white-space: normal;
}
.zoom {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.zoom button {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 20px;
  background: var(--panel);
}
.fold-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.fold-bottom > * {
  pointer-events: auto;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.toolbar > button:not(.primary) {
  background: var(--panel);
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}
.seg button {
  border: 0;
  border-radius: 0;
  background: transparent;
}
.seg button + button {
  border-left: 1px solid var(--line);
}
.seg button.on {
  background: #e3edfc;
}

/* ---------- 3D 共通 ---------- */
.three-host {
  position: absolute;
  inset: 0;
}
.three-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.busy {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  background: rgba(20, 30, 60, 0.82);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  z-index: 4;
}

/* ---------- 仕上げ ---------- */
#screen-shape .three-host {
  right: 360px;
}
.panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  background: #fff;
  border-left: 1px solid var(--line);
  overflow: auto;
  padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
}
.panel h3 {
  margin: 16px 0 4px;
  font-size: 15px;
}
.panel p {
  margin: 4px 0;
}
.angle-row,
.slider {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  font-size: 13px;
  margin: 8px 0;
}
.angle-row {
  grid-template-columns: 1fr auto;
}
.angle-row .name {
  font-weight: 600;
}
.angle-row input {
  grid-column: 1 / span 2;
}
.angle-row .val {
  grid-row: 1;
  grid-column: 2;
  color: var(--blue);
  font-weight: 700;
}
.slider {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}
.slider select {
  grid-column: 2 / span 2;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.slider span {
  min-width: 54px;
  text-align: right;
  font-weight: 700;
  color: var(--blue);
}
input[type='range'] {
  width: 100%;
  accent-color: var(--blue);
  height: 26px;
}
.row {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}
.row > button {
  flex: 1;
}
.specs {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 13px;
  margin: 4px 0;
}
.specs dt {
  color: var(--muted);
}
.specs dd {
  margin: 0;
  font-weight: 600;
}
.test-result {
  font-size: 13px;
  margin: 6px 0 12px;
}
.verdict {
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff3e6;
  color: #a4500f;
  margin-bottom: 4px;
}
.verdict.good {
  background: #e6f6ec;
  color: var(--ok);
}

/* ---------- 飛ばす ---------- */
.fly-top {
  position: absolute;
  left: 10px;
  top: 10px;
  max-width: min(420px, calc(100% - 150px));
  background: var(--panel);
  border-radius: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
}
.fly-top select {
  font-weight: 800;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  max-width: 100%;
}
.fly-top .best {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  margin-top: 2px;
}
.fly-right {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.fly-right button {
  background: var(--panel);
  font-size: 13px;
}
.tele {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  background: rgba(20, 30, 60, 0.72);
  color: #dfe8f5;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 12px;
  max-width: calc(100% - 20px);
}
.tele b {
  color: #fff;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.fly-controls {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 20px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 14px 10px;
  margin-bottom: env(safe-area-inset-bottom);
  transition: opacity 0.2s, transform 0.2s;
}
.fly-controls.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
}
.fly-controls .slider {
  margin: 2px 0;
}
.fly-controls .slider[hidden] {
  display: none;
}
.fire-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
button.big {
  font-size: 18px;
  padding: 10px 26px;
  border-radius: 12px;
}
.result {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.97);
  border-radius: 18px;
  padding: 18px 22px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  width: min(440px, calc(100% - 24px));
}
.result[hidden] {
  display: none;
}
.res-title {
  color: var(--muted);
  font-weight: 700;
}
.res-big {
  font-size: 40px;
  font-weight: 900;
  color: var(--blue);
  margin: 4px 0;
}
.res-big.ng {
  color: var(--ng);
}
.res-new {
  display: inline-block;
  background: #ffd23a;
  color: #6a4b00;
  font-weight: 900;
  border-radius: 999px;
  padding: 3px 14px;
  margin-bottom: 6px;
}
.res-sub {
  font-weight: 700;
  margin: 4px 0;
}
.res-extra {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 12px;
}
.res-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- ダイアログ ---------- */
.dialog {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 45, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 12px;
}
.dialog[hidden] {
  display: none;
}
.dialog-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 16px 18px;
  width: min(560px, 100%);
  max-height: calc(100% - 24px);
  overflow: auto;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.3);
}
.dialog-card h2 {
  margin: 4px 40px 8px 0;
  font-size: 18px;
}
.dialog-card h3 {
  font-size: 14px;
  margin: 14px 0 6px;
}
.dialog .close {
  position: absolute;
  right: 12px;
  top: 12px;
}
.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  white-space: normal;
  margin: 6px 0;
  padding: 10px 12px;
}
.card span {
  font-size: 12px;
  color: var(--muted);
}
.card-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  white-space: normal;
}
.chip small {
  color: var(--muted);
  font-size: 11px;
}
.chip.color {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}
.chip i {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid #0002;
  display: inline-block;
}
.dialog .primary.wide {
  margin-top: 16px;
  padding: 12px;
}
ol.help li {
  margin: 6px 0;
  font-size: 14px;
}
ol.help ul {
  padding-left: 18px;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--bar-h) + 70px);
  transform: translate(-50%, -12px);
  background: rgba(20, 30, 60, 0.9);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  z-index: 30;
  max-width: calc(100% - 24px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  text-align: center;
}

/* ---------- スマホ ---------- */
@media (max-width: 760px) {
  .brand {
    display: none;
  }
  #tabs {
    margin-left: 0;
    flex: 1;
  }
  #tabs button {
    flex: 1;
    padding: 7px 4px;
    font-size: 13px;
  }

  .hint-bubble {
    font-size: 12px;
    white-space: normal;
    border-radius: 12px;
  }
  .hint-bubble.low {
    top: auto;
    bottom: 236px;
  }
  /* スマホでは紙の角にかぶるので出さない（2 本指で拡大できる・折るたびに自動で合わせる） */
  .zoom {
    display: none;
  }
  #screen-shape .three-host {
    right: 0;
    bottom: 55%;
  }
  .panel {
    top: 45%;
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.08);
  }
  .fly-top {
    max-width: calc(100% - 130px);
  }
  .fly-top #fly-desc {
    display: none;
  }
  .fly-right button {
    font-size: 12px;
    padding: 6px 8px;
  }
  .res-big {
    font-size: 32px;
  }
}

/* ---------- 折る：新しい道具 ---------- */
.toolbar .toggle {
  background: var(--panel);
  border-radius: 999px;
  padding: 7px 12px;
}
.toolbar .toggle.on {
  background: #ffe9d6;
  border-color: #e8590c;
  color: #a4400a;
  font-weight: 700;
}
.toolbar.options button:disabled {
  opacity: 0.35;
}
.tool {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 64px;
  padding: 6px 8px;
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 2px 6px rgba(60, 40, 10, 0.12);
}
.tool b {
  font-size: 21px;
  line-height: 1.1;
}
.tool span {
  font-size: 12px;
  font-weight: 700;
}
.tool.primary {
  min-width: 84px;
}
.tool.primary.pulse {
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(61, 123, 224, 0.25);
  }
}
.guide-bar {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: min(620px, calc(100% - 16px));
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff7ef;
  border: 2px solid #e8590c;
  border-radius: 16px;
  padding: 8px 10px;
  box-shadow: 0 4px 16px rgba(120, 60, 10, 0.18);
  z-index: 3;
}
.guide-bar[hidden] {
  display: none;
}
.g-num {
  background: #e8590c;
  color: #fff;
  font-weight: 900;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  white-space: nowrap;
}
.g-say {
  flex: 1;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.35;
}
.guide-bar button {
  flex: none;
}
#g-demo {
  border-color: #e8590c;
  color: #a4400a;
  font-weight: 700;
}
.guide-bar:not([hidden]) ~ .zoom {
  top: 84px;
}
.preset {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0;
}
.preset > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.preset span {
  font-size: 12px;
  color: var(--muted);
}
.preset-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.menu-list button {
  text-align: left;
  padding: 12px;
}
.step-list {
  max-height: 30vh;
  overflow: auto;
  font-size: 13px;
}

/* ---------- 仕上げ：かんたん ---------- */
.big-slider {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 8px;
  font-weight: 800;
  font-size: 15px;
  margin: 6px 0 12px;
}
.big-slider > span {
  color: var(--blue);
  font-size: 14px;
}
.big-slider input,
.big-slider .seg {
  grid-column: 1 / span 2;
}
.big-slider input[type='range'] {
  height: 34px;
}
.big-slider .seg {
  display: flex;
  margin-top: 4px;
}
.big-slider .seg button {
  flex: 1;
  font-weight: 700;
}
button.big {
  font-size: 18px;
  padding: 12px;
  border-radius: 14px;
  margin: 6px 0 4px;
}
.more {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.more summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
}

/* ---------- スマホ（あとから定義した道具の上書き）---------- */
@media (max-width: 760px) {
  .seg button,
  .toolbar .toggle {
    padding: 7px 9px;
    font-size: 13px;
  }
  .toolbar.options {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
    padding: 0 2px;
  }
  .toolbar.options > * {
    flex: none;
  }
  .toolbar.main-tools {
    flex-wrap: nowrap;
    gap: 4px;
  }
  .tool {
    flex: 1 1 0;
    min-width: 0;
    padding: 5px 2px;
    overflow: hidden;
  }
  .tool.primary {
    min-width: 0;
    flex: 1.3 1 0;
  }
  .tool b {
    font-size: 19px;
  }
  .tool span {
    font-size: 11px;
    letter-spacing: -0.02em;
  }
  .guide-bar {
    padding: 6px 8px;
    gap: 6px;
  }
  .g-say {
    font-size: 14px;
  }
  .preset {
    flex-direction: column;
    align-items: stretch;
  }
  .preset-btns {
    flex-direction: row;
  }
  .preset-btns button {
    flex: 1;
  }
}

/* ================= ゲーム（飛ばす画面） ================= */
body.in-game #topbar {
  background: linear-gradient(180deg, #7cc8ff, #5ab4f5);
  box-shadow: none;
}
body.in-game #tabs button {
  border-radius: 999px;
}
.game {
  --g-ink: #3b4a7a;
  color: var(--g-ink);
}
.game button {
  font-family: inherit;
}
#confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8;
}
.g-top {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
  z-index: 3;
}
.g-top > * {
  pointer-events: auto;
}
.g-top-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.g-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px 8px 10px;
  font-weight: 900;
  font-size: 15px;
  color: var(--g-ink);
  box-shadow: 0 4px 0 #c9dcf2, 0 8px 18px rgba(60, 90, 160, 0.18);
}
#stage-icon {
  font-size: 22px;
}
.stars {
  color: #ffc24b;
  letter-spacing: 1px;
  -webkit-text-stroke: 0.5px #e49a12;
}
.stars i,
.s-stars i {
  font-style: normal;
  color: #dfe7f2;
  -webkit-text-stroke: 0;
}
.g-badge {
  background: #ffc24b;
  color: #fff;
  font-weight: 900;
  border-radius: 999px;
  padding: 7px 14px;
  box-shadow: 0 4px 0 #e49a12;
  text-shadow: 0 1px 0 rgba(160, 90, 0, 0.4);
  font-size: 14px;
}
.g-badge {
  white-space: nowrap;
}
#screen-fly:not([data-phase='aim']) .g-yaw,
#screen-fly:not([data-phase='aim']) .g-hint {
  display: none;
}
.g-badge[hidden] {
  display: none;
}
.g-round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  font-size: 20px;
  font-weight: 900;
  color: var(--g-ink);
  box-shadow: 0 4px 0 #c9dcf2, 0 6px 14px rgba(60, 90, 160, 0.18);
  padding: 0;
}
.g-round.small {
  width: 38px;
  height: 38px;
  font-size: 14px;
}
.g-round:active,
.g-pill:active,
.g-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #c9dcf2;
}
.g-pop {
  position: absolute;
  top: 64px;
  right: 10px;
  background: #fff;
  border-radius: 20px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 10px 30px rgba(60, 90, 160, 0.25);
  z-index: 6;
  min-width: 200px;
}
.g-pop[hidden] {
  display: none;
}
.g-pop button {
  border: 0;
  border-radius: 12px;
  background: #f1f6fd;
  text-align: left;
  font-weight: 700;
  padding: 10px 12px;
}
.g-pop button.on {
  background: #dff1ff;
  color: #1f7bd0;
}
.g-pop label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
  font-weight: 700;
  font-size: 13px;
  padding: 4px 6px;
}
.g-pop label[hidden] {
  display: none;
}
.g-wind {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  box-shadow: 0 4px 0 #c9dcf2;
}
.g-wind[hidden] {
  display: none;
}
.g-counter {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: #fff;
  text-shadow: 0 3px 0 rgba(40, 80, 160, 0.45), 0 0 18px rgba(40, 80, 160, 0.3);
  pointer-events: none;
}
.g-counter[hidden] {
  display: none;
}
.g-counter b {
  font-size: 64px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.g-counter small {
  font-size: 26px;
  font-weight: 900;
  margin-left: 4px;
}
.g-counter span {
  display: block;
  font-weight: 800;
  font-size: 16px;
  margin-top: -6px;
}
.g-hint {
  position: absolute;
  bottom: 86px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
  box-shadow: 0 5px 0 #c9dcf2, 0 10px 24px rgba(60, 90, 160, 0.2);
  pointer-events: none;
  animation: bob 1.6s ease-in-out infinite;
}
.g-hint[hidden] {
  display: none;
}
.g-hint b {
  color: #ff6b8b;
}
.g-hint .hand {
  display: inline-block;
  margin-right: 6px;
  animation: drag 1.6s ease-in-out infinite;
}
@keyframes bob {
  50% {
    transform: translate(-50%, -4px);
  }
}
@keyframes drag {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-8px, 6px);
  }
}
.g-power {
  position: absolute;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  width: min(320px, 80%);
  text-align: center;
  pointer-events: none;
}
.g-power[hidden] {
  display: none;
}
.g-power .bar {
  height: 18px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 3px;
  box-shadow: 0 4px 0 #c9dcf2;
}
.g-power .bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  width: 0;
  transition: background 0.2s;
}
.g-power span {
  display: inline-block;
  margin-top: 8px;
  font-weight: 900;
  font-size: 20px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(40, 80, 160, 0.5);
}
.g-yaw {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 5px 6px;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 4px 0 #c9dcf2;
}
.g-yaw span {
  min-width: 72px;
  text-align: center;
}
body.in-game .g-yaw {
  transition: opacity 0.2s;
}
.g-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: rgba(120, 170, 230, 0.25);
  backdrop-filter: blur(2px);
  z-index: 7;
  padding: 16px;
}
.g-overlay[hidden] {
  display: none;
}
.result-wrap {
  background: transparent;
  backdrop-filter: none;
  align-items: flex-end;
  padding-bottom: 18px;
}
.g-card {
  position: relative;
  max-height: 100%;
  overflow: auto;
  margin: auto;
  background: #fff;
  border-radius: 28px;
  padding: 22px 22px 18px;
  width: min(420px, 100%);
  text-align: center;
  box-shadow: 0 8px 0 #c9dcf2, 0 18px 40px rgba(60, 90, 160, 0.3);
  animation: popin 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes popin {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}
.g-title {
  font-size: 26px;
  font-weight: 900;
  color: #ff6b8b;
  margin-bottom: 6px;
}
.g-btn {
  border: 0;
  border-radius: 18px;
  font-weight: 900;
  font-size: 17px;
  padding: 13px 18px;
  color: #fff;
  background: #5ec8ff;
  box-shadow: 0 5px 0 #2f9ad6;
}
.g-btn.go {
  background: #6fd66b;
  box-shadow: 0 5px 0 #43a83f;
  font-size: 20px;
}
.g-btn.sub {
  background: #f1f6fd;
  color: var(--g-ink);
  box-shadow: 0 5px 0 #c9dcf2;
}
.r-stars {
  font-size: 46px;
  letter-spacing: 6px;
  line-height: 1.1;
}
.r-stars span {
  color: #e6edf6;
  display: inline-block;
}
.r-stars span.on {
  color: #ffc24b;
  -webkit-text-stroke: 1.5px #e49a12;
  animation: starpop 0.45s cubic-bezier(0.2, 1.8, 0.4, 1) both;
}
@keyframes starpop {
  from {
    transform: scale(0) rotate(-40deg);
  }
}
.r-big {
  font-size: 54px;
  font-weight: 900;
  color: var(--g-ink);
  line-height: 1.1;
}
.r-big small {
  font-size: 24px;
  margin-left: 4px;
}
.res-card {
  padding-top: 40px;
}
.res-card.ng .r-big {
  font-size: 34px;
  color: #8a96b8;
}
.r-sub {
  font-weight: 800;
  margin-top: 4px;
}
.r-extra {
  font-size: 12px;
  color: #8a96b8;
  margin: 6px 0 14px;
}
.r-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.r-btns .g-btn {
  flex: 1;
  min-width: 100px;
}
.ribbon {
  font-size: 13px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  background: #ff6b8b;
  color: #fff;
  font-weight: 900;
  padding: 6px 18px;
  border-radius: 12px;
  box-shadow: 0 4px 0 #d64a6c;
  white-space: nowrap;
}
.prep-plane {
  font-size: 54px;
  color: #5ec8ff;
  animation: fly 1.2s ease-in-out infinite;
}
@keyframes fly {
  50% {
    transform: translate(16px, -10px) rotate(-8deg);
  }
}
.pc-sub {
  color: #8a96b8;
  font-size: 13px;
  margin-bottom: 10px;
}
.pc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 900;
  font-size: 17px;
  padding: 6px 8px;
  border-radius: 12px;
  background: #f5f9ff;
  margin: 6px 0;
}
.pc-row .st {
  color: #e6edf6;
  font-size: 22px;
}
.pc-row .st.on {
  color: #ffc24b;
}
.pc-say {
  font-weight: 800;
  margin: 10px 0 14px;
}
.plane-card .g-btn {
  width: 100%;
}
.stage-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 10px 0 14px;
}
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 0;
  border-radius: 18px;
  background: #f1f6fd;
  padding: 12px 6px;
  box-shadow: 0 4px 0 #c9dcf2;
  white-space: normal;
}
.stage.cur {
  background: #dff1ff;
  outline: 3px solid #5ec8ff;
}
.s-icon {
  font-size: 30px;
}
.s-name {
  font-weight: 900;
  font-size: 14px;
}
.s-stars {
  color: #ffc24b;
  font-size: 18px;
  letter-spacing: 2px;
}
.g-popup {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 34px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 0 #ff6b8b, 0 0 20px rgba(255, 107, 139, 0.6);
  pointer-events: none;
  z-index: 9;
  animation: popup 1.2s ease-out forwards;
}
@keyframes popup {
  0% {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -90%) scale(1);
    opacity: 0;
  }
}
@media (max-width: 760px) {
  .g-pill {
    font-size: 13px;
    padding: 7px 12px 7px 8px;
  }
  .g-counter b {
    font-size: 52px;
  }
  .g-badge {
    font-size: 12px;
    padding: 6px 10px;
  }
  .g-top-right {
    gap: 6px;
  }
  .g-round {
    width: 40px;
    height: 40px;
  }
  .g-hint {
    font-size: 14px;
    padding: 10px 16px;
  }
  .r-big {
    font-size: 46px;
  }
}
