/**
 * 占いシステム フロントエンドスタイル
 * モダンで使いやすいデザイン
 */

/* リセット & ベース */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #6366f1;
    --color-primary-dark: #4f46e5;
    --color-secondary: #8b5cf6;
    --color-accent: #ec4899;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-bg: #f9fafb;
    --color-bg-card: #ffffff;
    --color-border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.header__title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header__subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* メインコンテンツ */
.main {
    position: relative;
}

/* フォームセクション */
.form-section {
    margin-bottom: 2rem;
}

.form-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
}

.form-card__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--color-primary);
}

.fortune-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.875rem;
}

.form-input,
.form-textarea {
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

/* ボタン */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn--primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn--secondary {
    background: white;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn--secondary:hover {
    background: var(--color-primary);
    color: white;
}

/* 結果セクション */
.results-section {
    margin-top: 2rem;
}

.loading {
    text-align: center;
    padding: 3rem;
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.loading__spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading__text {
    color: var(--color-text-light);
    font-size: 1.125rem;
}

.results {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

.results-top {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.results-bottom {
    width: 100%;
}

/* 結果カード */
.result-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s;
}

.result-card:hover {
    transform: translateY(-4px);
}

.result-card__header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-border);
}

.result-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary);
}

.result-card__body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.result-item__label {
    font-weight: 600;
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.result-item__value {
    font-weight: 700;
    color: var(--color-text);
    font-size: 1rem;
}

.result-item__value--fortune {
    font-size: 1.25rem;
    color: var(--color-accent);
}

.result-item__value--number {
    font-size: 2rem;
    color: var(--color-secondary);
}

.result-description {
    color: var(--color-text-light);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-top: 0.5rem;
}

/* タロットカード表示（3枚） */
.result-card--tarot {
    grid-column: 1 / -1;
    width: 100%;
}

.tarot-cards-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin: 2rem 0;
    padding: 1rem 0;
}

.tarot-card-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    transition: background 0.3s;
}

.tarot-card-item:hover {
    background: rgba(255, 255, 255, 0.8);
}

.tarot-card {
    width: 160px;
    height: 240px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    color: white;
    transform-style: preserve-3d;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.tarot-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: var(--shadow-xl);
    border-color: rgba(255, 255, 255, 0.5);
}

.tarot-card--reversed {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    border-color: rgba(255, 200, 200, 0.5);
}

.tarot-card__symbol {
    font-size: 4rem;
    margin-bottom: 0.75rem;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.tarot-card__name {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    padding: 0 0.75rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.3;
}

.tarot-card-info {
    width: 100%;
    text-align: center;
    padding: 0 0.5rem;
}

.tarot-card-position {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-radius: var(--radius-md);
    display: inline-block;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.tarot-card-meaning {
    font-weight: 700;
    color: var(--color-text);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.tarot-card-direction {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
    display: inline-block;
}

.tarot-card-description {
    font-size: 0.875rem;
    color: var(--color-text);
    line-height: 1.7;
    text-align: left;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-primary);
}

.tarot-interpretation {
    margin-top: 2.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: var(--radius-xl);
    border-left: 5px solid var(--color-warning);
    box-shadow: var(--shadow-md);
}

.tarot-interpretation__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.tarot-interpretation__text {
    color: var(--color-text);
    line-height: 2;
    font-size: 1rem;
    white-space: pre-wrap;
    font-weight: 500;
}

/* Geminiプロンプト */
.result-card--gemini {
    grid-column: 1 / -1;
}

.prompt-info {
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-primary);
}

.prompt-info__text {
    color: var(--color-text);
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0;
}

.gemini-prompt {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.prompt-textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    background: #f9fafb;
    color: var(--color-text);
    resize: vertical;
    min-height: 300px;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn--copy {
    align-self: flex-start;
    background: var(--color-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
}

.btn--copy:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 結果アクション */
.result-actions {
    text-align: center;
    margin-top: 2rem;
}

/* エラーメッセージ */
.error-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.error-message__content {
    background: var(--color-bg-card);
    padding: 2rem;
    border-radius: var(--radius-xl);
    max-width: 500px;
    margin: 1rem;
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.error-message__icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.error-message__text {
    color: var(--color-error);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* フッター */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0;
    color: white;
    opacity: 0.8;
}

.footer__text {
    font-size: 0.875rem;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .header__title {
        font-size: 2rem;
    }

    .form-card {
        padding: 1.5rem;
    }

    .results-top {
        grid-template-columns: 1fr;
    }

    .result-card--gemini {
        grid-column: 1;
    }

    .tarot-cards-display {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .tarot-card-item {
        padding: 1.5rem;
    }

    .tarot-card {
        width: 140px;
        height: 210px;
    }

    .tarot-card__symbol {
        font-size: 3.5rem;
    }

    .tarot-interpretation {
        padding: 1.5rem;
        margin-top: 2rem;
    }

    .tarot-interpretation__text {
        font-size: 0.9rem;
        line-height: 1.8;
    }
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    animation: fadeIn 0.5s ease-out;
}


