:root {
    --primary: #FA6218;
    --primary-dark: #D94F0F;
    --primary-light: #FF7B3D;
    --bg: #F8F9FA;
    --bg-card: #FFFFFF;
    --text: #2D2D2D;
    --text-light: #666666;
    --text-lighter: #999999;
    --border: #E8E8E8;
    --warning: #FFC107;
    --error: #F44336;
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 20px;
    --space-xl: 24px;
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-content {
    max-width: 640px;
    margin: 0 auto;
    padding: var(--space-sm) var(--space-md);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 var(--space-md);
    flex: 1;
    padding-top: calc(var(--space-md) + 56px);
    padding-bottom: var(--space-md);
}

.input-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: var(--space-lg);
    min-height: 320px;
    width: 100%;
    box-sizing: border-box;
}

.intro {
    margin-bottom: var(--space-lg);
    text-align: center;
    opacity: 1;
    max-height: 200px;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
    overflow: hidden;
}

.intro.hidden {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
}

.intro-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--text);
}

.input-wrapper {
    position: relative;
    margin-bottom: var(--space-md);
}

textarea {
    width: 100%;
    padding: var(--space-md);
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    font-family: inherit;
    line-height: 1.6;
    resize: none;
    transition: border-color 0.2s;
}

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

textarea::placeholder {
    color: var(--text-lighter);
}

.char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: var(--space-xs);
}

.char-counter.warning {
    color: var(--warning);
}

.char-counter.error {
    color: var(--error);
}

.btn-submit {
    width: 100%;
    min-height: 52px;
    padding: var(--space-md);
    font-size: 17px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(250, 98, 24, 0.2);
    -webkit-tap-highlight-color: transparent;
}

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

.btn-submit:disabled {
    background: var(--border);
    box-shadow: none;
    cursor: not-allowed;
}

.examples {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
    opacity: 1;
    max-height: 300px;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.examples.hidden {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.examples-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.chip {
    padding: var(--space-xs) var(--space-sm);
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.chip:active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.loading {
    display: none;
    text-align: center;
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-top: var(--space-md);
    width: 100%;
    box-sizing: border-box;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-md);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

@-webkit-keyframes spin {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}

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

.loading p {
    font-size: 14px;
    color: var(--text-light);
}

.results-section {
    animation: fadeIn 0.3s ease;
    margin-top: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: var(--space-lg);
    width: 100%;
    box-sizing: border-box;
}

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

.result-header {
    margin-bottom: var(--space-md);
}

.result-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
}

.result-card {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
    width: 100%;
    box-sizing: border-box;
}

.result-card:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-text {
    font-size: 15px;
    color: var(--text);
    line-height: 1.7;
}

.suggestion-card {
    border-left: 4px solid var(--primary);
    padding-left: var(--space-md);
}

.card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.card-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
}

.card-title a {
    color: var(--text);
    text-decoration: none;
    display: block;
    transition: color 0.2s;
}

.card-title a:hover {
    color: var(--primary);
}

.card-title a:active {
    color: var(--primary-dark);
}

.card-reason {
    font-size: 15px;
    color: var(--text);
    line-height: 1.7;
    margin-bottom: var(--space-md);
}

.card-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    margin-top: var(--space-sm);
    padding: 4px 0;
    border-bottom: 1px solid transparent;
}

.card-link-btn:hover {
    border-bottom-color: var(--primary);
    gap: 6px;
}

.card-link-btn:active {
    opacity: 0.7;
}

.btn-text {
    line-height: 1;
}

.btn-icon {
    font-size: 14px;
    line-height: 1;
    transition: transform 0.2s;
}

.card-link-btn:hover .btn-icon {
    transform: translateX(2px);
}

.background-card {
    background: linear-gradient(135deg, #FFF9F7 0%, #FFF4F0 100%);
    border: 1px solid #FFE8E0;
    border-radius: var(--radius);
    padding: var(--space-md);
}

.disclaimer {
    background: linear-gradient(135deg, #FFF9F0 0%, #FFF3E0 100%);
    border: 1px solid #FFE0B2;
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    padding: var(--space-md);
    font-size: 13px;
    color: #8B6914;
    line-height: 1.6;
    margin-bottom: var(--space-lg);
}

.error-card {
    background: linear-gradient(135deg, #FFF0F0 0%, #FFE0E0 100%);
    border: 1px solid #FFCDD2;
    border-left: 4px solid var(--error);
    border-radius: var(--radius);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.error-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.error-text {
    font-size: 15px;
    color: #C62828;
    font-weight: 600;
}

.btn-retry {
    width: 100%;
    min-height: 52px;
    padding: var(--space-md);
    font-size: 16px;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    -webkit-tap-highlight-color: transparent;
    margin-top: var(--space-md);
    box-sizing: border-box;
}

.btn-retry:active {
    background: var(--bg);
    border-color: var(--text-light);
}

.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: var(--space-md);
    text-align: center;
    margin-top: auto;
}

.footer p {
    font-size: 12px;
    color: var(--text-lighter);
    margin: 0;
}

.footer a {
    color: var(--text-lighter);
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.footer-separator {
    margin: 0 var(--space-xs);
    color: var(--border);
}

@media (min-width: 641px) {
    .container {
        padding: 0 var(--space-xl);
        padding-top: calc(var(--space-xl) + 56px);
        padding-bottom: var(--space-xl);
    }

    .input-section {
        padding: var(--space-xl);
    }

    .loading {
        padding: var(--space-xl);
    }

    .results-section {
        padding: var(--space-xl);
    }

    .background-card {
        padding: var(--space-lg);
    }

    .intro-title {
        font-size: 24px;
    }

    .result-title {
        font-size: 22px;
    }

    textarea {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *:not(.loading-spinner) {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.feedback-section {
    margin: var(--space-xl) 0;
    padding: var(--space-xl);
    background: linear-gradient(135deg, #FAFBFC 0%, #F5F6F7 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}

.feedback-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-lg);
    letter-spacing: -0.02em;
}

.feedback-buttons {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.btn-feedback {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 140px;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-feedback:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--text-light);
}

.btn-feedback:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-feedback.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, #FFF9F7 0%, #FFF4F0 100%);
    box-shadow: 0 2px 8px rgba(250, 98, 24, 0.15);
}

.btn-feedback.selected:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(250, 98, 24, 0.15);
}

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

.btn-feedback:disabled:hover {
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.feedback-icon {
    font-size: 20px;
    line-height: 1;
}

.feedback-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
}

.feedback-message {
    font-size: 14px;
    color: var(--primary);
    font-weight: 600;
    min-height: 24px;
    margin-top: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

@media (max-width: 640px) {
    .feedback-buttons {
        gap: var(--space-xs);
    }

    .btn-feedback {
        min-width: 120px;
        padding: var(--space-sm) var(--space-md);
        font-size: 14px;
    }

    .feedback-icon {
        font-size: 18px;
    }

    .feedback-text {
        font-size: 14px;
    }
}
