.fortune-page {
  min-height: 100%;
}

.fortune-page-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 20px 96px;
}

.fortune-appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  margin: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  border-radius: 0;
}

.fortune-appbar__main {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.fortune-appbar__back {
  flex: 0 0 auto;
}

.fortune-stack {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.fortune-balance-card,
.fortune-section-card,
.fortune-shortcut,
.fortune-product-card,
.fortune-sheet-item,
.fortune-sheet-history {
  box-shadow: var(--md-elev-1);
}

.fortune-balance-card,
.fortune-section-card {
  border-radius: 24px;
  border: 1px solid color-mix(in srgb, var(--md-outline) 88%, transparent);
}

.fortune-balance-card {
  margin: 0;
  padding: 24px 18px;
  animation: fortuneRise 220ms var(--md-ease);
}

.fortune-balance-card__icon {
  animation: iconPulse 2.6s ease-in-out infinite;
  font-size: 28px;
  font-family: "Noto Color Emoji", "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  background: linear-gradient(135deg, rgba(255, 71, 87, 0.16), rgba(255, 159, 67, 0.18));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.fortune-balance-card__content {
  min-width: 0;
}

.fortune-balance-card__value-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.fortune-balance-card__value {
  line-height: 0.92;
}

.fortune-balance-card__unit {
  padding-bottom: 8px;
  font-size: 15px;
  font-weight: 900;
  color: var(--md-text-2);
}

.fortune-balance-card__hint {
  width: 100%;
  margin-top: 10px;
  padding: 11px 14px;
  border: 0;
  border-radius: 16px;
  background: color-mix(in srgb, var(--md-surface-2) 92%, transparent);
  color: var(--md-text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: transform var(--md-dur-2) var(--md-ease), box-shadow var(--md-dur-2) var(--md-ease), background var(--md-dur-2) var(--md-ease);
}

.fortune-balance-card__hint:hover {
  transform: translateY(-1px);
  box-shadow: var(--md-elev-2);
}

.fortune-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fortune-shortcut {
  border: 1px solid color-mix(in srgb, var(--md-outline) 84%, transparent);
  border-radius: 16px;
  background: var(--md-surface);
  padding: 10px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform var(--md-dur-2) var(--md-ease), box-shadow var(--md-dur-2) var(--md-ease), filter var(--md-dur-2) var(--md-ease);
  animation: fortuneRise 220ms var(--md-ease) both;
}

.fortune-shortcut:hover {
  transform: translateY(-1px);
  box-shadow: var(--md-elev-2);
  filter: saturate(1.02);
}

.fortune-shortcut__icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand-1) 10%, var(--md-surface));
  color: var(--brand-1);
  font-size: 12px;
}

.fortune-shortcut__text {
  font-size: 12px;
  font-weight: 900;
  color: var(--md-text);
}

.fortune-section-card {
  padding: 14px;
  animation: fortuneRise 220ms var(--md-ease);
}

.fortune-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.fortune-section-title {
  font-size: 13px;
  font-weight: 900;
  color: var(--md-text-2);
}

.fortune-section-meta {
  font-size: 12px;
  font-weight: 900;
  color: var(--md-text-3);
}

.fortune-product-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fortune-product-card {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--md-outline) 84%, transparent);
  border-radius: 20px;
  background: var(--md-surface-2);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-content: start;
  text-align: left;
  cursor: pointer;
  transition: transform var(--md-dur-2) var(--md-ease), box-shadow var(--md-dur-2) var(--md-ease), background var(--md-dur-2) var(--md-ease);
  animation: fortuneRise 240ms var(--md-ease) both;
}

.fortune-product-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--md-elev-2);
}

.fortune-product-card__cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand-1) 10%, var(--md-surface));
  font-size: 26px;
  font-family: "Noto Color Emoji", "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  overflow: hidden;
}

.fortune-product-card__cover.is-image img,
.fortune-sheet-product__cover.is-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fortune-product-card__body {
  min-width: 0;
}

.fortune-product-card__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.fortune-product-card__title {
  font-size: 14px;
  font-weight: 900;
  color: var(--md-text);
  line-height: 1.35;
}

.fortune-product-card__price {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  color: var(--brand-1);
}

.fortune-product-card__subtitle {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--md-text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fortune-product-card__tail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--md-text-3);
  font-size: 12px;
}

