:root {
    --primary: #FF7B00;
    --primary-light: #FFF0E5;
    --bg-color: #FDFBF8;
    --text-main: #333;
    --border-color: #E2DCD5;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-blur: blur(15px);
}

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

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #FFE8D6 0%, #F5F7FA 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
}

.glass-container {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border-radius: 1.5rem;
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.progress-container {
    margin-top: 1rem;
    background: #EAEAEA;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.4s ease;
}

main {
    flex: 1;
    position: relative;
}

.phase-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.phase-section.active {
    display: block;
}

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

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
}

h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #444;
}

.description {
    color: #666;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.instruction {
    color: #444;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    background: var(--primary-light);
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary);
}

.step-badge {
    display: inline-block;
    background: #444;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.step-badge.success {
    background: #10B981;
}

.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

input[type="text"], textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.8rem;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    background: #FFF;
    resize: vertical;
}

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

.source-box {
    background: #FFF;
    border: 1px solid #EEE;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
}

.text-blur {
    filter: blur(5px);
    cursor: pointer;
    transition: filter 0.3s;
    user-select: none;
}

.text-blur:hover, .text-blur.revealed {
    filter: blur(0);
}

button {
    display: block;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 0.8rem;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 2rem;
}

button.btn-primary, button#btn-start, button.btn-next {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(255, 123, 0, 0.3);
}

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

button.btn-secondary {
    background: #EAEAEA;
    color: #444;
}
button.btn-secondary:hover {
    background: #DDD;
}

.final-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}
.final-actions button {
    margin-top: 0;
}

#review-answers {
    list-style: none;
    padding-left: 0;
}
#review-answers li {
    background: #F9F9F9;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
}
#review-answers li strong {
    color: var(--primary);
    display: block;
    margin-bottom: 0.2rem;
}

/* ------------------- NEW AI & VOICE STYLES ------------------- */

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header-actions {
    display: flex;
    gap: 0.5rem;
}
.icon-btn {
    background: none;
    border: 1px solid #ddd;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.5;
    filter: grayscale(1);
}
.icon-btn.active, .icon-btn:hover {
    background: #FFF;
    border-color: var(--primary);
    opacity: 1;
    filter: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal-overlay.show {
    display: flex;
}
.modal-content {
    background: #FFF;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.modal-content h2 { margin-bottom: 1rem; text-align: left; }

.start-actions {
    display: flex;
    flex-direction: column; /* スマホでは縦並びにして確実に押せるようにする */
    gap: 0.8rem;
    margin-top: 1.5rem;
}
.start-actions button {
    margin-top: 0;
    width: 100%;
    touch-action: manipulation; /* 連打やズームによる誤動作を防止 */
}
@media (min-width: 480px) {
    .start-actions { flex-direction: row; }
}

.textarea-wrapper {
    position: relative;
}
.btn-mic {
    position: absolute;
    bottom: 0.8rem;
    right: 0.8rem;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s;
}
.btn-mic:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}
.btn-mic.recording {
    background: #ef4444;
    color: white;
    animation: pulseMic 1.5s infinite;
}
@keyframes pulseMic {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.score-container {
    background: #FFF;
    border: 2px solid var(--primary-light);
    border-radius: 0.8rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.score-header {
    border-bottom: 1px solid #EEE;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}
.score-badge {
    background: var(--primary);
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
}
.score-body {
    font-size: 1rem;
    line-height: 1.6;
    color: #444;
}
