* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; }
    body { font-family: 'Segoe UI', 'PingFang TC', 'Microsoft YaHei', sans-serif; font-size: 12pt; background: #0b0a0c; min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; padding: 16px; color: #f0ece4; line-height: 1.6; }
    input, textarea { user-select: text !important; }

    #authOverlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.92); backdrop-filter: blur(12px); display: flex; justify-content: center; align-items: center; z-index: 9999; padding: 16px; transition: opacity 0.6s; overflow-y: auto; }
    #authOverlay.hidden { opacity: 0; pointer-events: none; }
    .auth-box { background: rgba(30,27,38,0.95); padding: 32px 24px; border-radius: 40px; border: 1px solid rgba(255,215,150,0.15); box-shadow: 0 30px 60px rgba(0,0,0,0.9); width: 100%; max-width: 400px; text-align: center; }
    .auth-box h2 { font-weight: 300; letter-spacing: 4px; color: #f2e3d5; font-size: 1.4rem; margin-bottom: 4px; }
    .auth-box .sub { color: #a89a8c; font-size: 0.8rem; margin-bottom: 16px; }
    .auth-box input { width: 100%; padding: 14px 16px; margin-bottom: 12px; border-radius: 40px; border: 1px solid rgba(255,215,150,0.12); background: rgba(0,0,0,0.4); color: #f0ece4; font-size: 1rem; outline: none; }
    .auth-box input:focus { border-color: rgba(230,180,120,0.5); }
    .auth-primary-btn { width: 100%; min-height: 48px; padding: 12px 16px; border-radius: 40px; background: linear-gradient(135deg, #5a4232, #2d232a); color: #f2e3d5; font-size: 1rem; letter-spacing: 4px; cursor: pointer; border: 1px solid rgba(255,215,150,0.1); margin-top: 4px; transition: 0.3s; touch-action: manipulation; }
    .auth-primary-btn:hover { background: linear-gradient(135deg, #7a5a42, #3d2a32); }
    .auth-primary-btn:active { transform: scale(0.98); }
    .auth-msg { color: #e8a09c; margin-top: 10px; font-size: 0.85rem; min-height: 22px; }
    .auth-msg.success { color: #a8d8c8; }
    .auth-switch { margin-top: 14px; font-size: 0.75rem; color: #7a6e62; }
    .auth-switch-btn { width: auto; min-height: 44px; padding: 8px 10px; border: 0; background: transparent; color: #c7b7a8; cursor: pointer; text-decoration: underline; font: inherit; touch-action: manipulation; }
    .auth-switch-btn:hover { color: #f2e3d5; }
    .admin-login-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
    .admin-login-row input { flex: 1 1 130px; min-width: 0; margin-bottom: 0; }
    .admin-login-btn { flex: 1 1 100%; width: 100%; min-height: 44px; padding: 10px 16px; border-radius: 30px; border: 1px solid rgba(255,215,150,0.1); background: rgba(255,215,150,0.05); color: #c7b7a8; cursor: pointer; font-size: 0.8rem; transition: 0.3s; touch-action: manipulation; }
    .admin-login-btn:hover { background: rgba(255,215,150,0.1); color: #f2e3d5; }
    .code-auto-filled { border-color: rgba(100,200,150,0.4) !important; background: rgba(100,200,150,0.05) !important; }

    .app-container { max-width: 880px; width: 100%; background: rgba(30,27,38,0.8); backdrop-filter: blur(14px); border-radius: 40px; padding: 20px 16px; box-shadow: 0 30px 60px rgba(0,0,0,0.9); border: 1px solid rgba(255,215,150,0.06); display: none; min-height: 90vh; }
    .app-container.active { display: block; }
    h1 { text-align: center; font-weight: 300; letter-spacing: 4px; font-size: 1.4rem; color: #f2e3d5; margin-bottom: 2px; }
    .subtitle { text-align: center; font-size: 0.65rem; color: #a89a8c; letter-spacing: 3px; border-bottom: 1px solid rgba(255,215,150,0.1); padding-bottom: 12px; margin-bottom: 16px; display: flex; justify-content: center; flex-wrap: wrap; }
    .user-greeting { color: #c7b7a8; font-size: 0.65rem; }
    .user-greeting span { color: #eaceb0; }
    .user-greeting .admin-badge { display: inline-block; background: rgba(230,180,120,0.12); color: #eaceb0; font-size: 0.5rem; padding: 1px 8px; border-radius: 30px; margin-left: 6px; }

    .tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid rgba(255,215,150,0.06); padding-bottom: 10px; flex-wrap: wrap; }
    .tab-btn { background: transparent; border: none; color: #7a6e62; padding: 6px 14px; border-radius: 30px; cursor: pointer; font-size: 0.7rem; letter-spacing: 2px; transition: 0.3s; }
    .tab-btn:hover { color: #c7b7a8; background: rgba(255,215,150,0.05); }
    .tab-btn.active { color: #f2e3d5; background: rgba(255,215,150,0.08); border: 1px solid rgba(255,215,150,0.1); }
    .tab-content { display: none; animation: fadeIn 0.4s ease; }
    .tab-content.active { display: block; }
    @keyframes fadeIn { from { opacity: 0.4; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

    .cards-grid { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; max-width: 480px; margin-left: auto; margin-right: auto; }
    .card-slot { perspective: 800px; width: 100%; min-height: 150px; cursor: pointer; transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.4s ease, margin 0.4s ease; }
    .card-slot.queued-card { opacity: 0; transform: translateY(-12px) scale(0.96); max-height: 0; min-height: 0; margin: -4px 0; overflow: hidden; pointer-events: none; }
    #slot0 { aspect-ratio: 1 / 1; min-height: 0; }
    #slot0 .card-inner, #slot0 .card-front, #slot0 .card-back { height: 100%; min-height: 0; }
    .card-inner { position: relative; width: 100%; height: 100%; min-height: 150px; transition: transform 0.6s cubic-bezier(0.23,1,0.32,1); transform-style: preserve-3d; }
    .card-slot.flipped .card-inner { transform: rotateY(180deg); }
    .card-front { position: absolute; width: 100%; height: 100%; min-height: 150px; backface-visibility: hidden; border-radius: 14px; background: linear-gradient(145deg, rgba(40,35,48,0.9), rgba(20,18,25,0.95)); border: 1px solid rgba(255,215,150,0.1); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.4); overflow: hidden; }
    .card-front img { width: 100%; height: 100%; object-fit: contain; border-radius: 14px; }
    .card-front .front-icon { font-size: 1.6rem; margin-bottom: 2px; opacity: 0.6; }
    .card-front .front-label { font-size: 0.5rem; letter-spacing: 2px; color: #7a6e62; }
    .card-front .front-hint { font-size: 0.4rem; color: #4a413a; margin-top: 2px; }
    .card-back { position: absolute; width: 100%; height: 100%; min-height: 150px; backface-visibility: hidden; border-radius: 14px; background: rgba(20,18,25,0.85); border: 1px solid rgba(255,215,150,0.12); transform: rotateY(180deg); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8px 12px; box-shadow: 0 6px 20px rgba(0,0,0,0.4); overflow: hidden; }
    .card-back .card-image { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
    .card-back > [id^="cardContent"] { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
    .card-title-overlay { position: absolute; left: 50%; bottom: 16px; z-index: 3; transform: translateX(-50%); width: calc(100% - 32px); padding: 7px 12px; border-radius: 30px; background: rgba(5,5,7,0.84); color: #f7ede4; font-size: 12pt; line-height: 1.35; font-weight: 600; letter-spacing: 1px; text-align: center; }
    .simple-card-face { width: 100%; height: 100%; min-height: inherit; display: flex; align-items: center; justify-content: center; padding: 18px; border-radius: 12px; background: #050506; }
    .simple-card-face .card-name { color: #f7ede4; font-size: 12pt; line-height: 1.45; font-weight: 600; letter-spacing: 2px; }
    .card-back .slot-label { display: none; }
    .card-back .one-line { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; width: 100%; padding: 8px 8px 24px; }
    .card-back .one-line .card-name { font-size: 12pt; line-height: 1.4; font-weight: 600; color: #f7ede4; margin-bottom: 5px; }
    .card-back .one-line .card-desc { font-size: clamp(10pt, 3.2vw, 11pt); color: #d6c9bc; line-height: 1.5; }
    .card-back .one-line .card-sub { font-size: 10pt; line-height: 1.4; color: #c7b7a8; }
    .card-back .orientation-badge { font-size: 10pt; line-height: 1.4; font-weight: 500; margin-top: 2px; padding: 1px 8px; border-radius: 30px; display: inline-block; }
    .card-back .orientation-badge.upright { color: #a8d8c8; background: rgba(100,200,150,0.12); }
    .card-back .orientation-badge.reversed { color: #e8a09c; background: rgba(200,80,80,0.12); }
    .card-slot.shuffling .card-inner { animation: shufflePulse 0.4s ease 2; }
    @keyframes shufflePulse { 0% { transform: scale(0.95); } 50% { transform: scale(1.04); } 100% { transform: scale(1); } }

    .action-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 6px; }
    .draw-btn { flex: 2; padding: 12px 14px; font-size: 0.9rem; letter-spacing: 3px; color: #f2e3d5; background: linear-gradient(135deg, #3d2e24, #1f181c); border: 1px solid rgba(255,215,150,0.15); border-radius: 60px; cursor: pointer; transition: 0.3s; box-shadow: 0 6px 16px rgba(0,0,0,0.5); }
    .draw-btn:hover { background: linear-gradient(135deg, #5a4232, #2d232a); border-color: rgba(255,215,150,0.4); transform: scale(1.02); }
    .fav-btn { flex: 1; padding: 12px 14px; font-size: 0.8rem; letter-spacing: 2px; background: rgba(40,30,35,0.6); border: 1px solid rgba(255,215,150,0.08); border-radius: 60px; color: #c7b7a8; cursor: pointer; transition: 0.3s; }
    .fav-btn:hover { background: rgba(60,40,45,0.6); }
    .fav-btn.active { background: rgba(180,80,80,0.2); border-color: #e8a09c; color: #f2d0c0; }
    .flip-progress { text-align: center; font-size: 0.6rem; color: #5a4a42; letter-spacing: 2px; margin-top: 4px; min-height: 18px; }

    .reading-section { margin-top: 16px; background: rgba(10,8,12,0.7); border-radius: 24px; padding: 18px 16px; border-left: 4px solid rgba(230,180,120,0.3); opacity: 0; transform: translateY(15px); display: none; transition: all 0.6s ease; }
    .reading-section.visible { opacity: 1; transform: translateY(0); display: block; }
    .reading-title { font-size: 0.65rem; letter-spacing: 3px; color: #b8a69a; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
    .reading-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(255,215,150,0.2), transparent); }
    .detail-block { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid rgba(255,215,150,0.06); }
    .detail-block:last-of-type { border-bottom: none; }
    .detail-block h4 { font-size: 0.95rem; color: #f2dcc8; font-weight: 500; letter-spacing: 1px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
    .detail-block h4 .badge { font-size: 0.5rem; background: rgba(255,215,150,0.08); padding: 0 8px; border-radius: 30px; color: #a89a8c; font-weight: 300; letter-spacing: 1px; }
    .detail-block p { font-size: 0.82rem; line-height: 1.9; color: #dfd5cb; font-weight: 300; margin-bottom: 4px; }
    .detail-block strong { color: #f5d7b0; font-weight: 500; }
    .light-text { color: #a8d8c8; }
    .shadow-text { color: #e8a09c; }
    .gold-text { color: #eaceb0; }
    .element-tag { display: inline-block; background: rgba(255,215,150,0.08); padding: 0 10px; border-radius: 30px; font-size: 0.65rem; color: #d4bca8; }
    .highlight-box { background: rgba(255,215,150,0.04); border-radius: 12px; padding: 10px 14px; margin-top: 6px; border-left: 2px solid rgba(230,180,120,0.2); }
    .question-box { background: rgba(100,150,200,0.04); border-radius: 12px; padding: 10px 14px; margin-top: 6px; border: 1px dashed rgba(255,215,150,0.12); }
    .affirmation-box { background: linear-gradient(135deg, rgba(180,130,90,0.1), rgba(100,70,50,0.04)); border-radius: 16px; padding: 14px 16px; margin-top: 12px; text-align: center; border: 1px solid rgba(255,215,150,0.1); }
    .affirmation-box p { font-size: 0.95rem; color: #f2e3d5; font-weight: 400; font-style: italic; line-height: 2; }
    .flower-essence-box { background: linear-gradient(135deg, rgba(200,150,200,0.08), rgba(100,80,150,0.05)); border-radius: 16px; padding: 14px 16px; margin-top: 10px; border: 1px solid rgba(200,180,255,0.12); }
    .flower-essence-box h5 { color: #d4c8e8; font-size: 0.8rem; letter-spacing: 2px; margin-bottom: 8px; }
    .essence-item { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
    .essence-item:last-child { border-bottom: none; }
    .essence-name { color: #eaceb0; font-weight: 500; min-width: 80px; font-size: 0.8rem; }
    .essence-detail { color: #c7b7a8; font-size: 0.78rem; }
    .essence-spot { color: #a8d8c8; font-size: 0.75rem; }
    .essence-warning { font-size: 0.65rem; color: #7a6e62; margin-top: 8px; padding: 6px 10px; background: rgba(0,0,0,0.2); border-radius: 12px; }

    .history-list, .fav-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
    .history-item, .fav-item { background: rgba(20,18,25,0.5); border-radius: 16px; padding: 12px 14px; border: 1px solid rgba(255,215,150,0.05); cursor: pointer; transition: 0.3s; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
    .history-item:hover, .fav-item:hover { background: rgba(30,27,38,0.7); border-color: rgba(255,215,150,0.12); }
    .history-info { display: flex; flex-direction: column; gap: 2px; }
    .history-time { font-size: 0.5rem; color: #7a6e62; letter-spacing: 1px; }
    .history-summary { font-size: 0.7rem; color: #c7b7a8; }
    .history-summary strong { color: #eaceb0; }
    .del-btn { background: transparent; border: none; color: #5a4a42; cursor: pointer; font-size: 0.8rem; padding: 4px 8px; border-radius: 20px; }
    .del-btn:hover { color: #e8a09c; background: rgba(200,80,80,0.1); }
    .empty-msg { color: #5a4a42; text-align: center; padding: 24px 0; font-size: 0.8rem; letter-spacing: 2px; }
    .legal-notice { font-size: 0.5rem; color: #3a3330; text-align: center; margin-top: 14px; padding: 6px; border-top: 1px solid rgba(255,215,150,0.04); }
    .legal-notice strong { color: #5a4a42; }

    .code-block { background: rgba(255,215,150,0.04); border-radius: 16px; padding: 14px; margin-bottom: 14px; border: 1px solid rgba(255,215,150,0.06); text-align: left; }
    .code-block .label { font-size: 0.65rem; color: #7a6e62; letter-spacing: 2px; display: block; margin-bottom: 6px; }
    .code-row { display: flex; gap: 8px; align-items: center; }
    .code-row input { flex: 1; padding: 10px 14px; border-radius: 30px; border: 1px solid rgba(255,215,150,0.1); background: rgba(0,0,0,0.3); color: #f2e3d5; font-size: 0.8rem; font-family: 'Courier New', monospace; letter-spacing: 1px; margin-bottom: 0; }
    .code-row input:focus { border-color: rgba(230,180,120,0.3); outline: none; }
    .code-row .paste-btn { padding: 10px 16px; border-radius: 30px; border: 1px solid rgba(100,200,255,0.15); background: rgba(100,200,255,0.05); color: #8ac8e8; cursor: pointer; font-size: 0.7rem; white-space: nowrap; transition: 0.3s; }
    .code-row .paste-btn:hover { background: rgba(100,200,255,0.1); border-color: rgba(100,200,255,0.25); color: #b0e0f0; }
    .code-row .paste-btn.pasted { background: rgba(100,200,150,0.15); border-color: rgba(100,200,150,0.2); color: #a8d8c8; }
    .code-stats { font-size: 0.6rem; color: #5a4a42; margin-top: 6px; letter-spacing: 1px; }
    .code-stats span { color: #7a6e62; }
    .admin-section { background: rgba(255,215,150,0.04); border-radius: 16px; padding: 14px; border: 1px solid rgba(255,215,150,0.06); margin-top: 12px; text-align: left; }
    .admin-section .label { font-size: 0.65rem; color: #7a6e62; letter-spacing: 2px; display: block; margin-bottom: 6px; }
    .admin-section .gen-btn { width: 100%; padding: 8px; border-radius: 30px; border: 1px dashed rgba(255,215,150,0.2); background: transparent; color: #c7b7a8; cursor: pointer; font-size: 0.7rem; letter-spacing: 2px; margin-top: 8px; transition: 0.3s; }
    .admin-section .gen-btn:hover:not(:disabled) { border-color: rgba(255,215,150,0.3); color: #f2e3d5; }
    .admin-section .gen-btn:disabled { opacity: 0.3; cursor: not-allowed; }
    .line-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px; border-radius: 40px; border: 1px solid rgba(0,200,100,0.2); background: rgba(0,200,100,0.05); color: #a8d8c8; font-size: 0.85rem; letter-spacing: 2px; cursor: pointer; text-decoration: none; margin-bottom: 14px; transition: 0.3s; }
    .line-btn:hover { background: rgba(0,200,100,0.1); border-color: rgba(0,200,100,0.3); color: #c8f0e0; }
    .nfc-notification { position: fixed; top: 20px; left: 50%; z-index: 10000; transform: translateX(-50%); max-width: 90%; padding: 12px 24px; border-radius: 40px; border: 1px solid rgba(100,200,150,0.3); background: rgba(10,8,12,0.95); color: #a8d8c8; font-size: 0.85rem; letter-spacing: 1px; text-align: center; backdrop-filter: blur(12px); box-shadow: 0 10px 40px rgba(0,0,0,0.8); animation: nfcSlideDown 0.5s ease; transition: opacity 0.5s, transform 0.5s; }
    .nfc-notification.leaving { opacity: 0; transform: translate(-50%, -10px); }
    @keyframes nfcSlideDown { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

    @media (max-width: 480px) {
      #authOverlay { align-items: flex-start; }
      .auth-box { padding: 24px 16px; margin: auto 0; max-height: calc(100dvh - 32px); overflow-y: auto; }
      .auth-box input { min-height: 48px; font-size: 16px; }
      .code-row .paste-btn { min-height: 44px; }
      .app-container { padding: 14px 10px; border-radius: 28px; }
      .cards-grid { gap: 8px; }
      h1 { font-size: 1.2rem; }
      .draw-btn { font-size: 0.8rem; padding: 10px 12px; }
      .fav-btn { font-size: 0.7rem; padding: 10px 12px; }
      .code-row { flex-direction: column; }
      .code-row input { width: 100%; }
      .code-row .paste-btn { width: 100%; }
    }
