:root {
    --paper: #f7f2e9;
    --ink: #4a3a2f;
    --ink-soft: #6e5647;
    --accent: #d68910;
    --shadow: rgba(49, 31, 17, 0.16);
    --font-main: "Outfit", "Segoe UI", sans-serif;
    --font-hand: "Comic Sans MS", "Bradley Hand", cursive;
}

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

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

body {
    font-family: var(--font-main);
    background:
        radial-gradient(140% 90% at 50% 0%, #e9dcc4 0%, #ddc7a4 38%, #b08256 100%);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.book-page {
    width: min(920px, 96vw);
    min-height: min(1280px, 92vh);
    background: linear-gradient(180deg, #fbf8f2 0%, var(--paper) 100%);
    border-radius: 2.8rem;
    border: 3px solid var(--ink-soft);
    box-shadow: 0 20px 45px var(--shadow);
    padding: clamp(1.1rem, 2.5vw, 2rem);
}

.question-panel {
    width: 100%;
    height: 100%;
    min-height: calc(min(1280px, 92vh) - 4rem);
    border-radius: 2.5rem;
    border: 3px solid var(--ink-soft);
    position: relative;
    padding: 1.1rem;
    overflow: hidden;
}

.question-panel::before {
    content: "";
    position: absolute;
    inset: 0.4rem;
    border-radius: 2.3rem;
    border: 1px solid rgba(110, 86, 71, 0.35);
    pointer-events: none;
}

.question-form {
    width: min(350px, calc(100% - 2rem));
    min-height: 70px;
    border-radius: 2rem;
    border: 3px solid var(--ink-soft);
    display: flex;
    align-items: center;
    padding: 0.45rem 0.9rem;
    gap: 0.65rem;
    background: #fbf6eb;
    position: relative;
    z-index: 2;
}

.question-form::before {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 2.1rem;
    border: 1px solid rgba(74, 58, 47, 0.35);
    pointer-events: none;
}

.q-tag {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 3px solid var(--ink-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: var(--font-hand);
    font-size: 1.95rem;
    line-height: 1;
    color: var(--ink);
    transform: rotate(-8deg);
    background: #f3ead8;
    user-select: none;
}

#question-input {
    border: none;
    background: transparent;
    width: 100%;
    min-width: 0;
    font-size: clamp(1.15rem, 2.1vw, 1.4rem);
    font-family: var(--font-hand);
    color: var(--ink);
    letter-spacing: 0.02em;
}

#question-input:focus {
    outline: none;
}

#question-input::placeholder {
    color: rgba(74, 58, 47, 0.42);
}

.history-dropdown {
    position: absolute;
    top: 5.6rem;
    left: 1.2rem;
    width: min(350px, calc(100% - 2rem));
}

.submit-status {
    margin-top: 0.7rem;
    margin-left: 0.4rem;
    min-height: 1.2rem;
    font-size: 0.92rem;
    font-family: var(--font-main);
    color: #8f2f14;
}

@media (max-width: 768px) {
    body {
        padding: 1rem 0.6rem;
    }

    .book-page {
        width: 100%;
        min-height: 95vh;
        border-radius: 2.2rem;
        padding: 0.9rem;
    }

    .question-panel {
        min-height: calc(95vh - 2rem);
    }

    .question-form {
        min-height: 64px;
    }
}
