/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Noto Serif TC', 'Noto Serif SC', Georgia, serif;
    background: linear-gradient(135deg, #1a0a0a 0%, #2d1810 50%, #1a0a0a 100%);
    color: #f5e6d3;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

.language-dropdown {
    padding: 8px 32px 8px 12px;
    font-size: 14px;
    font-family: inherit;
    background: #2d1810;
    color: #ffd700;
    border: 2px solid #8b6914;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffd700' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    transition: all 0.3s ease;
}

.language-dropdown:focus {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.language-dropdown option {
    background: #2d1810;
    color: #ffd700;
    padding: 10px;
}

.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
    padding: 118px 20px 40px;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.opening-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: min(100%, 1040px);
    text-align: center;
    padding: 0 15px;
}

.deity-image {
    width: clamp(80px, 20vw, 180px);
    height: clamp(80px, 20vw, 180px);
    margin-bottom: 30px;
}

.deity-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.3));
}

#app-title {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    margin-bottom: 8px;
    font-weight: 700;
}

.subtitle {
    font-size: clamp(0.85rem, 3vw, 1.1rem);
    color: #d4af37;
    margin-bottom: 30px;
}

.golden-btn {
    background: linear-gradient(135deg, #8b6914 0%, #ffd700 50%, #8b6914 100%);
    background-size: 200% 200%;
    color: #1a0a0a;
    border: none;
    padding: 14px 28px;
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    font-family: inherit;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.golden-btn:hover {
    background-position: 100% 100%;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.golden-btn:active {
    transform: translateY(0);
}

.golden-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.main-btn {
    width: 100%;
    max-width: 300px;
    padding: 16px 32px;
    font-size: clamp(1rem, 4vw, 1.2rem);
}

.small-btn {
    padding: 12px 20px;
    font-size: clamp(0.9rem, 3vw, 1rem);
    min-width: 80px;
}

.secondary-btn {
    background: transparent;
    color: #d4af37;
    border: 2px solid #8b6914;
    padding: 12px 24px;
    font-size: clamp(0.9rem, 3vw, 1rem);
    font-family: inherit;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.secondary-btn:hover {
    background: rgba(139, 105, 20, 0.2);
    border-color: #ffd700;
    color: #ffd700;
}

.divider {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 24px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #8b6914, transparent);
}

.divider span {
    padding: 0 16px;
    color: #a0926c;
    font-size: 0.9rem;
}

.direct-input-section {
    width: 100%;
}

.input-label {
    display: block;
    color: #d4af37;
    font-size: clamp(0.85rem, 3vw, 0.95rem);
    margin-bottom: 12px;
}

.input-row {
    display: flex;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
}

.stick-number-input {
    flex: 1;
    min-width: 100px;
    padding: 12px 16px;
    font-size: clamp(1rem, 3.5vw, 1.1rem);
    font-family: inherit;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #8b6914;
    border-radius: 8px;
    color: #ffd700;
    outline: none;
    transition: all 0.3s ease;
}

.stick-number-input::placeholder {
    color: #a0926c;
}

.stick-number-input:focus {
    border-color: #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.stick-number-input::-webkit-outer-spin-button,
.stick-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.stick-number-input[type=number] {
    -moz-appearance: textfield;
}

.input-error {
    color: #ff6b6b;
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    margin-top: 10px;
}

.input-error.hidden {
    display: none;
}

.stick-container-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

#shake-title {
    font-size: 1.6rem;
    color: #ffd700;
    margin-bottom: 10px;
}

.instruction {
    color: #d4af37;
    font-size: 0.95rem;
    margin-bottom: 30px;
}

.stick-container {
    position: relative;
    width: 140px;
    height: 280px;
    margin: 0 auto 20px;
}

.stick-container.shaking {
    animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

.stick-container.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.sticks {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    height: 220px;
    width: 180px;
    overflow: hidden;
}

.stick {
    position: absolute;
    width: 8px;
    height: 200px;
    background: linear-gradient(to bottom, #dc143c 0%, #ff4444 5%, #ffd700 15%, #d4a574 50%, #8b6914 100%);
    border-radius: 2px 2px 4px 4px;
    bottom: 0;
    transform-origin: bottom center;
}

.container-body {
    position: absolute;
    bottom: 0;
    left: 45%;
    transform: translateX(-50%);
    width: 160px;
    height: 220px;
}

.container-front {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #8b4513 0%, #654321 50%, #4a3520 100%);
    border-radius: 0 0 20px 20px;
    border: 3px solid #ffd700;
    border-top: none;
}

.shake-indicator {
    margin-top: 20px;
}

.shake-btn {
    background: linear-gradient(135deg, #8b6914 0%, #ffd700 50%, #8b6914 100%);
    color: #1a0a0a;
    border: none;
    padding: 16px 32px;
    font-size: 1.2rem;
    font-family: inherit;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}

.shake-btn:hover {
    transform: scale(1.05);
}

.shake-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.drawn-stick {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 250px;
    background: linear-gradient(to bottom, #dc143c 0%, #ff4444 3%, #ffd700 10%, #d4a574 50%, #8b6914 100%);
    border-radius: 4px;
    z-index: 10;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    opacity: 0;
    transition: all 1s ease;
}

.drawn-stick.rising {
    opacity: 1;
    transform: translateX(-50%) translateY(-80px);
}

.drawn-stick-number {
    writing-mode: vertical-rl;
    font-size: 1.2rem;
    font-weight: bold;
    color: #1a0a0a;
}

.selected-stick {
    margin-top: 30px;
    text-align: center;
}

.selected-stick.hidden {
    display: none;
}

.stick-display {
    margin-bottom: 15px;
}

.stick-body {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 200px;
    background: linear-gradient(to bottom, #dc143c 0%, #ff4444 2%, #ffd700 8%, #d4a574 50%, #8b6914 100%);
    border-radius: 6px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.stick-number {
    writing-mode: vertical-rl;
    font-size: 2.5rem;
    font-weight: bold;
    color: #1a0a0a;
}

.stick-label {
    font-size: 1.3rem;
    color: #ffd700;
    margin-bottom: 20px;
}

.result-wrapper {
    width: min(100%, 1040px);
    max-width: 800px;
    padding: 0 10px 40px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: linear-gradient(135deg, rgba(139, 105, 20, 0.3), rgba(255, 215, 0, 0.1));
    border: 1px solid #8b6914;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px;
}

.result-label {
    font-size: clamp(0.9rem, 3vw, 1rem);
    color: #d4af37;
}

.result-number {
    font-size: clamp(1.5rem, 5vw, 2rem);
    color: #ffd700;
    font-weight: bold;
}

.result-topic {
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    color: #f5e6d3;
    margin-left: 10px;
}

.fortune-rank {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    font-weight: 600;
    background: linear-gradient(135deg, #d4af37, #c9a227);
    color: #1a0a0a;
    white-space: nowrap;
}

.chatbot-section {
    margin-bottom: 24px;
}

.chatbot-container {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(45, 24, 16, 0.3));
    border: 2px solid #8b6914;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.chatbot-header {
    background: linear-gradient(135deg, rgba(139, 105, 20, 0.5), rgba(255, 215, 0, 0.2));
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.chatbot-header h3 {
    color: #ffd700;
    font-size: clamp(1rem, 3.5vw, 1.2rem);
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.question-counter {
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    color: #ffd700;
    background: rgba(139, 105, 20, 0.4);
    padding: 6px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.chatbot-messages {
    height: clamp(250px, 45vh, 350px);
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: rgba(0, 0, 0, 0.2);
    -webkit-overflow-scrolling: touch;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(139, 105, 20, 0.1);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.5);
}

.chatbot-message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: clamp(0.9rem, 3vw, 1rem);
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: messageSlideIn 0.3s ease-out;
}

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

.chatbot-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #8b6914, #6b5210);
    color: #f5e6d3;
    border-bottom-right-radius: 4px;
}

.chatbot-message.bot {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(139, 105, 20, 0.15));
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #f5e6d3;
    border-bottom-left-radius: 4px;
}

.chatbot-message.system {
    align-self: center;
    background: transparent;
    color: #a0926c;
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    text-align: center;
    box-shadow: none;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #d4af37;
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

.chatbot-input-area {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(26, 10, 10, 0.6), rgba(45, 24, 16, 0.4));
    border-top: 2px solid rgba(255, 215, 0, 0.2);
    align-items: center;
}

.chatbot-input {
    flex: 1;
    min-width: 0;
    padding: 14px 18px;
    font-size: clamp(0.95rem, 3vw, 1.05rem);
    font-family: inherit;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(139, 105, 20, 0.4);
    border-radius: 12px;
    color: #f5e6d3;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.chatbot-input::placeholder {
    color: #a0926c;
    font-style: italic;
}

.chatbot-input:focus {
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 16px rgba(255, 215, 0, 0.3);
}

.chatbot-send-btn {
    padding: 14px 24px;
    font-size: clamp(0.95rem, 3vw, 1.05rem);
    font-family: inherit;
    font-weight: 600;
    background: linear-gradient(135deg, #8b6914, #ffd700, #8b6914);
    background-size: 200% 200%;
    color: #1a0a0a;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    touch-action: manipulation;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.chatbot-send-btn:hover {
    background-position: 100% 100%;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 215, 0, 0.5);
}

.chatbot-send-btn:active {
    transform: translateY(0);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.content-section,
.guidance-section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(139, 105, 20, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
}

.guidance-section {
    margin-bottom: 24px;
}

.section-title {
    color: #ffd700;
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(139, 105, 20, 0.3);
}

.poem-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poem-line {
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    color: #f5e6d3;
    line-height: 1.8;
    text-align: center;
}

.story-box,
.interpretation-box {
    font-size: clamp(0.9rem, 3vw, 1rem);
    line-height: 1.8;
    color: #e5d6c3;
}

.guidance-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.guidance-line {
    font-size: clamp(0.9rem, 3vw, 1rem);
    color: #d4af37;
    text-align: center;
}

.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.question-item {
    background: rgba(139, 105, 20, 0.15);
    border: 1px solid rgba(139, 105, 20, 0.3);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.question-item:hover {
    background: rgba(139, 105, 20, 0.25);
}

.question-item strong {
    display: block;
    color: #ffd700;
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    margin-bottom: 6px;
}

.question-item span {
    color: #e5d6c3;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
}

.action-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10000;
    background: rgba(26, 10, 10, 0.94);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(139, 105, 20, 0.35);
}

.site-header-inner,
.site-footer-inner {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #ffd700;
    text-decoration: none;
    font-family: 'Noto Serif TC', 'Noto Serif SC', Georgia, serif;
    font-weight: 700;
    white-space: nowrap;
}

.site-brand-mark {
    font-size: 1.25rem;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.site-nav a,
.site-footer a,
.section-links a {
    text-decoration: none;
}

.site-nav a {
    padding: 8px 12px;
    border-radius: 8px;
    color: #b9ab7a;
    transition: 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.active {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.08);
    outline: none;
}

.site-controls {
    display: flex;
    align-items: center;
}

.site-shell {
    width: 100%;
}

.page-summary {
    width: 100%;
    margin-top: 26px;
    padding: 18px;
    border: 1px solid rgba(139, 105, 20, 0.35);
    border-radius: 8px;
    background: rgba(17, 10, 7, 0.72);
    text-align: left;
}

.page-summary h2 {
    color: #ffd700;
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.page-summary p {
    color: #e8dac5;
    font-size: 0.95rem;
}

.section-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.section-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(139, 105, 20, 0.35);
    border-radius: 8px;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.05);
}

.site-footer {
    border-top: 1px solid rgba(139, 105, 20, 0.28);
    padding: 20px 0 28px;
}

.site-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.site-footer p {
    color: #b9ab7a;
    font-size: 0.9rem;
}

.site-footer-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.site-footer-links a {
    color: #d4af37;
    font-size: 0.9rem;
}

@media (max-width: 860px) {
    .site-header-inner {
        padding: 14px 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .site-nav {
        justify-content: flex-start;
    }

    .site-controls {
        width: 100%;
    }

    .language-dropdown {
        width: 100%;
    }

    .screen {
        padding-top: 156px;
    }
}

@media (max-width: 640px) {
    .screen {
        padding-top: 172px;
    }

    .page-summary {
        padding: 16px;
    }

    .section-links {
        flex-direction: column;
    }
}

@media screen and (max-width: 359px) {
    html {
        font-size: 12px;
    }

    .screen {
        padding: 50px 10px 15px;
    }

    .opening-content {
        padding: 0 10px;
    }

    .deity-image {
        width: 70px;
        height: 70px;
        margin-bottom: 20px;
    }

    .result-wrapper {
        padding: 0 5px 30px;
    }

    .result-header {
        padding: 12px 15px;
    }

    .content-section,
    .guidance-section {
        padding: 12px 15px;
    }

    .chatbot-input-area {
        padding: 12px 15px;
        flex-direction: column;
        gap: 10px;
    }

    .chatbot-send-btn {
        width: 100%;
    }

    .questions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .question-item {
        padding: 10px 8px;
    }

    .action-buttons {
        gap: 10px;
    }

    .action-buttons .golden-btn,
    .action-buttons .secondary-btn {
        width: 100%;
        padding: 12px 20px;
    }
}

@media screen and (min-width: 360px) and (max-width: 599px) {
    html {
        font-size: 14px;
    }

    .screen {
        padding: 50px 15px 15px;
    }

    .deity-image {
        width: 100px;
        height: 100px;
    }

    .input-row {
        flex-direction: column;
    }

    .input-row .golden-btn {
        width: 100%;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        align-self: flex-end;
    }

    .result-topic {
        display: block;
        margin-left: 0;
        margin-top: 4px;
    }

    .chatbot-messages {
        height: 240px;
    }

    .chatbot-input-area {
        flex-direction: column;
    }

    .chatbot-send-btn {
        width: 100%;
    }

    .questions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .action-buttons .golden-btn,
    .action-buttons .secondary-btn {
        width: 100%;
    }
}

@media screen and (min-width: 600px) and (max-width: 899px) {
    html {
        font-size: 15px;
    }

    .screen {
        padding: 60px 20px 20px;
    }

    .opening-content {
        max-width: 450px;
    }

    .deity-image {
        width: 140px;
        height: 140px;
    }

    .result-wrapper {
        max-width: 700px;
    }

    .chatbot-messages {
        height: 300px;
    }

    .questions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (min-width: 900px) and (max-width: 1199px) {
    .screen {
        padding: 70px 30px 30px;
    }

    .result-wrapper {
        max-width: 750px;
    }

    .chatbot-messages {
        height: 340px;
    }

    .questions-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media screen and (min-width: 1200px) {
    .screen {
        padding: 80px 40px 40px;
    }

    .result-wrapper {
        max-width: 850px;
    }

    .chatbot-messages {
        height: 380px;
    }

    .questions-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media screen and (orientation: landscape) and (max-height: 500px) {
    .screen {
        padding-top: 50px;
        min-height: auto;
    }

    .opening-content {
        justify-content: flex-start;
        padding-top: 10px;
    }

    .deity-image {
        width: 70px;
        height: 70px;
        margin-bottom: 10px;
    }

    .subtitle {
        margin-bottom: 15px;
    }

    .divider {
        margin: 15px 0;
    }

    .stick-container-wrapper {
        justify-content: flex-start;
        padding-top: 10px;
    }

    .stick-container {
        width: 100px;
        height: 200px;
        margin-bottom: 10px;
    }

    .chatbot-messages {
        height: 180px;
    }
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .deity-image img {
        image-rendering: -webkit-optimize-contrast;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .stick-container.shaking {
        animation: none;
    }

    .golden-btn:hover,
    .secondary-btn:hover,
    .shake-btn:hover {
        transform: none;
    }

    .chatbot-message {
        animation: none;
    }
}

@media (hover: none) and (pointer: coarse) {
    .golden-btn:hover,
    .secondary-btn:hover,
    .shake-btn:hover,
    .question-item:hover,
    .chatbot-send-btn:hover {
        transform: none;
        box-shadow: none;
    }

    .golden-btn:active {
        transform: scale(0.98);
    }

    .secondary-btn:active {
        background: rgba(139, 105, 20, 0.3);
    }

    .chatbot-send-btn:active {
        transform: scale(0.95);
    }

    .language-dropdown {
        min-height: 44px;
    }

    .golden-btn,
    .secondary-btn,
    .shake-btn,
    .chatbot-send-btn {
        min-height: 48px;
    }

    .chatbot-input,
    .stick-number-input {
        min-height: 48px;
    }
}

@supports (padding: max(0px)) {
    .screen {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .chatbot-input-area {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

@media print {
    .chatbot-section,
    .action-buttons {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .screen {
        min-height: auto;
        padding: 20px;
    }

    .result-header,
    .content-section,
    .guidance-section {
        background: white;
        border: 1px solid #ccc;
    }

    .fortune-rank {
        background: #f0f0f0;
    }

    #app-title,
    .section-title,
    .result-number {
        color: black;
    }
}

/* ==================== FORTUNECOME REBRAND ==================== */
:root {
    --brand-ink: #0b0b0d;
    --brand-ink-soft: #141214;
    --brand-surface: rgba(19, 16, 17, 0.92);
    --brand-surface-alt: rgba(29, 23, 22, 0.88);
    --brand-gold: #d4af37;
    --brand-gold-strong: #ebc96d;
    --brand-vermilion: #a72a1e;
    --brand-jade: #5e8a7e;
    --brand-parchment: #f4e9d3;
    --brand-text: #eee0c8;
    --brand-muted: #baa98d;
    --brand-border: rgba(212, 175, 55, 0.2);
}

body {
    background:
        radial-gradient(circle at top, rgba(167, 42, 30, 0.2), transparent 28%),
        radial-gradient(circle at 80% 14%, rgba(94, 138, 126, 0.12), transparent 18%),
        linear-gradient(180deg, #0b0b0d 0%, #130f10 100%);
    color: var(--brand-text);
}

.language-dropdown,
.stick-number-input,
.chatbot-input {
    background: rgba(22, 18, 18, 0.92);
    border-color: rgba(212, 175, 55, 0.32);
    color: var(--brand-parchment);
}

.language-dropdown option {
    background: #161213;
    color: var(--brand-parchment);
}

.language-dropdown:focus,
.stick-number-input:focus,
.chatbot-input:focus {
    border-color: var(--brand-gold-strong);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

#app-title,
#shake-title,
.section-title,
.chatbot-header h3,
.result-number,
.page-summary h2,
.site-footer-links a:hover,
.site-footer-links a:focus-visible {
    color: var(--brand-gold-strong);
}

.subtitle,
.instruction,
.result-label,
.site-footer p,
.site-nav a,
.question-counter,
.divider span,
.page-summary p,
.story-box,
.interpretation-box {
    color: var(--brand-muted);
}

.site-header {
    background: rgba(11, 11, 13, 0.92);
    border-bottom-color: var(--brand-border);
}

.site-brand {
    gap: 12px;
    color: inherit;
}

.site-brand-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
}

.site-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    line-height: 1;
}

.site-brand-wordmark {
    color: var(--brand-parchment);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.site-brand-subline {
    color: var(--brand-jade);
    font-family: 'Noto Sans', 'Noto Sans TC', 'Noto Sans SC', sans-serif;
    font-size: 0.63rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.active {
    color: var(--brand-parchment);
    background: rgba(94, 138, 126, 0.1);
}

.golden-btn,
.shake-btn,
.chatbot-send-btn {
    background: linear-gradient(135deg, #7f1f17 0%, #a72a1e 34%, #d4af37 100%);
    color: #140f0d;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

.secondary-btn {
    color: var(--brand-parchment);
    border-color: rgba(94, 138, 126, 0.45);
    background: rgba(19, 16, 17, 0.5);
}

.secondary-btn:hover {
    background: rgba(94, 138, 126, 0.12);
    color: var(--brand-parchment);
}

.divider::before,
.divider::after {
    background: linear-gradient(90deg, transparent, var(--brand-gold), transparent);
}

.result-header,
.page-summary,
.content-section,
.guidance-section,
.chatbot-container,
.question-item {
    background: var(--brand-surface);
    border-color: var(--brand-border);
}

.chatbot-header,
.chatbot-input-area {
    background: linear-gradient(135deg, rgba(167, 42, 30, 0.26), rgba(94, 138, 126, 0.14));
    border-color: rgba(212, 175, 55, 0.2);
}

.chatbot-messages {
    background: rgba(11, 11, 13, 0.38);
}

.chatbot-message.user {
    background: linear-gradient(135deg, #7f1f17 0%, #a72a1e 34%, #d4af37 100%);
    color: #140f0d;
}

.chatbot-message.bot {
    background: linear-gradient(135deg, rgba(94, 138, 126, 0.12), rgba(212, 175, 55, 0.08));
    border-color: rgba(94, 138, 126, 0.26);
    color: var(--brand-text);
}

.fortune-rank {
    background: linear-gradient(135deg, #d4af37 0%, #f0d890 100%);
    color: #140f0d;
}

.question-item strong {
    color: var(--brand-gold-strong);
}

.question-item {
    background: rgba(94, 138, 126, 0.1);
    border-color: rgba(94, 138, 126, 0.22);
}

.question-item span,
.poem-line,
.guidance-line,
.result-topic,
.site-footer-links a,
.section-links a {
    color: var(--brand-text);
}

.section-links a {
    background: rgba(94, 138, 126, 0.1);
    border-color: rgba(94, 138, 126, 0.22);
}

.section-links a:hover,
.section-links a:focus-visible {
    background: rgba(94, 138, 126, 0.16);
}
