/* The rope rack, the slip overlay and the slip itself: taken from Pon Pon Park's omikuji.css. */

/* ---------- rope rack ---------- */
.rack {
  position: relative; width: var(--omw); aspect-ratio: 120 / 232;
  transform-origin: 50% 100%;
  transition: filter .2s, scale .2s;
}
.rack.drop-target { scale: 1.05; filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 8px var(--coral-deep)); }
.rack-art { width: 100%; height: 100%; overflow: visible; }
.rk-post { fill: #fff4e2; stroke: var(--straw-deep); stroke-width: 1.5; }
.rk-foot { fill: var(--straw-deep); }
.rk-roof { fill: #f9bba8; stroke: #e3a08c; stroke-width: 1.2; stroke-linejoin: round; }
.rk-roof-top { fill: var(--coral-deep); stroke: #d98b77; stroke-width: 1.2; stroke-linejoin: round; }
.rk-gold { fill: #f6dc96; stroke: #e2c070; stroke-width: 1; }
.rk-sign { fill: #fffdf8; stroke: #f3cfc2; stroke-width: 1.2; }
.rk-sign-text { font-family: var(--font); font-weight: 700; font-size: 6.4px; letter-spacing: .06em; fill: var(--coral-ink); }
.rk-rope { transform-box: view-box; }
.rk-rope-main { fill: none; stroke: var(--straw); stroke-width: 3.2; stroke-linecap: round; }
.rk-rope-twist { fill: none; stroke: var(--straw-deep); stroke-width: 3.2; stroke-dasharray: 1.5 3; stroke-linecap: round; opacity: .75; }
.rack-knots { position: absolute; inset: 0; pointer-events: none; }
.knot {
  position: absolute; width: 11%; aspect-ratio: 16 / 34;
  transform: translate(-50%, -50%) rotate(var(--tilt, 0deg));
  filter: drop-shadow(0 1.5px 1.5px rgba(90, 80, 140, .18));
}
.knot svg { width: 100%; height: 100%; overflow: visible; }
.kn-paper { fill: #fffdf8; stroke: #ddd5ea; stroke-width: 1; stroke-linejoin: round; }
.kn-line { fill: none; stroke: #e8e1f2; stroke-width: .8; stroke-linecap: round; }
.knot.mine .kn-paper { fill: #fff6f1; stroke: #f2b9a6; }
.knot.mine .kn-line { stroke: #f8d3c6; }
.rack-more {
  position: absolute; right: 2%; bottom: 7%;
  min-width: 30px; padding: 3px 8px; border-radius: 999px; text-align: center;
  background: var(--paper); color: var(--coral-ink); font-size: 12px; font-weight: 700;
  box-shadow: 0 2px 0 #f3cfc2, 0 4px 10px rgba(110, 95, 170, .15);
}
.rack-more[hidden] { display: none; }
.knot-burst { position: fixed; width: 0; height: 0; z-index: 80; pointer-events: none; }
.knot-burst span {
  position: absolute; left: 0; top: 0; width: 12px; height: 12px;
  background: #ffd6c8;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}
.knot-burst span:nth-child(3n) { background: #f6dc96; }
.knot-burst span:nth-child(3n+1) { background: #fff; filter: drop-shadow(0 0 2px #eaa08c); }
/* ---------- reveal overlay ---------- */
.o-reveal { position: fixed; inset: 0; z-index: 50; }
.o-reveal[hidden] { display: none; }
.o-backdrop {
  position: absolute; inset: 0; opacity: 0;
  background: rgba(255, 244, 238, .86);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.o-scroll {
  position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(170px + env(safe-area-inset-bottom));
  -webkit-user-select: text; user-select: text;
}
.o-sheet { width: min(390px, 100%); margin: 0 auto; }
.o-kind {
  margin: 0 auto 10px; width: fit-content; padding: 5px 14px; border-radius: 999px;
  background: #fff; color: var(--ink-soft); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 2px 0 #eee6f6;
}
.o-kind.today { background: var(--coral); color: var(--coral-ink); box-shadow: 0 2px 0 #f3bfae; }
.o-drag-hint { margin: 0 0 10px; text-align: center; font-size: 13px; color: var(--ink-soft); }
.o-credit { margin: 12px 0 0; text-align: center; font-size: 11.5px; color: var(--ink-soft); }
.o-fx-stage {
  position: absolute; inset: 0; display: grid; place-items: center; grid-template: 100% / 100%;
  pointer-events: none; overflow: hidden;
}
.o-fx-stage > * { grid-area: 1 / 1; }
.o-reveal .reveal-glow { --m-main: var(--coral); }
.o-folded {
  width: 64px; height: 86px; opacity: 0; position: relative;
  border-radius: 8px; background: #fffdf8;
  box-shadow: 0 8px 16px rgba(90, 80, 140, .2), inset 0 0 0 2px #f1e9f7;
}
.o-folded::before { /* tone band at the top, like the slip header */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 30%;
  border-radius: 8px 8px 0 0; background: var(--tone, #ebe7f5);
}
.o-folded span { /* fold lines */
  position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, transparent 0 20px, rgba(170, 155, 210, .3) 20px 22px);
}
.o-reveal.tone-mint { --tone: #d4f3e6; }
.o-reveal.tone-peach { --tone: #ffe1d6; }
.o-reveal.tone-gold { --tone: #fff1c2; }
.o-reveal.tone-kyo { --tone: #ebe7f5; }
.o-strip {
  position: fixed; z-index: 75; width: 74px; height: 18px; pointer-events: none;
  border-radius: 5px; background: linear-gradient(90deg, var(--tone, #ebe7f5) 0 22%, #fffdf8 22%);
  box-shadow: 0 6px 14px rgba(90, 80, 140, .25), inset 0 0 0 1.5px #e3dcee;
}
.o-strip.tone-kyo { --tone: #d3cce6; }
.o-strip.tone-mint { --tone: #a9e2cb; }
.o-strip.tone-peach { --tone: #ffc7b3; }
.o-strip.tone-gold { --tone: #f6cf63; }

.o-actions {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(255, 246, 241, .94) 30%);
  opacity: 0; translate: 0 30px; pointer-events: none;
  transition: opacity .3s, translate .35s cubic-bezier(.3, 1.3, .5, 1);
}
.o-actions.show { opacity: 1; translate: 0 0; pointer-events: auto; }
.o-actions-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 420px; margin: 0 auto; }
/* Tie emphasis by rank. 凶: Tie is the big primary button on its own line. */
.o-actions-row .o-tie { flex: 1 0 100%; }
.btn.o-tie { background: var(--coral); border-color: var(--coral-deep); color: var(--coral-ink); box-shadow: 0 4px 0 var(--coral-deep); }
.btn.o-tie:active { box-shadow: 0 1px 0 var(--coral-deep); }
.o-tie svg { width: 22px; height: 22px; }
/* 末吉 / 末小吉: Tie and Keep share the first line, same size and same soft look. */
.lv-even .o-even { flex: 1 1 calc(50% - 5px); min-width: 0; padding: 0 12px; }
.btn.o-even { background: #fff6f1; border-color: #f3cfc2; color: var(--coral-ink); box-shadow: 0 4px 0 #f3cfc2; }
.btn.o-even:active { box-shadow: 0 1px 0 #f3cfc2; }
.o-even svg { width: 22px; height: 22px; }
/* good ranks: a small ghost button under the row, still a comfortable tap target */
.o-tie-soft {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; margin: 8px auto 0; padding: 0 16px; border-radius: 999px;
  border: 2px dashed #f3cfc2; background: rgba(255, 255, 255, .55); color: var(--coral-ink);
  font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: transform .08s, background .15s;
}
.o-tie-soft:hover { background: #fff6f1; }
.o-tie-soft:active { transform: translateY(2px); }
.o-tie-soft svg { width: 17px; height: 17px; }
.o-status { margin: 8px 0 0; min-height: 18px; text-align: center; font-size: 13px; color: var(--ink-soft); }

/* ---------- the slip (approved layout from omikuji/preview.html) ---------- */
.ok-slip {
  --tone: #d4f3e6; --tone-deep: #a9e2cb; --tone-ink: #2f6b57; --edge: #e3f6ee;
  position: relative;
  background: var(--paper);
  border-radius: 22px;
  border: 3px solid var(--edge);
  box-shadow: 0 5px 0 var(--edge), 0 18px 40px rgba(110, 95, 170, .16);
  overflow: hidden;
  text-align: left;
}
.ok-slip.peach { --tone: #ffe1d6; --tone-deep: #ffc7b3; --tone-ink: #8a4b3a; --edge: #ffece5; }
.ok-slip.gold { --tone: #fff1c2; --tone-deep: #f6cf63; --tone-ink: #7a5a12; --edge: #fbe7a8; }
.ok-slip.kyo { --tone: #ebe7f5; --tone-deep: #d3cce6; --tone-ink: #5d5677; --edge: #ece9f3; }
.ok-top { background: var(--tone); padding: 16px 18px 18px; text-align: center; position: relative; }
.ok-top::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -7px; height: 14px;
  background: radial-gradient(circle at 7px 0, var(--tone) 6.5px, transparent 7.5px) 0 0 / 14px 14px repeat-x;
}
.ok-slip.gold .ok-top { background: linear-gradient(120deg, #fff6d6, var(--gold-1) 55%, #ffeaa8); }
.ok-slip.gold .ok-top::after { background-image: radial-gradient(circle at 7px 0, #fff0bd 6.5px, transparent 7.5px); }
.ok-top.drag-handle { touch-action: none; cursor: grab; }
.ok-top.drag-handle::before { /* grip dots: this part can be dragged */
  content: ''; position: absolute; left: 50%; top: 6px; translate: -50% 0; width: 34px; height: 5px; border-radius: 3px;
  background: radial-gradient(circle, var(--tone-deep) 2px, transparent 2.5px) 0 0 / 8px 5px repeat-x;
}
.ok-no { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .08em; color: var(--tone-ink); opacity: .85; }
.ok-kan { font-family: var(--kanji); letter-spacing: .02em; }
.ok-rank { margin: 6px 0 0; font-family: var(--kanji); font-weight: 600; font-size: 56px; line-height: 1.05; color: var(--tone-ink); letter-spacing: .06em; }
.ok-rank-en {
  display: inline-block; margin-top: 6px; padding: 3px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .7); color: var(--tone-ink);
  font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.ok-slip.gold .ok-rank-en { background: linear-gradient(135deg, #fffbe8, var(--gold-1)); box-shadow: inset 0 0 0 1.5px var(--gold-2); }
.ok-star { position: absolute; top: 12px; width: 16px; height: 16px; background: var(--gold-2); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.ok-star.l { left: 18px; }
.ok-star.r { right: 18px; top: 34px; width: 11px; height: 11px; }
.ok-body { padding: 26px 18px 20px; }
.ok-poem-wrap { display: flex; justify-content: center; margin: 0 0 18px; }
.ok-poem {
  writing-mode: vertical-rl;
  margin: 0; padding: 14px 10px;
  font-family: var(--kanji); font-weight: 600;
  font-size: 27px; line-height: 1.7; letter-spacing: .14em;
  color: var(--ink);
  border-radius: 16px; background: #fffaf3; border: 2px dashed var(--tone-deep);
}
.ok-poem span { display: block; }
.ok-lines { margin: 0 0 16px; padding: 0; list-style: none; counter-reset: l; }
.ok-lines li { counter-increment: l; position: relative; padding: 0 0 7px 30px; font-size: 15px; line-height: 1.4; }
.ok-lines li::before {
  content: counter(l); position: absolute; left: 0; top: 0;
  width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center;
  background: var(--tone); color: var(--tone-ink); font-size: 12px; font-weight: 700;
}
.ok-summary { margin: 0; padding: 12px 14px; border-radius: 16px; background: var(--tone); color: var(--tone-ink); font-size: 16px; line-height: 1.45; font-weight: 600; }
.ok-slip.gold .ok-summary { background: #fff6d6; box-shadow: inset 0 0 0 2px var(--gold-1); }
.ok-topics { margin: 18px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ok-topic { min-width: 0; padding: 8px 10px; border-radius: 12px; background: #fbf9ff; border: 2px solid #f0ecfb; }
.ok-topic dt { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.ok-topic dd { margin: 2px 0 0; font-size: 13.5px; line-height: 1.3; overflow-wrap: break-word; }

@media (prefers-reduced-motion: reduce) {
  .o-actions { transition: opacity .2s; translate: none; }
  .rack { transition: none; }
}