.fortune-product-card__state {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  border: 1px solid transparent;
}

.fortune-product-card__state.is-active {
  background: rgba(58, 177, 112, 0.12);
  color: #1c8751;
  border-color: rgba(58, 177, 112, 0.18);
}

.fortune-product-card__state.is-muted {
  background: rgba(87, 99, 120, 0.1);
  color: var(--md-text-2);
  border-color: color-mix(in srgb, var(--md-outline) 84%, transparent);
}

.fortune-empty {
  padding: 22px 14px;
  border-radius: 18px;
  border: 1px dashed color-mix(in srgb, var(--md-outline) 78%, transparent);
  color: var(--md-text-2);
  font-size: 12px;
  text-align: center;
}

.fortune-sheet-overlay {
  align-items: center;
  justify-content: center;
}

.fortune-sheet {
  width: min(520px, calc(100vw - 24px));
  max-height: min(82vh, 720px);
  margin: 0 auto;
  padding: 0;
  border-radius: 28px;
  overflow: hidden;
  animation: fortuneSheetIn 240ms var(--md-ease);
}

.fortune-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 10px;
}

.fortune-sheet__title {
  margin-bottom: 0;
  font-size: 18px;
}

.fortune-sheet__body {
  display: grid;
  gap: 10px;
  padding: 0 18px 18px;
}

.fortune-sheet-item,
.fortune-sheet-history {
  border: 1px solid color-mix(in srgb, var(--md-outline) 84%, transparent);
  border-radius: 20px;
  background: var(--md-surface-2);
}

.fortune-sheet-item {
  padding: 14px;
}

.fortune-sheet-item__title {
  font-size: 13px;
  font-weight: 900;
  color: var(--md-text);
}

.fortune-sheet-item__text {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--md-text-2);
}

.fortune-sheet-item__list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.fortune-sheet-item__line {
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--md-surface) 92%, transparent);
  font-size: 12px;
  line-height: 1.6;
  color: var(--md-text-2);
}

.fortune-sheet-history {
  padding: 14px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
}

.fortune-sheet-history__main {
  min-width: 0;
  flex: 1;
}

.fortune-sheet-history__title {
  font-size: 13px;
  font-weight: 900;
  color: var(--md-text);
  line-height: 1.45;
}

.fortune-sheet-history__meta {
  margin-top: 5px;
  font-size: 11px;
  color: var(--md-text-3);
}

.fortune-sheet-history__side {
  display: grid;
  align-content: space-between;
  justify-items: end;
  gap: 10px;
  min-width: 104px;
}

.fortune-sheet-history__price {
  font-size: 13px;
  font-weight: 900;
  color: var(--brand-1);
}

.fortune-sheet-history__status {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  border: 1px solid transparent;
}

.fortune-sheet-history__status.is-fulfilled {
  background: rgba(58, 177, 112, 0.12);
  color: #1c8751;
  border-color: rgba(58, 177, 112, 0.18);
}

.fortune-sheet-history__status.is-redeemed {
  background: rgba(32, 128, 240, 0.12);
  color: #1c70d0;
  border-color: rgba(32, 128, 240, 0.18);
}

.fortune-sheet-history__status.is-pending {
  background: rgba(240, 160, 32, 0.12);
  color: #bc7a0c;
  border-color: rgba(240, 160, 32, 0.18);
}

.fortune-sheet-history__action {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid rgba(194, 120, 3, 0.18);
  background: rgba(255, 249, 235, 0.92);
  color: #b16607;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--md-dur-2) var(--md-ease), box-shadow var(--md-dur-2) var(--md-ease), background var(--md-dur-2) var(--md-ease);
}

.fortune-sheet-history__action:hover {
  transform: translateY(-1px);
  box-shadow: var(--md-elev-1);
}

.fortune-sheet-product {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--brand-1) 6%, var(--md-surface-2));
  border: 1px solid color-mix(in srgb, var(--md-outline) 84%, transparent);
}

.fortune-sheet-product__cover {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand-1) 12%, var(--md-surface));
  font-size: 34px;
  font-family: "Noto Color Emoji", "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
}

.fortune-image-trigger {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  display: block;
  cursor: zoom-in;
}

.fortune-image-trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fortune-sheet-product__price {
  font-size: 18px;
  font-weight: 900;
  color: var(--md-text);
}

.fortune-sheet-product__subtitle {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--md-text-2);
}

