/* 017 Cafe' Tarot App Core Style Sheet */
:root {
    --bg-cream: #F5F8FA;
    --bg-dark-cream: #E1E8ED;
    --text-espresso: #1A3C6B;  /* 017 官方深藍色 */
    --text-light: #FFFFFF;
    --accent-amber: #63B3ED;   /* 補色調線條藍 */
    --accent-gold: #D4AF37;    /* 尊貴金 */
    --accent-green: #2B6CB0;   /* 輔助藍 */
    --border-gray: #CCCCCC;
    --card-width: 90px;
    --card-height: 150px;
}

#tarot-app-wrapper *, #tarot-app-wrapper *::before, #tarot-app-wrapper *::after {
    box-sizing: border-box;
}

#tarot-app-wrapper {
    min-height: 800px;
    width: 100%;
    position: relative;
    background-color: var(--bg-cream);
    color: var(--text-espresso);
    overflow: hidden;
    display: block;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    padding: 0;
}

/* 隱藏輔助器 */
#tarot-app-wrapper .hidden {
    display: none !important;
}

/* 按鈕樣式規範 */
.tarot-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95rem;
    color: var(--text-light);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, opacity 0.3s, background-color 0.2s;
    white-space: nowrap;
    display: inline-block;
    text-align: center;
}
.tarot-btn:active {
    transform: scale(0.95);
}
.tarot-btn.btn-primary { background-color: var(--text-espresso); }
.tarot-btn.btn-secondary { background-color: #718096; }
.tarot-btn.btn-accent { background-color: var(--accent-gold); color: #1a202c; }

/* 頂部控制列 */
.app-controls {
    width: 100%;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid var(--bg-dark-cream);
    position: relative;
    z-index: 3000;
}
.app-controls .mode-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-espresso);
}

/* 起始畫面 */
#screen-start {
    padding: 50px 20px;
    text-align: center;
}
#screen-start .logo-container {
    margin-bottom: 20px;
}
#screen-start .logo-container img, #screen-start .logo-container svg {
    max-width: 160px;
    height: auto;
    margin: 0 auto;
}
.fallback-logo {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-espresso);
    letter-spacing: 2px;
}
.app-slogan {
    font-size: 1.3rem;
    margin-bottom: 40px;
    color: var(--text-espresso);
    font-weight: 500;
    position: relative;
}

/* 主選單網格 */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}
.menu-card-btn {
    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 25px 20px;
    cursor: pointer;
    text-align: left;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
}
.menu-card-btn:hover {
    border-color: var(--accent-gold);
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(212,175,55,0.1);
}
.menu-card-btn .icon {
    font-size: 2rem;
    margin-bottom: 12px;
}
.menu-card-btn .title {
    font-size: 1.15rem;
    font-weight: bold;
    color: var(--text-espresso);
    margin-bottom: 6px;
}
.menu-card-btn .desc {
    font-size: 0.85rem;
    color: #718096;
    line-height: 1.4;
}

/* 每日一占佈局 */
.daily-container {
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.tarot-card-single {
    width: var(--card-width);
    height: var(--card-height);
    perspective: 1000px;
    margin: 30px 0;
    cursor: pointer;
}

/* 卡牌翻轉核心機制 */
.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.tarot-card-single.is-flipped .card-inner, .card-on-table.is-flipped .card-inner {
    transform: rotateY(180deg);
}
.card-back, .card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 6px;
    overflow: hidden;
}
.card-back {
    background-color: var(--text-espresso);
    background-image: url('https://www.017cafe.com/wp-content/uploads/2026/02/s17card10th.png');
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255,255,255,0.1);
}
.card-front {
    background-color: white;
    transform: rotateY(180deg);
    border: 1px solid #e2e8f0;
}
.card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.reversed-img {
    transform: rotate(180deg);
}

.card-result-info {
    text-align: center;
    margin-top: 15px;
    animation: fadeIn 0.5s ease forwards;
}
.card-result-info .card-name {
    font-size: 1.5rem;
    color: var(--text-espresso);
    margin-bottom: 5px;
}
.card-result-info .card-orientation {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--accent-gold);
    margin-bottom: 20px;
}

/* 擬真占卜介面工具列 */
.simulation-toolbar {
    width: 100%;
    background: #ffffff;
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    border-bottom: 2px solid var(--bg-dark-cream);
}
#shuffle-btn { background-color: #ED8936; }
#ok-btn { background-color: #38A169; }
#ok-btn:disabled { opacity: 0.4; pointer-events: none; }

/* 橫向牌堆區 */
.deck-container {
    width: 100%;
    height: 180px;
    position: relative;
    background: #ffffff;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 100;
    padding: 15px 20px;
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--text-espresso);
    box-shadow: inset 0 -5px 10px rgba(0,0,0,0.02);
}
.deck-container::-webkit-scrollbar { height: 6px; }
.deck-container::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.deck-static-card {
    width: 70px;
    height: 116px;
    flex-shrink: 0;
    background-color: var(--text-espresso);
    background-image: url('https://www.017cafe.com/wp-content/uploads/2026/02/s17card10th.png');
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}
.deck-static-card:hover {
    transform: translateY(-8px);
}

