:root {
    /* Base UI Colors */
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.4);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    
    /* Layout */
    --max-width: 1000px;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 24px;
    
    /* Animation */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(at 0% 0%, hsla(253,16%,7deg,0.03) 0, transparent 50%), 
                      radial-gradient(at 50% 0%, hsla(225,39%,30deg,0.03) 0, transparent 50%), 
                      radial-gradient(at 100% 0%, hsla(339,49%,30deg,0.03) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* App Container */
.app-container {
    width: 100%;
    max-width: var(--max-width);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.6s ease-out;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #1e293b 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.color-wheel-link {
    display: inline-block;
    margin-bottom: -0.1rem;
    transition: transform 0.3s ease;
}

.color-wheel-link:hover {
    transform: scale(1.05) rotate(5deg);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 0;
}

.subtitle-en {
    color: var(--text-muted);
    font-size: 0.85rem;
    opacity: 0.5;
    margin-top: 0.4rem;
    letter-spacing: 0.03em;
}

/* About Link */
.about-link-container {
    margin-top: 3rem;
    text-align: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 1.5rem;
}

.about-link {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.about-link:hover {
    color: var(--text-main);
    text-decoration: underline;
}

/* Sections */
.step-section {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
}

.step-section.active {
    display: block;
    animation: fadeInUp 0.5s forwards;
}

.step-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
    text-align: center;
}

.step-header.result-header {
    flex-direction: row;
    justify-content: center;
    gap: 1.5rem;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #e2e8f0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    transition: var(--transition);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.back-btn:hover {
    background: #f1f5f9;
    transform: translateY(-50%) scale(1.05);
}

.step-badge {
    background: #dbe3ee;
    color: #334155;
    font-size: 1.2rem;
    font-weight: 300;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Hue Grid (Step 1) */
.hue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}

.hue-item {
    background: white;
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hue-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.hue-color-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 1rem;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.hue-item:hover .hue-color-circle {
    transform: scale(1.05);
}

.hue-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.hue-hex {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.2rem;
    font-family: monospace;
}

/* Theme Grid (Step 2) */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.theme-item {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.theme-item:hover {
    transform: translateY(-5px);
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.theme-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.theme-en {
    font-family: var(--font-en);
    color: var(--text-muted);
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.theme-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.theme-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.theme-tag {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

/* Result Palettes (Step 3) */
.palettes-container {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 3rem;
}

.palette-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 0.85rem 1.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
}

.palette-card-header {
    margin-bottom: 0.75rem;
}

.palette-list-header {
    margin-bottom: 1.5rem;
}

.palette-list-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.palette-list-header p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.palette-card-header h3 {
    font-size: 1.25rem;
    margin-bottom: 0.2rem;
}

.palette-card-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.palette-colors {
    display: flex;
    height: 50px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.color-block {
    flex: 1 1 0%;
    min-width: 0;
    position: relative;
    cursor: pointer;
    transition: flex 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem;
}

.color-block:hover {
    flex: 1.2;
}

.color-info {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.color-block:hover .color-info {
    /* override opacity to 1 is not effective since display: none, this is fine */
    opacity: 1;
    transform: translateY(0);
}

.copy-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.copy-indicator.show {
    opacity: 1;
    transform: translate(-50%, -60%);
}

.color-role {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.color-hex {
    font-family: monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.result-meta {
    display: inline-block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 0.5rem;
}

.result-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* Action Buttons */
.result-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--text-main);
    color: white;
    box-shadow: 0 4px 15px rgba(30, 41, 59, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 41, 59, 0.4);
    background: #0f172a;
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid transparent;
}

.btn-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid #cbd5e1;
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e293b;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-weight: 500;
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.app-footer {
    margin-top: auto;
    text-align: center;
    padding-top: 3rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Step 3 2-Column Layout --- */
.result-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.result-left, .result-right {
    flex: 1;
    min-width: 0;
}

.result-left .palettes-container {
    margin-bottom: 0;
}

/* Palette Card Selection */
.palette-card.selectable {
    border: 2px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
}

.palette-card.active-palette {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 10px 40px rgba(0,0,0,0.05);
}

.palette-card.selectable:hover:not(.active-palette) {
    border-color: rgba(59, 130, 246, 0.4);
}

/* Preview Panel */
.preview-panel {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
    position: sticky;
    top: 2rem;
}

.preview-title {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.75rem;
}

.preview-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f1f5f9;
}

.preview-tab-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

.preview-tab-btn:hover {
    color: var(--text-main);
}

.preview-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.preview-tab-content {
    display: none;
    animation: fadeInUp 0.4s ease forwards;
}

.preview-tab-content.active {
    display: block;
}

/* Card Mockup */
.card-mockup {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.05);
    transition: background-color 0.4s ease, color 0.4s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

.card-mockup-hero {
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: background-color 0.4s ease;
}

.card-mockup-body {
    padding: 1.25rem 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.4s ease;
}

.mockup-eyebrow {
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 500;
    margin-top: 1.25rem;
    margin-bottom: 0;
    transition: color 0.4s ease, opacity 0.4s ease, letter-spacing 0.4s ease;
}

#mockup-title {
    font-size: 1.4rem;
    margin-bottom: 0;
    line-height: 1.4;
    font-weight: 700;
    transition: color 0.4s ease, letter-spacing 0.4s ease;
}

#mockup-text {
    font-size: 0.95rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    max-width: 85%;
    text-align: left;
    transition: color 0.4s ease, letter-spacing 0.4s ease;
}

.mockup-btn {
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 50px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, font-family 0.4s ease, background-color 0.4s ease, color 0.4s ease;
}

.card-mockup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(0,0,0,0.06);
    transition: border-color 0.4s ease;
}

.mockup-chips {
    display: flex;
    gap: 6px;
}

.mockup-chip {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: background-color 0.4s ease;
}

.mockup-font-names {
    font-size: 0.7rem;
    opacity: 0.6;
    letter-spacing: 0.05em;
    text-align: right;
    transition: color 0.4s ease;
}

/* Details List */
.details-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
}

.detail-color-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.detail-info {
    flex: 1;
}

.detail-role {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-hex {
    font-family: monospace;
    font-weight: bold;
    font-size: 1rem;
}
.mobile-break {
    display: none;
}

@media (max-width: 768px) {
    .mobile-break {
        display: block;
    }
    .result-layout {
        flex-direction: column;
    }
    .preview-panel {
        position: static;
        margin-top: 1rem;
    }
    .palette-colors {
        flex-direction: column;
        height: auto;
        min-height: 400px;
    }
    
    .color-info {
        opacity: 1;
        transform: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 1rem;
        background: transparent;
        backdrop-filter: none;
    }
    
    .color-role, .color-hex {
        margin: 0;
    }
    
    .color-role {
        color: rgba(0,0,0,0.6);
    }
    
    #step-result {
        padding-bottom: 120px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    #btn-regenerate {
        position: fixed;
        bottom: calc(16px + env(safe-area-inset-bottom));
        left: 16px;
        right: 16px;
        width: auto;
        max-width: 400px;
        margin: 0 auto !important; /* 中央寄せの維持用（max-widthが効いた場合用） */
        z-index: 9999;
        box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
    }
    
    .hue-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .step-header h2 {
        font-size: 1.25rem;
    }
    
    .back-btn {
        position: static;
        transform: none;
        margin-bottom: 1rem;
    }
    
    .step-header.result-header {
        flex-direction: column;
    }

    /* Card Mockup Mobile Adjustments */
    .card-mockup-hero { padding: 1.5rem 1rem; }
    .card-mockup-body { padding: 1.25rem 1rem 1.5rem; }
    
    #mockup-title {
        font-size: 1.3rem; 
        line-height: 1.3;
    }
    
    .mockup-eyebrow {
        font-size: 0.8rem;
    }
    
    #mockup-text {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 1.25rem;
    }
    
    .mockup-btn {
        padding: 0.75rem 2rem;
    }
    
    #mockup-footer {
        padding: 0.75rem 1rem;
    }
    
    .mockup-font-names {
        font-size: 0.7rem;
        line-height: 1.4;
        text-align: right;
    }
    .font-name-separator { display: none; }
    .font-name-ja, .font-name-en { display: block; }
}

