:root {
    --bg-main: #09090b;
    --panel-bg: rgba(18, 18, 24, 0.75);
    --input-bg: #14141b;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-active: rgba(255, 255, 255, 0.2);
    --text-primary: #f4f4f5;
    --text-muted: #71717a;
    --accent-blue: #3b82f6;
    --accent-red: #ef4444;
    --accent-green: #22c55e;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    padding: 0 40px 40px 40px;
    min-height: 100vh;
}

/* هدر بالای صفحه */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 40px;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.8px;
}

.logo .dot {
    color: var(--accent-blue);
}

.lang-switch {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.lang-link {
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 6px 10px;
}

.lang-link.active, .lang-link:hover {
    color: var(--text-primary);
}

.divider {
    color: rgba(255, 255, 255, 0.1);
}

/* ساختار دو ستونه اصلی دسکتاپ */
.app-container {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 48px;
    max-width: 1240px;
    margin: 0 auto;
}

.meta-header {
    margin-bottom: 24px;
}

.topic-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-blue);
    margin-bottom: 8px;
}

.chapter-heading {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.narrative-wrapper {
    margin-bottom: 32px;
}

.story-passage {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #e4e4e7;
    text-align: justify;
}

/* کارت‌های شیشه‌ای گلس‌مورفیسم */
.puzzle-box {
    background: var(--panel-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 28px;
    backdrop-filter: blur(12px);
}

.box-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.puzzle-question {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* فیلد ورودی مدرن یکپارچه */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 4px 8px 4px 18px;
    transition: border-color 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: var(--border-active);
}

.input-wrapper input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    height: 54px;
    padding-right: 110px;
}

.input-actions {
    position: absolute;
    right: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-actions button {
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-action-submit {
    background: var(--text-primary);
    color: var(--bg-main);
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    font-weight: bold;
}

.btn-action-hint {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: white;
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
}

.input-actions button:hover {
    transform: scale(1.02);
}

.btn-action-submit:hover { background: #ffffff; }
.btn-action-hint:hover { background: rgba(255, 255, 255, 0.08); }

/* سایدبار وضعیت کارآگاه */
.dashboard-zone {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.status-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 24px;
    backdrop-filter: blur(12px);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.agent-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.meta-sub { color: var(--text-muted); font-size: 0.75rem; display: block; }
.meta-title { font-size: 1.2rem; font-weight: 700; }

.credibility-container {
    width: 100%;
}

.credibility-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.progress-track {
    background: rgba(255, 255, 255, 0.04);
    height: 6px;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    background: var(--accent-red);
    height: 100%;
    width: 100%;
    border-radius: 10px;
    transition: width 0.4s ease;
}

.inventory-list { list-style: none; }
.inventory-list li {
    font-size: 0.9rem;
    padding: 10px 0;
    color: #d4d4d8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}
.inventory-list li:last-child { border: none; }
.empty-text { color: var(--text-muted) !important; font-style: italic; font-size: 0.85rem !important; }

.badge-layout { display: flex; gap: 10px; }
.badge-item {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    font-size: 0.95rem;
}
.badge-item.unlocked {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-green);
    border-color: rgba(34, 197, 94, 0.2);
}

.status-feedback {
    font-size: 0.9rem;
    margin-top: 14px;
    font-weight: 500;
}
.success-msg { color: var(--accent-green); }
.error-msg { color: var(--accent-red); }

/* کدهای رسپانسیو هوشمند موبایل و تبلت */
@media (max-width: 1024px) {
    body { padding: 0 24px 24px 24px; }
    .app-container {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .dashboard-zone {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 600px) {
    body { padding: 0 16px 16px 16px; }
    .top-nav { margin-bottom: 24px; height: 70px; }
    .chapter-heading { font-size: 1.8rem; }
    .story-passage { font-size: 1.05rem; }
    .dashboard-zone { grid-template-columns: 1fr; }
}
