/* ============================================================
   Mystic China - Mobile Responsive Styles
   max-width: 768px & 480px
   ============================================================ */

/* ---------- Tablet & Below: 768px ---------- */
@media (max-width: 768px) {

  /* --- Header Compact --- */
  #main-header {
    padding: 0;
  }

  .header-inner {
    padding: 10px 16px;
  }

  #logo-title {
    font-size: 1.1rem;
  }

  #logo-subtitle {
    display: none;
  }

  .logo-icon {
    font-size: 1.5rem;
  }

  .theme-toggle {
    width: 44px;
    height: 44px;
    font-size: 0.9rem;
  }

  /* --- App --- */
  #app {
    padding-top: 60px;
  }

  /* --- Hero Compact --- */
  .hero-section {
    min-height: 320px;
    padding: 40px 20px;
  }

  #hero-title {
    font-size: 1.7rem;
  }

  #hero-sub {
    font-size: 0.9rem;
    margin-bottom: 20px;
  }

  .hero-birth-input {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #birthDate {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px; /* prevents iOS zoom */
  }

  .btn-go {
    width: 100%;
    padding: 12px 20px;
    font-size: 0.95rem;
  }

  .hero-skip {
    font-size: 0.8rem;
  }

  .hero-bg {
    background-size: 180px 180px;
  }

  /* --- Section Title --- */
  .section-title {
    font-size: 1.1rem;
    margin-bottom: 14px;
  }

  /* --- Plays Grid: 2 columns --- */
  .plays-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .plays-section {
    padding: 24px 14px;
  }

  /* --- Play Cards --- */
  .play-card {
    border-radius: 10px;
  }

  .play-card-body {
    padding: 8px 10px 10px;
  }

  .play-card-title {
    font-size: 0.82rem;
  }

  .play-card-desc {
    font-size: 0.7rem;
    -webkit-line-clamp: 2;
  }

  .play-card-image {
    aspect-ratio: 4 / 3;
  }

  .play-card-price {
    font-size: 0.65rem;
    padding: 1px 6px;
    margin-top: 4px;
  }

  /* Taoist decorative corners - smaller on mobile */
  .plays-grid .play-card:nth-child(even)::after,
  .plays-grid .play-card:nth-child(odd)::after {
    width: 24px;
    height: 24px;
    border-width: 1.5px;
  }

  /* --- Play Detail: full width --- */
  .play-detail {
    max-width: 100%;
    padding: 56px 16px 36px;
  }

  .detail-sticky-bar {
    top: calc(60px - 0.5cm);
    padding: 10px 0;
  }

  .play-detail-header h2 {
    font-size: 1.35rem;
  }

  .play-detail-image {
    border-radius: 10px;
  }

  /* --- Result Page --- */
  .result-container {
    max-width: 100%;
    padding: 24px 16px 36px;
  }

  .result-card {
    padding: 24px 20px;
    border-radius: 14px;
  }

  .result-card .result-title {
    font-size: 1.15rem;
  }

  .result-card .result-content {
    font-size: 0.88rem;
  }

  .result-actions {
    flex-direction: column;
    gap: 10px;
  }

  /* --- Share Buttons --- */
  .share-buttons {
    gap: 8px;
  }

  .share-btn {
    padding: 8px 14px;
    font-size: 0.82rem;
  }

  /* --- Live Stats mobile --- */
  .live-stats {
    padding: 6px 14px 2px;
    font-size: 0.75rem;
    flex-wrap: wrap;
  }

  /* --- Review Section mobile --- */
  .review-section {
    padding: 16px 14px 24px;
  }

  .review-scroll {
    height: 240px; /* vertical: shows ~5 reviews on mobile */
  }

  .review-card {
    padding: 10px 14px;
  }

  .review-card .review-text {
    font-size: 0.75rem;
    -webkit-line-clamp: 2;
  }

  .review-form-inner {
    padding: 12px;
    gap: 8px;
  }

  .review-form-fields {
    flex-direction: column;
    gap: 8px;
  }

  .btn-review {
    width: 100%;
    text-align: center;
  }

  /* --- Lucky Info --- */
  .lucky-info {
    padding: 12px 16px;
    font-size: 0.82rem;
    flex-direction: row;
    flex-wrap: wrap;
  }

  /* --- Language Switcher --- */
  .language-switcher {
    padding: 8px 12px;
    gap: 5px;
  }

  .lang-btn {
    padding: 5px 11px;
    font-size: 0.75rem;
    border-radius: 16px;
  }

  /* --- Payment Modal --- */
  .modal-content {
    max-width: 100%;
    border-radius: 16px;
    margin: 0 8px;
  }

  .modal-header {
    padding: 16px 18px 0;
  }

  .modal-header h3 {
    font-size: 1.05rem;
  }

  .modal-body {
    padding: 16px 18px 22px;
  }

  .pay-amount {
    font-size: 1.6rem;
  }

  .btn-pay {
    padding: 12px 20px;
    font-size: 0.95rem;
  }

  #payEmail {
    padding: 11px 14px;
    font-size: 16px; /* prevents iOS zoom */
  }

  .modal-preview {
    padding: 12px;
  }

  /* --- Footer --- */
  #main-footer {
    padding: 24px 16px 72px;
  }

  .footer-links {
    gap: 14px;
  }

  .footer-links a {
    font-size: 0.8rem;
  }

  /* --- Section title decorative element --- */
  .section-title::before {
    font-size: 1rem;
    letter-spacing: 6px;
  }

  .section-title::after {
    width: 44px;
  }

  /* Ensure touch targets meet 44px minimum */
  .lang-btn,
  .footer-links a,
  .share-btn,
  .btn-go,
  .btn-pay,
  .play-detail .back-btn,
  .play-detail .btn-start,
  .result-actions .btn-secondary,
  .modal-close,
  .hero-skip {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}


