/* =========================================
  Fortune Roulette
  Ishikawa Transport corporate style
========================================= */

:root {
  --fortune-red: #9b001f;
  --fortune-red-dark: #6f0016;
  --fortune-black: #1f1f1f;
  --fortune-gray: #666;
  --fortune-light-gray: #f5f5f5;
  --fortune-line: #e3e3e3;
  --fortune-white: #fff;
  --fortune-shadow: 0 14px 35px rgba(0, 0, 0, 0.16);
  --fortune-z: 9999;
  --fortune-font:
    system-ui, -apple-system, "Segoe UI", "Noto Sans JP",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

/* 左下固定ボタン */
.fortune-fab {
  position: fixed;
  left: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: var(--fortune-z);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid rgba(155, 0, 31, 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--fortune-black);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  font-family: var(--fortune-font);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
}

.fortune-fab:hover {
  border-color: var(--fortune-red);
  color: var(--fortune-red);
  background: #fff;
}

.fortune-fab:focus-visible {
  outline: 3px solid rgba(155, 0, 31, 0.25);
  outline-offset: 3px;
}

.fortune-fab__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--fortune-red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding-bottom: 1px;
}

.fortune-fab__text {
  white-space: nowrap;
}

/* モーダル */
.fortune-modal {
  position: fixed;
  inset: 0;
  z-index: var(--fortune-z);
  display: none;
  font-family: var(--fortune-font);
  color: var(--fortune-black);
}

.fortune-modal.is-open {
  display: block;
}

.fortune-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.54);
}

.fortune-modal__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(500px, calc(100vw - 28px));
  transform: translate(-50%, -50%);
  background: var(--fortune-white);
  border-radius: 10px;
  box-shadow: var(--fortune-shadow);
  overflow: hidden;
}

.fortune-modal__accent {
  height: 5px;
  background: linear-gradient(
    90deg,
    var(--fortune-red),
    var(--fortune-red-dark)
  );
}

.fortune-modal__header {
  position: relative;
  padding: 18px 48px 12px;
  text-align: center;
  border-bottom: 1px solid var(--fortune-line);
  background: #fff;
}

.fortune-modal__eyebrow {
  margin: 0 0 4px;
  color: var(--fortune-red);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.fortune-modal__title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.fortune-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--fortune-line);
  border-radius: 8px;
  background: #fff;
  color: var(--fortune-gray);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.fortune-modal__close:hover {
  color: var(--fortune-red);
  border-color: rgba(155, 0, 31, 0.35);
  background: #fafafa;
}

.fortune-modal__body {
  padding: 20px 18px 16px;
  text-align: center;
}

.fortune-modal__desc {
  margin: 0 0 16px;
  color: var(--fortune-gray);
  font-size: 14px;
  line-height: 1.7;
}

/* スロット */
.fortune-slot {
  width: min(360px, 100%);
  margin: 0 auto 16px;
}

.fortune-slot__window {
  position: relative;
  height: 58px;
  overflow: hidden;
  border: 1px solid var(--fortune-line);
  border-radius: 9px;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.95),
      rgba(255, 255, 255, 0) 30%,
      rgba(255, 255, 255, 0) 70%,
      rgba(255, 255, 255, 0.95)
    ),
    var(--fortune-light-gray);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.025);
}

.fortune-slot__window::before,
.fortune-slot__window::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 1px;
  background: rgba(155, 0, 31, 0.22);
  z-index: 2;
}

.fortune-slot__window::before {
  top: 9px;
}

.fortune-slot__window::after {
  bottom: 9px;
}

.fortune-slot__reel {
  display: grid;
  will-change: transform;
}

.fortune-slot__item {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--fortune-black);
  font-size: 19px;
  font-weight: 850;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.fortune-slot__item span {
  display: inline-block;
  color: var(--fortune-red);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

/* 結果 */
.fortune-result {
  width: min(390px, 100%);
  margin: 0 auto;
  padding: 14px 14px 13px;
  border: 1px solid var(--fortune-line);
  border-radius: 9px;
  background: #fff;
}

.fortune-result__label {
  margin: 0 0 6px;
  color: var(--fortune-red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.fortune-result__text {
  margin: 0;
  color: var(--fortune-black);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.8;
  text-align: left;
}

.fortune-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.fortune-btn {
  min-width: 160px;
  padding: 11px 18px;
  border: 1px solid var(--fortune-red);
  border-radius: 8px;
  background: #fff;
  color: var(--fortune-red);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.fortune-btn--primary {
  background: var(--fortune-red);
  color: #fff;
}

.fortune-btn:hover {
  background: var(--fortune-red-dark);
  border-color: var(--fortune-red-dark);
  color: #fff;
}

.fortune-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.fortune-modal__footer {
  padding: 12px 16px;
  text-align: center;
  color: #777;
  background: #fafafa;
  border-top: 1px solid var(--fortune-line);
}

/* スマホ調整 */
@media (max-width: 520px) {
  .fortune-fab {
    left: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    padding: 8px 10px;
    font-size: 12px;
  }

  .fortune-fab__mark {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }

  .fortune-modal__header {
    padding: 16px 44px 11px;
  }

  .fortune-modal__title {
    font-size: 18px;
  }

  .fortune-modal__body {
    padding: 18px 14px 15px;
  }

  .fortune-slot__item {
    font-size: 17px;
  }

  .fortune-result__text {
    font-size: 13px;
  }
}

/* 動きが苦手な方向け */
@media (prefers-reduced-motion: reduce) {
  .fortune-slot__reel {
    transition: none !important;
  }
}
