:root {
    --primary-color: #ff6b6b;
    --secondary-color: #feca57;
    --accent-color: #ff9f43;
    --bg-gradient: linear-gradient(135deg, #fff5f5 0%, #fff0f0 100%);
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-color: #2d3436;
    --shadow: 0 8px 32px 0 rgba(255, 107, 107, 0.1);
}

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

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: #fff5f5;
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 20%, rgba(255, 107, 107, 0.05), transparent),
                radial-gradient(circle at 80% 80%, rgba(254, 202, 87, 0.05), transparent);
    z-index: -1;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

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

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1rem;
    color: #636e72;
    font-weight: 500;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.intro-card {
    text-align: center;
    font-size: 1.1rem;
    border-left: 5px solid var(--primary-color);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #485460;
}

.form-section {
    margin-bottom: 25px;
}

/* シチュエーションプリセット (独自案1) */
.preset-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.preset-btn {
    background: white;
    border: 2px solid #eee;
    padding: 10px 5px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    border-color: var(--primary-color);
}

.preset-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #eee;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 性格タグ (独自案2) */
.tag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.tag {
    background: #f1f2f6;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.tag:hover {
    background: #e1e2e6;
}

.tag.active {
    background: var(--secondary-color);
    color: #2d3436;
    font-weight: 700;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    padding: 18px;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.hidden {
    display: none;
}

/* Loader */
.loading-card {
    text-align: center;
}

.loader-container {
    padding: 40px 0;
}

.loader {
    width: 60px;
    height: 60px;
    border: 5px solid #eee;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.typing-text {
    font-size: 0.9rem;
    color: #636e72;
    margin-top: 10px;
}

/* Result */
.result-header {
    border-bottom: 2px solid #fff5f5;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.result-content {
    white-space: pre-line;
    font-size: 1.05rem;
    color: #2d3436;
    margin-bottom: 30px;
}

.rakuten-section {
    background: #fffafa;
    border: 1px dashed var(--primary-color);
    padding: 20px;
    border-radius: 18px;
    margin-bottom: 25px;
}

.rakuten-section h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.rakuten-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.rakuten-search-btn {
    display: inline-flex;
    align-items: center;
    background: #bf0000;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.2s;
}

.rakuten-search-btn:hover {
    background: #a00000;
    transform: scale(1.05);
}

.divider {
    border: 0;
    height: 1px;
    background: #eee;
    margin: 40px 0;
}

/* 楽天商品グリッド */
.rakuten-items-section {
    margin-top: 30px;
}

.rakuten-items-section h3 {
    font-size: 1.3rem;
    color: var(--text-color);
    margin-bottom: 20px;
    text-align: center;
}

.rakuten-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.item-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    border: 1px solid #f0f0f0;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.item-link-wrapper {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.item-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f9f9f9;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.item-info {
    padding: 12px;
    flex-grow: 1;
}

.item-name {
    font-size: 0.85rem;
    color: #2d3436;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    height: 2.8em;
}

.item-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.item-rating {
    font-size: 0.75rem;
    color: #636e72;
    display: flex;
    align-items: center;
}

.rating-star {
    color: #fdcb6e;
    margin-right: 3px;
}

.btn-buy {
    display: block;
    width: 100%;
    padding: 10px;
    background: #f1f2f6;
    color: #2d3436;
    text-align: center;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
    border-top: 1px solid #f0f0f0;
}

.btn-buy:hover {
    background: var(--primary-color);
    color: white;
}

.char-counter {
    text-align: right;
    font-size: 0.8rem;
    color: #95a5a6;
    margin-top: 4px;
}

.btn-reset {
    width: 100%;
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 18px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-reset:hover {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2);
    transform: translateY(-2px);
}

footer {
    text-align: center;
    padding: 40px 0;
    font-size: 0.85rem;
    color: #b2bec3;
}

footer nav {
    margin-top: 15px;
}

footer a {
    color: #b2bec3;
    margin: 0 10px;
    text-decoration: none;
}

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

/* Responsive */
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    h1 {
        font-size: 2rem;
    }
}
