:root {
    --primary: 212 100% 66%;
    --primary-foreground: 210 20% 98%;
    --background: 214 100% 97%;
    --foreground: 222 20% 20%;
    --border: 214 32% 91%;
    --destructive: 0 84% 60%;
    --destructive-foreground: 0 0% 98%;
    --muted: 210 40% 96%;
    --muted-foreground: 215 16% 47%;
    --message-display-bg: 210 40% 98%;
    --message-display-border: 215 22% 45%;
    --body-section-bg: 210 20% 95%;
    --body-button: 221 83% 90%;
    --body-button-hover: 221 83% 85%;
    --radius: 0.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    min-height: 100vh;
    overflow-x: hidden;
}

/* Message Display */
.message-display {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background-color: hsl(var(--background));
    padding: 1rem;
    box-shadow: 0 4px 6px 2px rgb(0 0 0 / 29%)
}

#messageTextarea {
    width: 100%;
    min-height: 100px;
    font-size: 1.125rem;
    background-color: hsl(var(--message-display-bg));
    border: 2px solid hsl(var(--message-display-border));
    border-radius: var(--radius);
    padding: 0.75rem;
    resize: none;
    font-family: inherit;
    color: hsl(var(--foreground));
}

#messageTextarea:focus {
    outline: 2px solid hsl(var(--primary));
    outline-offset: 2px;
}

/* Main Content */
.main-content {
    padding-top: 160px;
    padding-bottom: 100px;
    overflow-y: auto;
}

.section {
    padding: 1rem;
}

.section h2 {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: hsl(var(--foreground));
}

/* Quick Phrases Grid */
.phrase-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.phrase-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background-color: hsl(var(--primary) / 0.1);
    border: 2px solid hsl(var(--primary));
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.phrase-btn:hover:not(:disabled) {
    background-color: hsl(var(--primary) / 0.2);
    transform: scale(1.02);
}

.phrase-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.phrase-btn .icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* Body Parts Section */
.body-section {
    background-color: hsl(var(--body-section-bg));
    border-radius: var(--radius);
    margin: 0 1rem;
}

.body-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.body-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background-color: hsl(var(--body-button));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
    color: hsl(var(--foreground));
}

.body-btn:hover:not(:disabled) {
    background-color: hsl(var(--body-button-hover));
    transform: scale(1.02);
}

.body-btn .emoji {
    font-size: 1.5rem;
}

/* Emotion Section */
.emotion-section {
    background-color: hsl(var(--body-section-bg));
    border-radius: var(--radius);
    margin: 0 1rem;
}

.emotion-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.emotion-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background-color: hsl(var(--body-button));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
    color: hsl(var(--foreground));
}

.emotion-btn:hover:not(:disabled) {
    background-color: hsl(var(--body-button-hover));
    transform: scale(1.02);
}

.emotion-btn .emoji {
    font-size: 1.5rem;
}

/* Toolbar */
.toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background-color: hsl(var(--background));
    border-top: 2px solid hsl(var(--border));
    padding: 0.75rem;
}

.toolbar > div {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-width: 32rem;
    margin: 0 auto;
}

.toolbar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem;
    background-color: hsl(var(--primary) / 0.1);
    border: 2px solid hsl(var(--primary));
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    color: hsl(var(--foreground));
    font-size: 0.75rem;
    font-weight: 500;
}

.toolbar-btn:hover:not(:disabled) {
    background-color: hsl(var(--primary) / 0.2);
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar-btn.clear-btn {
    background-color: hsl(var(--destructive) / 0.1);
    border-color: hsl(var(--destructive));
    color: hsl(var(--destructive));
}

.toolbar-btn.clear-btn:hover:not(:disabled) {
    background-color: hsl(var(--destructive) / 0.2);
}

.toolbar-btn .icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1rem;
    background-color: hsl(var(--foreground));
    color: hsl(var(--background));
    border-radius: var(--radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease-out;
    min-width: 200px;
}

.toast.success {
    background-color: hsl(142 76% 36%);
}

.toast.info {
    background-color: hsl(var(--primary));
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.fade-out {
    animation: slideOut 0.3s ease-out forwards;
}

/* Responsive Design */
@media (min-width: 768px) {
    #messageTextarea {
        min-height: 120px;
        font-size: 1.25rem;
    }

    .section h2 {
        font-size: 1.5rem;
    }

    .phrase-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .phrase-btn {
        font-size: 1rem;
    }

    .body-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }

    .body-btn {
        font-size: 0.875rem;
    }
}

@media (min-width: 1024px) {
    .phrase-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .body-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}