.fortune-sheet-actions {
  padding-top: 4px;
}

.fortune-sheet-actions__btn {
  width: 100%;
}

.fortune-sheet-actions__btn[disabled] {
  opacity: 0.58;
  box-shadow: none;
  cursor: not-allowed;
}

.entry-qr-modal-card--redemption {
  background:
    radial-gradient(120% 82% at 100% 0%, rgba(217, 119, 6, 0.16) 0%, rgba(217, 119, 6, 0) 60%),
    radial-gradient(90% 72% at 0% 100%, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0) 65%),
    var(--md-surface);
}

.fortune-redemption-modal {
  --fortune-accent: #b16607;
  animation: fortuneRedemptionModalIn 240ms var(--md-ease);
}

.fortune-redemption-modal .entry-qr-modal-inline-note--redemption,
.fortune-redemption-modal .entry-qr-modal-qr-wrap--redemption,
.fortune-redemption-modal .entry-qr-modal-code-card--redemption {
  animation: fortuneRedemptionSectionIn 260ms var(--md-ease) both;
}

.fortune-redemption-modal .entry-qr-modal-inline-note--redemption {
  animation-delay: 40ms;
}

.fortune-redemption-modal .entry-qr-modal-qr-wrap--redemption {
  animation-delay: 80ms;
}

.fortune-redemption-modal .entry-qr-modal-code-card--redemption {
  animation-delay: 120ms;
}

.entry-qr-modal-inline-note--redemption {
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.14);
  color: var(--md-text);
}

.entry-qr-modal-qr-wrap--redemption {
  background: rgba(255, 250, 240, 0.98);
  border-color: rgba(217, 119, 6, 0.26);
}

.entry-qr-modal-qr-surface--redemption {
  background: linear-gradient(180deg, #fffdf8 0%, #fff6df 100%);
  border-color: rgba(217, 119, 6, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.fortune-redemption-modal__qr-image {
  animation: fortuneRedemptionQrIn 280ms var(--md-ease) 120ms both;
}

.entry-qr-modal-qr-hint--redemption {
  color: #8b5a10;
}

.entry-qr-modal-code-card--redemption {
  background: rgba(255, 250, 240, 0.96);
  border-color: rgba(217, 119, 6, 0.2);
}

.entry-qr-modal-code-title--redemption {
  color: #9a5b06;
}

.entry-qr-modal-code-display--redemption {
  color: #9a5b06;
}

.entry-qr-modal-copy-btn--redemption {
  background: linear-gradient(135deg, #b16607, #d97706);
}

.fortune-redeem-code {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(194, 120, 3, 0.14);
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(255, 255, 255, 0.96));
}

.fortune-redeem-code__hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: flex-start;
}

.fortune-redeem-code__hero-main {
  min-width: 0;
}

.fortune-redeem-code__eyebrow,
.fortune-redeem-code__expire-label,
.fortune-redeem-code__code-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--md-text-3);
}

.fortune-redeem-code__meta {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 800;
  color: var(--md-text);
}

.fortune-redeem-code__expire-value {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 800;
  color: #b16607;
}

.fortune-redeem-code__panel {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.fortune-redeem-code__qr {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 230, 0.92));
  border: 1px solid rgba(194, 120, 3, 0.16);
}

.fortune-redeem-code__image {
  width: min(260px, 100%);
  aspect-ratio: 1 / 1;
  display: block;
}

.fortune-redeem-code__info {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(194, 120, 3, 0.12);
}

.fortune-redeem-code__hint,
.fortune-redeem-code__footnote {
  font-size: 12px;
  color: var(--md-text-2);
  line-height: 1.65;
}

.fortune-redeem-code__code {
  min-width: 0;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(194, 120, 3, 0.16);
  background: rgba(255, 255, 255, 0.92);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: left;
  color: #b16607;
  word-break: break-all;
}

.fortune-redeem-code__copy-btn {
  width: 100%;
}

.fortune-image-preview {
  position: relative;
  padding: 0;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
}

.fortune-image-preview__image {
  width: 100%;
  max-height: min(70vh, 720px);
  object-fit: contain;
  display: block;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(242, 246, 251, 0.96));
}

:root[data-theme="dark"] .fortune-appbar {
  background: color-mix(in srgb, var(--md-surface) 90%, rgba(16, 20, 28, 0.82));
}