/* 占卜桌面布幕區 */
.table-zone {
    width: 100%;
    height: 550px;
    position: relative;
    background-image: radial-gradient(var(--bg-dark-cream) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: hidden;
    z-index: 10;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}
.hint-container {
    position: absolute;
    top: 15px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}
.hint-text {
    color: var(--text-espresso);
    font-weight: bold;
    font-size: 0.95rem;
    text-align: center;
    background: rgba(255,255,255,0.85);
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px dashed var(--bg-dark-cream);
    max-width: 90%;
}

/* 桌面上的牌卡 */
.card-on-table {
    width: var(--card-width);
    height: var(--card-height);
    position: absolute !important;
    z-index: 10;
    cursor: grab;
    touch-action: none;
}
.card-on-table:active {
    cursor: grabbing;
}
.card-on-table .card-inner {
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* 牌卡控制鈕 (翻牌與刪除) */
.card-actions-overlay {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 50;
    pointer-events: auto;
}
.card-act-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-act-btn.btn-flip { color: var(--text-espresso); }
.card-act-btn.btn-delete { color: #e53e3e; }

/* 牌陣錨點提示 */
.spread-slots-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.spread-slot-anchor {
    position: absolute;
    width: var(--card-width);
    height: var(--card-height);
    border: 2px dashed rgba(26,60,107,0.3);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
}
.spread-slot-anchor .slot-label {
    font-size: 0.75rem;
    font-weight: bold;
    color: rgba(26,60,107,0.6);
    background: rgba(255,255,255,0.8);
    padding: 2px 6px;
    border-radius: 10px;
    text-align: center;
}

/* 建議牌陣選單 */
.spreads-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 30px 20px;
}
.spreads-container h3 {
    text-align: center;
    color: var(--text-espresso);
    font-size: 1.4rem;
    margin-bottom: 10px;
}
.section-intro {
    text-align: center;
    color: #4a5568;
    margin-bottom: 30px;
}
.spreads-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.spread-item-card {
    background: #ffffff;
    border: 1px solid var(--bg-dark-cream);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}
.spread-item-card:hover {
    border-color: var(--text-espresso);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.spread-item-card h4 {
    margin: 0 0 8px 0;
    color: var(--text-espresso);
}
.spread-item-card p {
    margin: 0;
    font-size: 0.85rem;
    color: #4a5568;
    line-height: 1.5;
}
.external-links-box {
    margin-top: 40px;
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-gold);
}
.link-item {
    display: block;
    color: var(--text-espresso);
    text-decoration: none;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 0.95rem;
}
.link-item:last-child { margin-bottom: 0; }
.link-item:hover { text-decoration: underline; }

/* 牌義諮詢頁面 */
.consult-container {
    max-width: 650px;
    margin: 0 auto;
    padding: 30px 20px;
}
.consult-steps-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 30px 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    margin-bottom: 30px;
}
.consult-steps-card h3 {
    margin-top: 0;
    margin-bottom: 25px;
    color: var(--text-espresso);
    text-align: center;
}
.step-timeline {
    display: flex;
    flex-direction: column;
    gap: 25px;
}
.step-node {
    display: flex;
    gap: 20px;
}
.step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--text-espresso);
    color: #ffffff;
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.step-body h5 {
    margin: 0 0 6px 0;
    font-size: 1.05rem;
    color: var(--text-espresso);
}
.step-body p {
    margin: 0;
    font-size: 0.9rem;
    color: #4a5568;
    line-height: 1.5;
}
.bank-details {
    margin-top: 10px;
    background: var(--bg-cream);
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid var(--bg-dark-cream);
}
.bank-details p {
    margin: 3px 0;
    font-family: inherit;
}
.bank-details code {
    font-size: 1.1rem;
    font-weight: bold;
    color: #c53030;
    letter-spacing: 1px;
}
.line-redirect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: #06C755;
    color: #ffffff;
    text-decoration: none;
    padding: 16px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(6,199,85,0.3);
    transition: transform 0.2s;
}
.line-redirect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(6,199,85,0.4);
}
.line-icon {
    width: 28px;
    height: 28px;
}

/* 全螢幕洗牌動畫機制 */
#vortex-fullscreen-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(26,60,107,0.15);
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}
.shuffle-animation-deck {
    position: relative;
    width: var(--card-width);
    height: var(--card-height);
}
.shuffle-card {
    position: absolute;
    width: var(--card-width);
    height: var(--card-height);
    background-image: url('https://www.017cafe.com/wp-content/uploads/2026/02/s17card10th.png');
    background-size: cover;
    background-position: center;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    will-change: transform;
}

@keyframes overhandShuffle {
    0% { transform: translate(0, 0) rotate(0deg); z-index: 1; }
    50% { transform: translate(var(--tx), var(--ty)) rotate(var(--rot)); z-index: 10; box-shadow: 0 10px 20px rgba(0,0,0,0.5); }
    100% { transform: translate(0, 0) rotate(0deg); z-index: 5; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 響應式優化 */
@media (max-width: 600px) {
    .app-controls { padding: 10px; }
    .tarot-btn { padding: 8px 16px; font-size: 0.85rem; }
    .app-controls .mode-title { font-size: 1.05rem; }
    .spreads-list { grid-template-columns: 1fr; gap: 15px; }
    .table-zone { height: 480px; }
}