.download-btn {
    margin-top: 1.5rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* --- Language Specific Font overrides --- */

/* 英語テキスト (Outfit Light 300) */
.logo,
.subtitle-en,
.theme-en,
.hue-name,
.mockup-eyebrow,
.mockup-btn,
.font-name-en {
  font-family: 'Outfit', sans-serif;
  font-weight: 300;
}

/* 日本語テキスト (Noto Sans JP Regular 400) */
.font-name-ja,
.theme-name,
.palette-list-header h3,
.palette-list-header p,
.palette-card-header h3,
.palette-card-header p,
.preview-title,
.result-meta,
.result-desc {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 400;
}

body {
  letter-spacing: 0.01em;
}

/* h2 の太さを強制上書き */
h2 {
  font-weight: 400 !important;
}


/* Subtle dotted background */
body {
  background-color: var(--bg-color);
background-image:
  radial-gradient(circle, rgba(0, 0, 0, 0.08) 1px, transparent 1px),
  radial-gradient(at 0% 0%, hsla(253,16%,7%,0.03) 0, transparent 50%),
  radial-gradient(at 50% 0%, hsla(225,39%,30%,0.03) 0, transparent 50%),
  radial-gradient(at 100% 0%, hsla(339,49%,30%,0.03) 0, transparent 50%);
  background-size: 15px 15px, auto, auto, auto;
  background-attachment: fixed;
}


/* ▼モバイル表示のボタン固定用上書き追加ルール */
@media (max-width: 768px) {
  /* Safari対策：fixed を壊しやすい transform / animation を止める */
  #step-result,
  #step-result.active {
    transform: none !important;
    animation: none !important;
    opacity: 1 !important;
  }

  /* 念のため main 側も transform 影響を受けないようにする */
  .main-content,
  .app-container {
    transform: none !important;
  }

  /* 再生成ボタンを確実に画面下へ固定 */
  #btn-regenerate {
    position: fixed !important;
    left: 16px !important;
    right: 16px !important;
    bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    transform: none !important;
    z-index: 9999 !important;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
  }

  /* 固定ボタンと本文が重ならないようにする */
  #step-result {
    padding-bottom: 120px !important;
  }
}