:root {
    --primary-color: #6b46c1;
    --secondary-color: #ec4899;
    --accent-color: #f59e0b;
    --background-color: #fafafa;
    --card-background: #ffffff;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    flex: 1;
}

.generator-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: var(--card-background);
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.tab-button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: var(--background-color);
}

.tab-button.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: var(--shadow);
}

.generator-content {
    background: var(--card-background);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.input-section {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

input[type="text"],
select {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    min-width: 200px;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

.generate-btn {
    padding: 14px 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.result-section {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result {
    font-size: 1.5rem;
    text-align: center;
    padding: 20px;
    color: var(--text-color);
    line-height: 1.8;
    animation: fadeIn 0.5s ease;
}

.result.dajare {
    font-weight: 600;
    color: var(--primary-color);
}

.result.kaibun {
    font-family: "Noto Serif JP", serif;
    color: var(--secondary-color);
    letter-spacing: 0.1em;
}

.result.nazonazo {
    position: relative;
}

.nazonazo-answer {
    display: block;
    margin-top: 20px;
    padding: 15px;
    background: var(--background-color);
    border-radius: 10px;
    color: var(--accent-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nazonazo-answer:hover {
    background: var(--accent-color);
    color: white;
}

.nazonazo-answer.revealed {
    background: var(--accent-color);
    color: white;
}

.share-section {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 40px;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.share-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.share-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.share-btn .icon {
    font-size: 1.2rem;
}

.history-section {
    background: var(--card-background);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.history-section h3 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.history-item {
    padding: 15px;
    margin-bottom: 10px;
    background: var(--background-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.history-item-type {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.history-item-content {
    color: var(--text-color);
    font-size: 1.1rem;
}

.history-item-time {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

.clear-btn {
    padding: 10px 20px;
    background: var(--background-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
}

footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    h1 {
        font-size: 2rem;
    }
    
    .generator-content {
        padding: 20px;
    }
    
    .input-section {
        flex-direction: column;
    }
    
    input[type="text"],
    select {
        min-width: 100%;
    }
    
    .result {
        font-size: 1.2rem;
    }
}