/* ---------- Phone & Below: 480px ---------- */
@media (max-width: 480px) {

  /* --- Header --- */
  .header-inner {
    padding: 8px 14px;
  }

  #logo-title {
    font-size: 1rem;
  }

  .logo-icon {
    font-size: 1.3rem;
  }

  .logo-text {
    gap: 0;
  }

  .theme-toggle {
    width: 44px;
    height: 44px;
    font-size: 0.85rem;
  }

  /* --- App --- */
  #app {
    padding-top: 54px;
  }

  /* --- Hero --- */
  .hero-section {
    min-height: 200px;
    padding: 20px 14px;
  }

  #hero-title {
    font-size: 1.2rem;
    margin-bottom: 4px;
  }

  #hero-sub {
    font-size: 0.78rem;
    margin-bottom: 12px;
  }

  .hero-birth-input {
    gap: 6px;
  }

  #birthDate {
    padding: 10px 12px;
    font-size: 16px;
  }

  .btn-go {
    padding: 10px 16px;
    font-size: 0.9rem;
  }

  .hero-skip {
    font-size: 0.75rem;
  }

  .hero-bg {
    background-size: 140px 140px;
  }

  /* --- Section --- */
  .plays-section {
    padding: 28px 12px;
  }

  .section-title {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .section-title::before {
    font-size: 0.85rem;
    letter-spacing: 4px;
    margin-bottom: 2px;
  }

  .section-title::after {
    width: 36px;
    height: 1.5px;
    margin-top: 6px;
  }

  /* --- Plays Grid: 2 columns (smaller cards) --- */
  .plays-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .play-card {
    border-radius: 10px;
  }

  .play-card-body {
    padding: 10px 10px 12px;
  }

  .play-card-title {
    font-size: 0.82rem;
    margin-bottom: 2px;
  }

  .play-card-desc {
    font-size: 0.7rem;
    -webkit-line-clamp: 2;
    line-height: 1.4;
  }

  .play-card-image {
    aspect-ratio: 4 / 3;
  }

  .play-card-price {
    font-size: 0.65rem;
    padding: 2px 6px;
    margin-top: 6px;
  }

  /* Remove decorative corners on very small screens to avoid clutter */
  .plays-grid .play-card:nth-child(even)::after,
  .plays-grid .play-card:nth-child(odd)::after {
    width: 18px;
    height: 18px;
    border-width: 1px;
    opacity: 0.2;
  }

  /* --- Play Detail --- */
  .play-detail {
    padding: 52px 14px 28px;
  }

  .detail-sticky-bar {
    top: calc(56px - 0.5cm);
    padding: 8px 0;
  }

  .play-detail .back-btn {
    padding: 10px 22px;
    font-size: 1rem;
    margin-bottom: 16px;
  }

  .play-detail-header h2 {
    font-size: 1.2rem;
  }

  .play-detail-header p {
    font-size: 0.82rem;
  }

  .play-detail-image {
    border-radius: 8px;
  }

  .play-story-summary {
    font-size: 0.85rem;
    line-height: 1.6;
  }

  .play-story-toggle {
    font-size: 0.78rem;
    padding: 5px 12px;
  }

  .play-howto-header {
    font-size: 0.92rem;
  }
  .howto-arrow {
    font-size: 0.65rem;
  }

  .ref-modal-content--story .ref-modal-body {
    font-size: 0.88rem;
    line-height: 1.8;
    padding: 16px 20px 24px;
  }

  .body-consult-hint-box {
    padding: 14px 14px;
    gap: 10px;
  }

  .body-consult-hint-icon {
    font-size: 1.2rem;
  }

  .body-consult-hint-text {
    font-size: 0.88rem;
  }

  .body-ref-table {
    margin-top: 18px;
  }

  .body-ref-toggle {
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  .ref-modal-content,
  .ref-modal-content--story {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .ref-modal-body {
    font-size: 0.85rem;
    padding: 12px 16px 20px;
  }

  .ref-modal-title {
    padding: 16px 16px 0;
    font-size: 1rem;
  }

  .ref-modal-close {
    top: 10px;
    right: 12px;
  }

  .play-detail .btn-start {
    padding: 12px 20px;
    font-size: 0.92rem;
    border-radius: 10px;
  }

  /* Number inputs mobile */
  .number-inputs {
    gap: 8px;
    margin: 14px 0;
  }
  .number-inputs input[type="number"] {
    width: 52px;
    height: 52px;
    font-size: 1.3rem;
  }
  .btn-random-num {
    height: 38px;
    padding: 0 12px;
    font-size: 0.75rem;
  }
  .btn-clear-num {
    height: 38px;
    padding: 0 12px;
    font-size: 0.75rem;
    margin-left: 4px;
  }
  .num-preview--active {
    font-size: 0.85rem;
    padding: 4px 12px;
  }

  /* --- Result --- */
  .result-container {
    padding: 18px 14px 28px;
  }

  .result-card {
    padding: 20px 16px;
    border-radius: 12px;
  }

  .result-card .result-title {
    font-size: 1.05rem;
  }

  .result-card .result-content {
    font-size: 0.84rem;
    line-height: 1.7;
  }

  .share-btn {
    padding: 7px 12px;
    font-size: 0.78rem;
    border-radius: 8px;
  }

  .result-actions .btn-secondary {
    padding: 10px 16px;
    font-size: 0.84rem;
  }

  /* --- Payment Modal: full width --- */
  .modal-overlay.active {
    display: flex;
    padding: 12px;
    align-items: flex-end; /* slide up from bottom */
  }

  .modal-content {
    position: static;
    transform: none;
    top: auto;
    left: auto;
    max-width: 100%;
    width: 100%;
    border-radius: 16px 16px 0 0;
    margin: 0;
    animation: fadeInUp 0.3s ease;
  }

  .modal-header {
    padding: 14px 16px 0;
  }

  .modal-header h3 {
    font-size: 1rem;
  }

  .modal-body {
    padding: 14px 16px 20px;
  }

  .pay-amount {
    font-size: 1.4rem;
  }

  .pay-note {
    font-size: 0.78rem;
    margin-bottom: 14px;
  }

  .btn-pay {
    padding: 12px 18px;
    font-size: 0.9rem;
    border-radius: 10px;
  }

  #payEmail {
    padding: 10px 12px;
    font-size: 16px;
  }

  .pay-secure {
    font-size: 0.72rem;
  }

  .modal-preview {
    padding: 10px;
  }

  .modal-preview .preview-label {
    font-size: 0.72rem;
  }

  .modal-preview .preview-value {
    font-size: 0.85rem;
  }

  /* --- Language Switcher --- */
  .language-switcher {
    padding: 6px 10px;
    gap: 4px;
  }

  .lang-btn {
    padding: 4px 9px;
    font-size: 0.7rem;
    border-radius: 14px;
  }

  /* --- Review Section (small) --- */
  .review-section {
    padding: 12px 10px 18px;
  }

  .review-scroll {
    height: 200px;
  }

  .result-review-form {
    margin-top: 16px;
  }

  .result-review-title {
    font-size: 0.9rem;
  }

  /* --- Lucky Info --- */
  .lucky-info {
    padding: 8px 14px;
    font-size: 0.75rem;
    gap: 4px;
  }

  .lucky-info .divider {
    font-size: 0.7rem;
  }

  /* --- Footer --- */
  #main-footer {
    padding: 20px 14px 68px;
    margin-top: 16px;
  }

  .footer-links {
    gap: 10px;
    flex-direction: column;
    align-items: center;
  }

  .footer-links a {
    font-size: 0.78rem;
  }

  .footer-copy {
    font-size: 0.72rem;
  }

  /* --- Bottom padding for fixed language switcher --- */
  body {
    padding-bottom: 54px;
  }

  /* --- Accessibility: all touch targets min 44px --- */
  .lang-btn,
  .footer-links a,
  .share-btn,
  .btn-go,
  .btn-pay,
  .play-detail .back-btn,
  .play-detail .btn-start,
  .result-actions .btn-secondary,
  .modal-close,
  .hero-skip {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}


/* ---------- Extra Small: 360px ---------- */
@media (max-width: 360px) {
  #hero-title {
    font-size: 1.15rem;
  }

  .plays-grid {
    gap: 8px;
  }

  .play-card-title {
    font-size: 0.75rem;
  }

  .play-card-desc {
    font-size: 0.65rem;
    -webkit-line-clamp: 1;
  }

  .play-card-body {
    padding: 8px 8px 10px;
  }

  .lang-btn {
    font-size: 0.65rem;
    padding: 3px 7px;
    min-height: 44px;
  }
}

