:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --bg-color: #f0f9ff;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
    --accent-color: #27ae60;
    --nav-bg: #e1f5fe;
    
    --learning-bg-start: #e0f2fe;
    --learning-bg-end: #dcfce7;
    --en-text-color: #1e40af;
    --ko-text-color: #15803d;
    --pr-text-color: #64748b;
    --tip-bg: rgba(255, 255, 255, 0.6);
    --tip-text: #475569;
    --input-bg: #f8fafc;
    --input-border: #e2e8f0;
    --tooltip-bg: #333;
    --tooltip-text: #fff;
}

[data-theme="dark"] {
    --primary-color: #60a5fa;
    --secondary-color: #4ade80;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --accent-color: #4ade80;
    --nav-bg: #1e293b;
    
    --learning-bg-start: #334155;
    --learning-bg-end: #1e293b;
    --en-text-color: #93c5fd;
    --ko-text-color: #86efac;
    --pr-text-color: #cbd5e1;
    --tip-bg: rgba(0, 0, 0, 0.3);
    --tip-text: #e2e8f0;
    --input-bg: #334155;
    --input-border: #475569;
    --tooltip-bg: #f1f5f9;
    --tooltip-text: #0f172a;
}

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

body {
    font-family: 'Noto Sans KR', 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(var(--nav-bg) 1px, transparent 1px),
        radial-gradient(var(--nav-bg) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    color: var(--text-color);
    line-height: 1.5;
    display: flex;
    justify-content: center;
    padding: 1rem 1rem;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
}

/* Decorative Blobs for Companionship feel */
body::before, body::after {
    content: '';
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.2;
    pointer-events: none;
}

body::before { background: var(--primary-color); top: -100px; left: -100px; }
body::after { background: var(--secondary-color); bottom: -100px; right: -100px; }

/* Mascot Characters */
.mascot {
    position: fixed;
    bottom: 10%;
    width: 120px;
    height: 120px;
    z-index: 0;
    pointer-events: none;
    animation: float 4s ease-in-out infinite;
}

.mascot-left { left: 5%; }
.mascot-right { right: 5%; animation-delay: -2s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@media (max-width: 1000px) {
    .mascot { display: none; }
}

.app-container {
    width: 100%;
    max-width: 650px;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
    padding-top: 2rem;
}

/* Dark Mode Toggle Button */
#theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

#theme-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--primary-color);
}

header h1 {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 0.2rem;
}

header p {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
}

/* Companion Badge */
.companion-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--card-bg);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 1rem;
    border: 1px solid rgba(52, 152, 219, 0.1);
}

.card {
    background-color: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: background-color 0.3s;
}

h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
    text-align: center;
}

.section-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: -0.5rem;
    margin-bottom: 1.2rem;
    text-align: center;
}

.learning-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.learning-controls button {
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.learning-controls button:hover {
    background: var(--primary-color);
    color: #fff;
}

#sentence-counter {
    font-weight: bold;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.learning-display {
    background: linear-gradient(135deg, var(--learning-bg-start), var(--learning-bg-end));
    padding: 2rem 1rem;
    border-radius: 1rem;
    text-align: center;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.02);
    border: 1px solid rgba(255,255,255,0.3);
}

.en-text {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
}

#speak-btn:hover {
    background: rgba(52, 152, 219, 0.1) !important;
    transform: scale(1.05);
}

.pr-text {
    font-size: 1.1rem;
    color: var(--pr-text-color);
    margin-bottom: 0.5rem;
}

.ko-text {
    font-size: 1.25rem;
    color: var(--ko-text-color);
    margin-bottom: 1.2rem;
    font-weight: 500;
}

.tip-box {
    background: var(--tip-bg);
    padding: 0.8rem;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    color: var(--tip-text);
}

.tip-label {
    font-weight: bold;
    color: var(--primary-color);
    margin-right: 0.4rem;
}

/* Word Colors - Simplified to Blue & Green */
.word-color-0 { color: #3b82f6 !important; }
.word-color-1 { color: #10b981 !important; }

/* Interactive Word Hover */
.word-hover {
    cursor: help;
    border-bottom: 2px dashed rgba(52, 152, 219, 0.2);
    border-radius: 3px;
    padding: 0 1px;
    transition: all 0.2s;
    display: inline-block;
}

.word-hover:hover {
    background-color: rgba(52, 152, 219, 0.08);
    border-bottom-color: var(--primary-color);
}

/* Tooltip */
#definition-tooltip {
    position: fixed;
    background-color: var(--tooltip-bg);
    color: var(--tooltip-text);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 10000;
    max-width: 260px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    transform: translateY(5px);
    line-height: 1.4;
}

#definition-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

#definition-tooltip strong {
    display: block;
    margin-bottom: 3px;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 2px;
}

#definition-tooltip .pos {
    font-style: italic;
    font-size: 0.8em;
    opacity: 0.8;
    margin-right: 5px;
}

/* Nav & Spacing */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1rem;
}

.nav-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.04);
    flex: 1;
    text-align: center;
    border: 1px solid rgba(0,0,0,0.03);
    transition: all 0.2s;
}

.nav-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.3rem;
    font-size: 1.1rem;
}

.nav-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Bible & Inputs */
.bible-controls {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.bible-controls select {
    flex: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    padding: 0.6rem;
    color: var(--text-color);
    font-size: 0.9rem;
    outline: none;
}

.bible-text-area {
    margin-top: 1rem;
    padding: 1.2rem;
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid var(--input-border);
}

/* Feedback Form Styles */
.feedback-container .input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-align: left;
    margin-bottom: 1rem;
}

.feedback-container label {
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--text-color);
}

.feedback-container input, textarea {
    width: 100%;
    padding: 0.7rem;
    border-radius: 0.5rem;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus, textarea:focus {
    border-color: var(--primary-color);
}

button[type="submit"] {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.8rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}

footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding-bottom: 2rem;
}

.hidden { display: none; }

@media (max-width: 480px) {
    header h1 { font-size: 1.8rem; }
    .en-text { font-size: 1.5rem; }
    .card { padding: 1.2rem; }
}