* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #f4efe6;
  color: #1f1b18;
  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;
}
h1, p, span, div, button, a { word-break: auto-phrase; text-wrap: pretty; }
[hidden] { display: none !important; }

#app {
  touch-action: none;
  position: fixed;
  inset: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px) 0;
  max-width: 560px;
  margin: 0 auto;
}
#c {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#mirror {
  position: absolute;
  right: 16px;
  top: min(calc(100% - 70px), calc(78% - 28px));
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 252, 246, 0.94);
  box-shadow: 0 4px 14px rgba(31, 27, 24, 0.18);
  cursor: pointer;
  touch-action: manipulation;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.16s ease, box-shadow 0.2s ease;
}
#mirror::before {
  content: "";
  position: absolute;
  inset: -6px;
}
#mirror:active { transform: scale(0.93); }
#mirror.spark {
  animation: mirror-pop 0.65s cubic-bezier(0.22, 1.4, 0.36, 1);
  box-shadow: 0 6px 18px rgba(43, 76, 94, 0.32), 0 0 0 3px rgba(255, 255, 255, 0.9);
}
@keyframes mirror-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18) rotate(-8deg); }
  100% { transform: scale(1) rotate(0deg); }
}
#mirror svg { width: 56px; height: 56px; display: block; }
#mirror .ring-bg { fill: none; stroke: rgba(31, 27, 24, 0.12); stroke-width: 3.5; }
#mirror .ring-fg {
  fill: none;
  stroke: #2b4c5e;
  stroke-width: 3.8;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 32px 32px;
  stroke-dasharray: 182.2;
  stroke-dashoffset: 182.2;
}

.panel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  background: #f4efe6;
}
#title { background: rgba(244, 239, 230, 0.96); }
#result { align-items: flex-start; padding-top: 10px; }

.box { width: 100%; max-width: 350px; text-align: center; margin: auto; }
.box.wide { max-width: 500px; margin: 0 auto; }

#tart {
  width: 100%;
  height: clamp(160px, 34vh, 250px);
  display: block;
  margin: 0 auto 8px;
}
h1 {
  font-size: 48px;
  letter-spacing: 4px;
  margin: 0 0 14px;
  white-space: nowrap;
}

button, .button {
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  color: #1f1b18;
  background: #fffdf9;
  border: 2px solid #1f1b18;
  border-radius: 24px;
  height: 46px;
  padding: 0 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}
button.primary, .button.primary {
  background: #1f1b18;
  color: #fffdf9;
}
button.big {
  width: 100%;
  height: 54px;
  font-size: 19px;
  border-radius: 27px;
}
button:disabled { opacity: 0.45; cursor: default; }
#title-guide { min-height: 28px; margin-top: 12px; font-size: 13px; }

#card {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(262px, calc(100vh - 240px));
  aspect-ratio: 1200 / 630;
  margin: 0 auto;
  border-radius: 10px;
  border: 2px solid rgba(31, 27, 24, 0.16);
  box-shadow: 0 6px 20px rgba(31, 27, 24, 0.08);
}

.row {
  display: flex;
  gap: 8px;
  justify-content: center;
  max-width: 440px;
  margin: 8px auto 0;
}
#r-post {
  flex: 1.65;
  background: #1f1b18;
  color: #fffdf9;
  font-size: 16px;
  padding: 0 10px;
}
#r-post svg { width: 16px; height: 16px; }
#again { flex: 1; font-size: 15px; padding: 0 8px; }
#r-row { max-width: 440px; margin: 6px auto 0; }
#r-after { max-width: 440px; margin: 10px auto 0; }
.sn-chip { min-height: 36px; }
