* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;
    background: #f2efe6;
    color: #222222;
    font-family: Georgia, "Times New Roman", serif;
}

button,
input,
textarea {
    font: inherit;
}

.start-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.start-card {
    width: min(92vw, 840px);
    text-align: center;
}

.brand-title {
    margin: 0 0 14px;
    font-size: clamp(3.2rem, 10vw, 6.4rem);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-shadow: 0 2px 0 #ffffff;
}

.brand-title.small {
    font-size: clamp(2.4rem, 7vw, 4.2rem);
}

.tagline {
    margin: 0 0 56px;
    font-size: clamp(1.15rem, 3vw, 1.55rem);
}

.transform-panel {
    width: min(90vw, 470px);
    min-height: 96px;
    margin: 0 auto;
    border-radius: 14px;
    transition:
        width 420ms ease,
        min-height 420ms ease,
        padding 420ms ease,
        border-radius 420ms ease,
        background 420ms ease,
        box-shadow 420ms ease,
        transform 420ms ease;
}

.transform-panel.button-state {
    padding: 0;
}

.transform-panel.question-state {
    width: min(94vw, 900px);
    min-height: 270px;
    padding: 34px 28px 30px;
    border: 2px solid #1c6da9;
    border-top-color: #8bc7f0;
    border-left-color: #6cb8eb;
    border-right-color: #155787;
    border-bottom-color: #0d3f65;
    border-radius: 22px;
    background:
        linear-gradient(
            to bottom,
            #75bff0 0%,
            #4aa4df 40%,
            #2c86c3 65%,
            #1f6c9f 100%
        );
    box-shadow:
        0 10px 0 #0c466f,
        0 18px 28px rgba(0, 0, 0, 0.28),
        inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

.primary-3d-button {
    width: 100%;
    min-height: 96px;
    padding: 20px 38px;
    border: 2px solid #083f75;
    border-top-color: #74b7ef;
    border-left-color: #5ca8e7;
    border-right-color: #083f75;
    border-bottom-color: #052f58;
    border-radius: 14px;
    background:
        linear-gradient(
            to bottom,
            #5db4f0 0%,
            #2f8ed3 48%,
            #176da9 52%,
            #0d5488 100%
        );
    color: #ffffff;
    font-size: 1.45rem;
    white-space: nowrap;
    font-weight: 700;
    text-shadow: 0 2px 1px rgba(0, 0, 0, 0.35);
    box-shadow:
        0 8px 0 #07385f,
        0 13px 18px rgba(0, 0, 0, 0.28),
        inset 0 2px 0 rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition:
        opacity 220ms ease,
        transform 220ms ease,
        box-shadow 120ms ease,
        filter 120ms ease;
}

.primary-3d-button:hover,
.primary-3d-button:focus-visible {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow:
        0 10px 0 #07385f,
        0 16px 22px rgba(0, 0, 0, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.5);
}

.primary-3d-button:active {
    transform: translateY(7px);
    box-shadow:
        0 1px 0 #07385f,
        0 4px 8px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.primary-3d-button.leaving {
    opacity: 0;
    transform: scale(0.72);
    pointer-events: none;
}

.question-content {
    color: #ffffff;
    opacity: 0;
    transform: scale(0.92);
    transition:
        opacity 320ms ease,
        transform 320ms ease;
}

.question-content.visible {
    opacity: 1;
    transform: scale(1);
}

.question-content label {
    display: block;
    margin-bottom: 26px;
    font-size: 1.7rem;
    white-space: nowrap;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 2px 1px rgba(0, 0, 0, 0.28);
}

#subjectInput {
    width: min(100%, 660px);
    padding: 14px 10px;
    border: 0;
    border-bottom: 3px solid #ffffff;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-size: 1.45rem;
    text-align: center;
}

#subjectInput::selection {
    background: rgba(255, 255, 255, 0.35);
}

#subjectInput:focus {
    outline: 3px solid #ffffff;
    outline-offset: 5px;
}

.start-hint {
    margin: 22px 0 0;
    color: #555555;
    font-size: 1.05rem;
    font-style: italic;
    transition: opacity 220ms ease;
}

.start-hint.hidden-hint {
    opacity: 0;
}

.hidden {
    display: none !important;
}

.status {
    min-height: 1.5em;
    margin: 16px 0;
}

.error {
    color: #8b0000;
}

.enter-hint {
    margin: 12px 0 0;
    font-size: 0.98rem;
}

.question-content .enter-hint {
    color: rgba(255, 255, 255, 0.92);
}

.conversation-page {
    width: min(94vw, 950px);
    margin: 0 auto;
    padding: 24px 0 40px;
}

.conversation-header {
    text-align: center;
    margin-bottom: 24px;
}

.conversation-header p {
    margin: 0;
    font-size: 1.15rem;
}

.conversation-card {
    padding: 24px;
    border: 1px solid #b7b1a2;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.6);
}

.conversation {
    min-height: 200px;
    margin-bottom: 22px;
}

.message {
    margin: 0 0 24px;
    padding: 18px 20px;
    border-radius: 8px;
    white-space: pre-wrap;
    line-height: 1.6;
}

.user-message {
    background: #e0dacb;
}

.assistant-message {
    background: #ffffff;
    border: 1px solid #c9c3b6;
}

.message-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 1.06rem;
}

.reassurance {
    display: block;
    margin-bottom: 14px;
    font-style: italic;
    font-weight: 700;
}

.thinking-panel {
    min-height: 52vh;
    margin: 24px 0;
    padding: 50px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-top: 3px solid #2f8ed3;
    border-bottom: 3px solid #2f8ed3;
    text-align: center;
    background: rgba(47, 142, 211, 0.08);
}

.thinking-message {
    font-size: clamp(2.2rem, 6vw, 4rem);
    font-weight: 700;
    line-height: 1.2;
}

.thinking-submessage {
    margin-top: 20px;
    font-size: clamp(1.15rem, 3vw, 1.7rem);
}

.next-label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.3rem;
    font-weight: 700;
}

#nextQuestion {
    width: 100%;
    min-height: 82px;
    padding: 14px;
    border: 1px solid #777777;
    border-radius: 6px;
    resize: vertical;
}

#nextQuestion:focus {
    outline: 3px solid #2f8ed3;
    outline-offset: 4px;
}

.small-button {
    padding: 10px 18px;
    border: 2px solid #222222;
    border-radius: 7px;
    background: #ffffff;
    color: #222222;
    font-size: 1rem;
    cursor: pointer;
}

.small-button:hover,
.small-button:focus-visible {
    background: #222222;
    color: #ffffff;
}

@media (max-width: 700px) {
    .primary-3d-button {
        font-size: 1.25rem;
        padding-left: 24px;
        padding-right: 24px;
    }

    .question-content label {
        font-size: 1.35rem;
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
