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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f4f5f7;
    color: #222;
    line-height: 1.5;
}

.page-wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    min-height: 100vh;
    background: #fff;
}

@media (min-width: 768px) {
    .page-wrap { padding: 40px 32px 60px; margin-top: 24px; margin-bottom: 24px; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
}

h1 { font-size: 1.4em; margin-bottom: 16px; }
h2 { font-size: 1.15em; margin: 20px 0 10px; }
p { margin-bottom: 12px; }

.btn {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    margin-top: 16px;
}
.btn:hover { background: #1d4ed8; }
.btn:disabled { background: #aab; cursor: not-allowed; }
.btn-secondary { background: #e5e7eb; color: #222; }

.radio-option, .choice-row {
    display: block;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}
.radio-option:hover { background: #f0f4ff; }

fieldset { border: none; margin-bottom: 20px; }
legend { font-weight: 600; margin-bottom: 8px; }

input[type=text], textarea, input[type=number] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
}
textarea { min-height: 70px; resize: vertical; }

/* Likert grid */
.likert-item { margin-bottom: 18px; }
.likert-item .stmt { margin-bottom: 6px; font-size: 0.95em; }
.likert-scale { display: flex; justify-content: space-between; gap: 4px; }
.likert-scale label { flex: 1; text-align: center; font-size: 0.72em; cursor: pointer; }
.likert-scale input { display: block; margin: 0 auto 4px; }

/* ---- CHAT INTERFACE ---- */
.chat-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    position: relative;
}
.chat-header {
    background: #1e3a5f;
    color: #fff;
    padding: 14px 16px;
    font-weight: 600;
    flex-shrink: 0;
}
.reminder-panel {
    position: absolute;
    top: 62px;
    right: 12px;
    width: 168px;
    max-width: 40%;
    background: #fff8e1;
    border: 1px solid #e0c56b;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.72em;
    line-height: 1.45;
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
    z-index: 5;
}
.reminder-panel b { display: block; margin-bottom: 4px; font-size: 1.05em; }
.reminder-panel ul { list-style: none; }
.reminder-panel li { margin-bottom: 4px; }
.reminder-panel li:last-child { margin-bottom: 0; }

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #eef1f5;
}
.bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    margin-bottom: 10px;
    font-size: 0.95em;
    animation: fadeIn 0.4s ease-in;
}
.bot-bubble { background: #e4e6eb; align-self: flex-start; border-bottom-left-radius: 4px; }
.human-bubble { background: #dbeafe; align-self: flex-start; border-bottom-left-radius: 4px; }
.user-bubble { background: #2563eb; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; margin-left: auto; }
.bubble-row { display: flex; flex-direction: column; }
.typing-indicator { display: flex; gap: 4px; padding: 10px 14px; background: #e4e6eb; border-radius: 14px; width: fit-content; margin-bottom: 10px; }
.typing-indicator span { width: 6px; height: 6px; background: #888; border-radius: 50%; animation: blink 1.2s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.chat-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #ddd;
    background: #fff;
    flex-shrink: 0;
}
.chat-input-bar input { flex: 1; padding: 10px 14px; border-radius: 20px; border: 1px solid #ccc; }
.chat-input-bar button { background: #2563eb; color: #fff; border: none; border-radius: 20px; padding: 0 18px; cursor: pointer; }
.chat-input-bar button:disabled { background: #aab; }

@media (min-width: 768px) {
    .chat-shell { height: 90vh; margin-top: 24px; margin-bottom: 24px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.12); }
}
