* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #000;
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    padding: 30px 0 20px;
}

.title {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    color: #fff;
    margin-bottom: 15px;
}

.header-subtitle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.token-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #888;
    letter-spacing: 0.1em;
}

.ca-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #222;
    border-radius: 4px;
}

.ca-address {
    font-family: monospace;
    font-size: 0.85rem;
    color: #666;
}

.copy-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.copy-btn:hover {
    color: #fff;
}

.copy-btn.copied {
    color: #4ade80;
}

/* Visualization */
.visualization {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 20px auto 40px;
}

#handsCanvas {
    width: 100%;
    height: auto;
    display: block;
    background: radial-gradient(ellipse at center, #0a0a0a 0%, #000 100%);
    border: 1px solid #111;
}

/* Unused old 3D styles removed */
}

/* Spirit Answer */
.spirit-answer {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.spirit-answer.show {
    opacity: 1;
}

.answer-text {
    font-size: 3rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
}

/* Chat Interface */
.chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.messages {
    flex: 1;
    min-height: 150px;
    max-height: 250px;
    overflow-y: auto;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #222;
    background: rgba(255,255,255,0.02);
}

.messages::-webkit-scrollbar {
    width: 4px;
}

.messages::-webkit-scrollbar-track {
    background: #111;
}

.messages::-webkit-scrollbar-thumb {
    background: #333;
}

.message {
    margin-bottom: 12px;
    padding: 8px 12px;
    animation: fadeIn 0.3s ease-in;
}

.user-message {
    text-align: right;
    color: #888;
    font-size: 0.95rem;
}

.spirit-message {
    text-align: left;
    color: #fff;
    font-weight: 500;
}

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

/* Loading message animation */
.loading-message {
    color: #888;
    font-style: italic;
}

.dots span {
    animation: blink 1.4s infinite;
    animation-fill-mode: both;
}

.dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.dots span:nth-child(4) {
    animation-delay: 0.6s;
}

@keyframes blink {
    0%, 60%, 100% {
        opacity: 0.2;
    }
    30% {
        opacity: 1;
    }
}

/* Input Section */
.input-section {
    margin-top: 20px;
}

.input-container {
    position: relative;
    background: #000;
    border: 1px solid #222;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.input-container:focus-within {
    border-color: #444;
}

#questionInput {
    width: 100%;
    padding: 16px 60px 16px 20px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    min-height: 56px;
    max-height: 120px;
    line-height: 1.5;
    overflow-y: auto;
}

#questionInput:focus {
    outline: none;
}

#questionInput::placeholder {
    color: #555;
}

/* Custom scrollbar for textarea */
#questionInput::-webkit-scrollbar {
    width: 4px;
}

#questionInput::-webkit-scrollbar-track {
    background: transparent;
}

#questionInput::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

.ask-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ask-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

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

.ask-btn.loading {
    pointer-events: none;
    opacity: 0.5;
}

.ask-btn .btn-text {
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid #333;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.ask-btn.loading .loading {
    display: block;
}

.ask-btn.loading .btn-text {
    display: none;
}

/* Disabled state */
.ask-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ask-btn:disabled:hover {
    transform: none;
    background: #fff;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* API Modal */
.api-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.98);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.api-modal.show {
    display: flex;
}

.modal-content {
    background: #000;
    border: 1px solid #222;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin-bottom: 30px;
    font-size: 1.2rem;
    letter-spacing: 0.2em;
    font-weight: 500;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    background: #000;
    border: 1px solid #222;
    color: #fff;
    font-size: 14px;
}

.modal-content input:focus {
    outline: none;
    border-color: #444;
}

.modal-content button {
    width: 100%;
    padding: 12px;
    background: #fff;
    color: #000;
    border: none;
    font-weight: 600;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-content button:hover {
    background: #f0f0f0;
}

/* About/FAQ Section */
.about-section {
    max-width: 600px;
    margin: 40px auto 30px;
    padding: 30px 20px;
    border-top: 1px solid #111;
}

.about-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: #888;
    margin-bottom: 15px;
}

.about-section p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 30px;
}

.about-section a {
    color: #aaa;
    text-decoration: underline;
    transition: color 0.2s;
}

.about-section a:hover {
    color: #fff;
}

.faq {
    margin-top: 30px;
}

.faq-item {
    margin-bottom: 12px;
    color: #777;
    font-size: 0.95rem;
}

.faq-item .q {
    color: #888;
    font-weight: 600;
    margin-right: 8px;
}

.faq-item .a {
    color: #888;
    font-weight: 600;
    margin: 0 8px 0 15px;
}

/* Footer */
footer {
    padding: 30px 0 20px;
    text-align: center;
    border-top: 1px solid #111;
    margin-top: auto;
}

.token-section {
    margin-bottom: 15px;
}

.token-label {
    font-weight: 600;
    margin-right: 10px;
    color: #666;
}

.token-ca {
    font-family: monospace;
    color: #888;
    font-size: 0.9rem;
}

.links {
    display: flex;
    gap: 25px;
    justify-content: center;
}

.links a {
    color: #666;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.links a:hover {
    color: #fff;
}


/* Share Section */
.share-section {
    text-align: center;
    margin: 15px 0;
    padding: 10px;
    border-top: 1px solid #111;
    border-bottom: 1px solid #111;
}

.share-btn {
    background: transparent;
    border: 1px solid #333;
    color: #888;
    padding: 10px 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 4px;
}

.share-btn:hover {
    border-color: #555;
    color: #fff;
    background: rgba(255,255,255,0.05);
}

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

.share-btn svg {
    width: 16px;
    height: 16px;
}

/* Rate Limit Info */
.rate-limit-info {
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    font-size: 0.85rem;
    color: #666;
}

.remaining-questions {
    color: #888;
}

.rate-limit-info.warning {
    color: #ff9800;
}

.rate-limit-info.danger {
    color: #ff4444;
}

/* Sample Questions */
.sample-questions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #111;
}

.sample-label {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.sample-question {
    background: transparent;
    border: 1px solid #222;
    color: #888;
    padding: 10px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.sample-question:hover {
    border-color: #444;
    color: #ccc;
    background: rgba(255,255,255,0.02);
}

.sample-question:active {
    transform: scale(0.98);
}

/* Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 1.5rem;
    }

    .viewport-3d {
        height: 350px;
    }

    .answer-text {
        font-size: 2.5rem;
    }

    .questions-grid {
        grid-template-columns: 1fr;
    }
}