:root[data-theme="dark"] .fortune-sheet-history__action {
  background: rgba(113, 79, 18, 0.28);
  border-color: rgba(223, 181, 94, 0.24);
  color: #f4d27a;
}

:root[data-theme="dark"] .entry-qr-modal-card--redemption {
  border-color: rgba(223, 181, 94, 0.24);
  background:
    radial-gradient(120% 82% at 100% 0%, rgba(217, 119, 6, 0.18) 0%, rgba(217, 119, 6, 0) 60%),
    radial-gradient(90% 72% at 0% 100%, rgba(245, 158, 11, 0.14) 0%, rgba(245, 158, 11, 0) 65%),
    rgba(24, 20, 14, 0.96);
}

:root[data-theme="dark"] .entry-qr-modal-code-title--redemption,
:root[data-theme="dark"] .entry-qr-modal-code-display--redemption,
:root[data-theme="dark"] .entry-qr-modal-qr-hint--redemption {
  color: #ffd98d;
}

:root[data-theme="dark"] .entry-qr-modal-inline-note--redemption {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(223, 181, 94, 0.18);
}

:root[data-theme="dark"] .entry-qr-modal-qr-wrap--redemption,
:root[data-theme="dark"] .entry-qr-modal-code-card--redemption {
  background: rgba(52, 36, 14, 0.9);
  border-color: rgba(223, 181, 94, 0.18);
}

:root[data-theme="dark"] .entry-qr-modal-qr-surface--redemption {
  background: linear-gradient(180deg, #fff9ef 0%, #f7edd3 100%);
  border-color: rgba(223, 181, 94, 0.18);
}

:root[data-theme="dark"] .fortune-redeem-code {
  background: linear-gradient(180deg, rgba(58, 44, 24, 0.92), rgba(26, 22, 18, 0.96));
  border-color: rgba(223, 181, 94, 0.18);
}

:root[data-theme="dark"] .fortune-redeem-code__qr,
:root[data-theme="dark"] .fortune-redeem-code__info {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(223, 181, 94, 0.18);
}

:root[data-theme="dark"] .fortune-redeem-code__code {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(223, 181, 94, 0.18);
  color: #ffd98d;
}

:root[data-theme="dark"] .fortune-redeem-code__expire-value {
  color: #ffd98d;
}

:root[data-theme="dark"] .fortune-image-preview,
:root[data-theme="dark"] .fortune-image-preview__image {
  background: rgba(14, 18, 24, 0.96);
}

@media (min-width: 700px) {
  .fortune-page-content {
    padding-top: 16px;
  }

  .fortune-appbar__main {
    padding-left: 20px;
    padding-right: 20px;
  }

  .fortune-stack {
    gap: 14px;
    padding-top: 16px;
  }

  .fortune-balance-card {
    padding: 20px;
  }

  .fortune-balance-card__hint {
    width: auto;
    min-width: 220px;
  }

  .fortune-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 180px));
    justify-content: start;
  }

  .fortune-section-card {
    padding: 16px;
  }

  .fortune-sheet {
    margin-bottom: 0;
  }
}

@media (max-width: 420px) {
  .fortune-shortcuts {
    gap: 8px;
  }

  .fortune-shortcut {
    padding: 12px 8px;
  }

  .fortune-product-list {
    grid-template-columns: 1fr 1fr;
  }

  .fortune-sheet-history {
    align-items: flex-start;
    flex-direction: column;
  }

  .fortune-sheet-history__side {
    width: 100%;
    grid-template-columns: auto auto;
    justify-content: space-between;
    align-items: center;
  }

  .fortune-sheet-history__price {
    order: 1;
    justify-self: start;
  }

  .fortune-sheet-history__status {
    order: 2;
    justify-self: end;
  }

  .fortune-sheet-history__action {
    order: 3;
    grid-column: 2;
    justify-self: end;
  }

  .fortune-redeem-code__hero,
  .fortune-redeem-code__panel {
    grid-template-columns: 1fr;
  }

  .fortune-redeem-code__code {
    text-align: center;
  }
}

@media (max-width: 360px) {
  .fortune-product-list {
    grid-template-columns: 1fr;
  }
}

@keyframes fortuneRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fortuneSheetIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fortuneRedemptionModalIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fortuneRedemptionSectionIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fortuneRedemptionQrIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes iconPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }
}