/* ===== 灵签 - 移动端 ===== */
@media screen and (max-width: 768px) {
  .fortune-stick-area {
    padding: 12px 0;
    gap: 14px;
  }

  .stick-container {
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-height: auto;
  }

  .stick-cylinder {
    width: 80px;
    height: 190px;
  }

  .cylinder-body {
    height: 190px;
    left: 3px;
    right: 3px;
  }

  .stick {
    width: 5px;
    height: 280px;
  }

  .cylinder-inscription {
    font-size: 0.75rem;
    letter-spacing: 4px;
  }

  .drawn-stick-shape {
    width: 22px;
    min-height: 140px;
    padding: 4px 1px 2px;
    clip-path: polygon(8% 0%, 92% 0%, 75% 65%, 51% 100%, 49% 100%, 25% 65%);
  }

  .drawn-stick-title {
    writing-mode: vertical-rl;
    font-size: 0.55rem;
  }

  .drawn-stick-poem {
    font-size: 0.35rem;
  }

  @keyframes stickArcFly {
    0% { transform: translateY(0) rotate(0deg) scale(0.6); opacity: 0; }
    20% { transform: translateY(-30px) rotate(-15deg) scale(1.1); opacity: 1; }
    50% { transform: translateY(-60px) rotate(-25deg) scale(1.05); }
    80% { transform: translateY(-30px) rotate(-10deg) scale(1); }
    100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  }

  .drawn-stick-flying {
    animation: stickArcFly 0.8s ease-out forwards;
  }

  .drawn-stick-landed {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }

  .coin-hexagram-area {
    gap: 14px;
    padding: 12px 0;
  }

  .turtle-shell-container {
    width: 140px;
    height: 110px;
  }

  .turtle-shell {
    width: 125px;
    height: 90px;
  }

  .shell-dome {
    height: 82px;
  }

  .shell-rim {
    left: -4px;
    right: -4px;
    height: 10px;
  }

  .shell-pattern {
    height: 55px;
    left: 4px;
    right: 4px;
  }

  .shell-opening {
    width: 42px;
    height: 16px;
  }

  .coin {
    width: 40px;
    height: 40px;
  }

  .coin-face {
    border-width: 2px;
    font-size: 0.65rem;
  }

  .coin-face .coin-char {
    font-size: 0.68rem;
  }
  .coin-face .char-top    { top: 4px; }
  .coin-face .char-bottom { bottom: 4px; }
  .coin-face .char-left   { left: 3px; }
  .coin-face .char-right  { right: 3px; }

  .coin-tray {
    gap: 12px;
  }

  .hexagram-line {
    min-height: 8px;
  }

  .hexagram-display {
    padding: 14px 16px;
    min-width: 60px;
  }

  .yang-bar {
    width: 50px;
    height: 6px;
  }

  .yin-bar-left, .yin-bar-right {
    width: 23px;
    height: 6px;
  }

  .yin-bar-right {
    margin-left: 4px;
  }
}
