@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root,
[data-theme="dark"] {
    --bg-base: #030712;
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --accent: #38bdf8;
    --accent-strong: #0ea5e9;
    --accent-deep: #1e3a8a;
    --glass-bg: rgba(16, 24, 40, 0.58);
    --glass-border: rgba(255, 255, 255, 0.14);
    --glass-highlight: rgba(255, 255, 255, 0.22);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    --glass-blur: 36px;
    --glass-saturate: 180%;
    --input-bg: rgba(18, 26, 44, 0.86);
    --input-border: rgba(255, 255, 255, 0.2);
    --user-bubble-bg: rgba(2, 132, 199, 0.42);
    --user-bubble-border: rgba(125, 211, 252, 0.28);
    --user-bubble-text: #e0f2fe;
    --ai-bubble-bg: rgba(18, 26, 44, 0.72);
    --ai-bubble-border: rgba(255, 255, 255, 0.12);
    --header-border: rgba(255, 255, 255, 0.05);
    --code-bg: rgba(0, 0, 0, 0.55);
    --chip-bg: rgba(56, 189, 248, 0.08);
    --chip-border: rgba(56, 189, 248, 0.22);
    --chip-hover: rgba(56, 189, 248, 0.18);
    --send-bg: #e2e8f0;
    --send-color: #0f172a;
    --blob-1: #0ea5e9;
    --blob-2: #1e3a8a;
    --blob-3-shadow: #0284c7;
    --scrollbar: rgba(56, 189, 248, 0.3);
    --credit-panel-bg: rgba(15, 23, 42, 0.95);
    --keyboard-offset: 0px;
    --input-area-height: 160px;
}

[data-theme="light"] {
    --bg-base: #eef2f7;
    --text-primary: #1e293b;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --accent: #0284c7;
    --accent-strong: #0369a1;
    --accent-deep: #bae6fd;
    --glass-bg: rgba(255, 255, 255, 0.62);
    --glass-border: rgba(255, 255, 255, 0.55);
    --glass-highlight: rgba(255, 255, 255, 0.7);
    --glass-shadow: 0 10px 36px rgba(15, 23, 42, 0.1);
    --glass-blur: 36px;
    --glass-saturate: 180%;
    --input-bg: rgba(255, 255, 255, 0.78);
    --input-border: rgba(255, 255, 255, 0.65);
    --user-bubble-bg: rgba(2, 132, 199, 0.16);
    --user-bubble-border: rgba(2, 132, 199, 0.28);
    --user-bubble-text: #0c4a6e;
    --ai-bubble-bg: rgba(255, 255, 255, 0.7);
    --ai-bubble-border: rgba(255, 255, 255, 0.55);
    --header-border: rgba(148, 163, 184, 0.25);
    --code-bg: #f1f5f9;
    --chip-bg: rgba(2, 132, 199, 0.08);
    --chip-border: rgba(2, 132, 199, 0.22);
    --chip-hover: rgba(2, 132, 199, 0.14);
    --send-bg: #0284c7;
    --send-color: #ffffff;
    --blob-1: #7dd3fc;
    --blob-2: #bae6fd;
    --blob-3-shadow: #38bdf8;
    --scrollbar: rgba(2, 132, 199, 0.35);
    --credit-panel-bg: rgba(255, 255, 255, 0.98);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

button,
a,
[role="button"],
[role="menuitem"] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

html {
    height: 100%;
    height: -webkit-fill-available;
}

body {
    background-color: var(--bg-base);
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    color: var(--text-primary);
    transition: background-color 0.35s ease, color 0.35s ease;
}

/* Sanatsal Mavi/Siyah Sıvı Arka Plan */
.blob {
    position: absolute;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.6;
    animation: move 12s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.blob-1 {
    width: 50vw;
    height: 50vw;
    background: var(--blob-1);
    top: -20%;
    left: -10%;
}

.blob-2 {
    width: 60vw;
    height: 60vw;
    background: var(--blob-2);
    bottom: -30%;
    right: -20%;
    animation-duration: 15s;
    animation-delay: 2s;
}

.blob-3 {
    width: 40vw;
    height: 40vw;
    background: var(--bg-base);
    top: 30%;
    left: 30%;
    box-shadow: 0 0 150px 50px var(--blob-3-shadow);
    animation-duration: 18s;
    animation-direction: alternate-reverse;
}

[data-theme="light"] .blob {
    opacity: 0.45;
}

@keyframes move {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 60px) scale(1.1); }
}

/* Ortak Cam Efekti — iOS liquid glass */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--glass-border);
    box-shadow:
        var(--glass-shadow),
        inset 0 1px 0 var(--glass-highlight),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04);
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

/* Ana Taşıyıcı */
.app-container {
    display: flex;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    gap: 20px;
    z-index: 10;
}

/* Yan Menü (Sidebar) */
.sidebar {
    width: 280px;
    border-radius: 24px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.new-chat {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--chip-border);
    background: var(--chip-bg);
    color: var(--accent);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.new-chat:hover {
    background: rgba(56, 189, 248, 0.2);
    transform: translateY(-2px);
}

.history-section h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    margin-top: 15px;
}

.history-item {
    padding: 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.history-item.active {
    background: var(--chip-hover);
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

/* Ana Chat Wrapper */
.chat-wrapper {
    flex: 1;
    min-width: 0;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Üst Kısım */
.chat-header {
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    border-bottom: 1px solid transparent;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    flex-shrink: 0;
    min-height: 56px;
}

.nav-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.nav-btn:hover {
    background: var(--chip-hover);
}

.sidebar-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}

.sidebar-toolbar .status {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-toolbar .status::before {
    content: '';
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    width: 40px;
    height: 40px;
}

.chat-header .logo {
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.chat-header .status {
    font-size: 0.85rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-header .status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
}

/* Mesajlaşma Alanı */
.chat-box {
    flex: 1;
    min-height: 0;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.chat-box::-webkit-scrollbar {
    width: 4px;
}
.chat-box::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 10px;
}

.drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 6, 23, 0.52);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    pointer-events: none;
}

.drop-overlay[hidden] {
    display: none !important;
}

.chat-wrapper.is-dragover .drop-overlay {
    display: flex !important;
}

.chat-wrapper.is-dragover .input-composer {
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow:
        0 0 0 3px rgba(56, 189, 248, 0.16),
        0 12px 40px rgba(0, 0, 0, 0.35);
}

.drop-overlay-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 360px;
    padding: 28px 32px;
    border-radius: 22px;
    border: 1.5px dashed rgba(125, 211, 252, 0.55);
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary);
    text-align: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.drop-overlay-card i {
    font-size: 1.6rem;
    color: var(--accent);
}

.drop-overlay-card strong {
    font-size: 1.05rem;
    font-weight: 650;
}

.drop-overlay-card span {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

[data-theme="light"] .drop-overlay {
    background: rgba(248, 250, 252, 0.62);
}

[data-theme="light"] .drop-overlay-card {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(2, 132, 199, 0.45);
}

.message {
    display: flex;
    width: 100%;
    animation: slideUp 0.3s ease-out forwards;
}

.ai-message {
    flex-direction: column;
    align-items: flex-start;
}

.message-content-col {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: min(720px, 92%);
    width: fit-content;
}

.user-message .message-content-col {
    align-items: flex-end;
    margin-left: auto;
    max-width: min(640px, 85%);
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    padding-left: 4px;
}

.msg-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--chip-border);
    border-radius: 100px;
    background: var(--chip-bg);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.msg-share-btn:hover {
    background: var(--chip-hover);
    color: var(--accent);
    border-color: var(--accent);
}

.msg-share-btn.shared {
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.1);
}

.bubble {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/* Kullanıcı Mesajı */
.user-message {
    justify-content: flex-end;
}
.user-message .bubble {
    background: var(--user-bubble-bg);
    border: 1px solid var(--user-bubble-border);
    border-bottom-right-radius: 4px;
    color: var(--user-bubble-text);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

/* AI Mesajı */
.ai-message .bubble {
    background: var(--ai-bubble-bg);
    border: 1px solid var(--ai-bubble-border);
    border-bottom-left-radius: 4px;
    color: var(--text-secondary);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Yazma Alanı */
.chat-input-area {
    flex-shrink: 0;
    padding: 12px 24px 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    border-top: 1px solid transparent;
    background: transparent;
    z-index: 30;
    overflow: visible;
    transition: transform 0.2s ease;
}

.quick-prompts {
    display: none !important;
}

.quick-prompts::-webkit-scrollbar {
    display: none;
}

.quick-prompt-chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 8px 14px;
    border-radius: 100px;
    border: 1px solid var(--chip-border);
    background: var(--chip-bg);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.quick-prompt-chip:hover:not(:disabled) {
    background: var(--chip-hover);
    transform: translateY(-1px);
}

.quick-prompt-chip:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.input-composer {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 28px;
    padding: 8px 10px;
    overflow: visible;
    isolation: isolate;
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 var(--glass-highlight),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, border-radius 0.2s ease, background 0.3s ease;
}

.input-composer::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.16) 0%,
        rgba(255, 255, 255, 0.04) 32%,
        transparent 58%
    );
}

.input-composer.has-attach {
    border-radius: 22px;
}

.composer-row,
.input-composer > .doc-bar {
    position: relative;
    z-index: 1;
}

.composer-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-composer:focus-within {
    border-color: rgba(125, 211, 252, 0.45);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 0 3px rgba(56, 189, 248, 0.12),
        inset 0 1px 0 var(--glass-highlight);
}

[data-theme="light"] .input-composer {
    box-shadow:
        0 10px 32px rgba(15, 23, 42, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .input-composer:focus-within {
    border-color: rgba(2, 132, 199, 0.4);
    box-shadow:
        0 10px 32px rgba(15, 23, 42, 0.12),
        0 0 0 3px rgba(2, 132, 199, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .input-composer,
    .glass-effect {
        background: rgba(15, 23, 42, 0.94);
    }

    [data-theme="light"] .input-composer,
    [data-theme="light"] .glass-effect {
        background: rgba(255, 255, 255, 0.94);
    }
}

#user-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    padding: 10px 0;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

#voice-btn.listening {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    animation: pulse-mic 1.2s ease-in-out infinite;
}

@keyframes pulse-mic {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.composer-end {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.composer-end > button {
    position: absolute;
    inset: 0;
    margin: auto;
}

#attach-btn {
    width: 44px;
    height: 44px;
    font-size: 1.15rem;
}

#attach-btn i {
    transition: transform 0.2s ease;
}

.attach-wrap.open #attach-btn i {
    transform: rotate(45deg);
}

.attach-wrap {
    position: relative;
    flex-shrink: 0;
}

.attach-sheet {
    position: absolute;
    left: 0;
    bottom: calc(100% + 12px);
    z-index: 70;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    max-width: min(360px, calc(100vw - 48px));
    padding: 14px 16px 12px;
    border-radius: 20px;
    background: var(--credit-panel-bg);
    border: 1px solid var(--chip-border);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.attach-sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 64px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
}

.attach-sheet-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent);
    font-size: 1.05rem;
}

[data-theme="light"] .attach-sheet-icon {
    background: rgba(2, 132, 199, 0.12);
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.composer-end #voice-btn {
    width: 44px;
    height: 44px;
}

/* Kredi halkası */
.credit-widget {
    position: relative;
}

.credit-ring-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
}

.credit-ring-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.credit-ring-btn:active {
    transform: scale(0.94);
}

.credit-ring-svg {
    width: 32px;
    height: 32px;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(148, 163, 184, 0.25);
    stroke-width: 3;
}

.ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 97.4;
    stroke-dashoffset: 97.4;
    transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
}

.credit-widget.warning .ring-progress {
    stroke: #fbbf24;
}

.credit-widget.danger .ring-progress {
    stroke: #f87171;
}

/* Genişleyen kredi paneli */
.credit-panel {
    position: absolute;
    right: 0;
    left: auto;
    top: auto;
    bottom: calc(100% + 12px);
    width: 0;
    min-width: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    padding: 0;
    border-radius: 16px;
    background: var(--credit-panel-bg);
    border: 1px solid var(--chip-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    transition:
        width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.25s ease,
        padding 0.35s ease,
        visibility 0.35s;
    pointer-events: none;
    z-index: 50;
}

.credit-widget.expanded .credit-panel {
    width: min(320px, calc(100vw - 48px));
    min-width: 280px;
    opacity: 1;
    visibility: visible;
    padding: 16px 18px;
    pointer-events: auto;
}

.credit-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    white-space: nowrap;
}

.credit-panel-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.credit-panel-pct {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
}

.credit-widget.warning .credit-panel-pct {
    color: #fbbf24;
}

.credit-widget.danger .credit-panel-pct {
    color: #f87171;
}

.credit-bar-track {
    height: 6px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 14px;
}

.credit-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0284c7, #38bdf8);
    border-radius: 100px;
    transition: width 0.5s ease, background 0.3s ease;
}

.credit-widget.warning .credit-bar-fill {
    background: linear-gradient(90deg, #d97706, #fbbf24);
}

.credit-widget.danger .credit-bar-fill {
    background: linear-gradient(90deg, #dc2626, #f87171);
}

.credit-panel-stats {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.credit-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.credit-stat-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.credit-stat-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.credit-stat-value.credit-remaining {
    color: var(--accent);
}

.credit-widget.danger .credit-stat-value.credit-remaining {
    color: #f87171;
}

#send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--send-bg);
    color: var(--send-color);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

#send-btn:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: scale(1.05);
}

#send-btn:disabled {
    background: rgba(148, 163, 184, 0.35);
    color: rgba(15, 23, 42, 0.5);
}

/* Yazıyor animasyonu */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 5px;
}
.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Markdown içerik */
.bubble.markdown-body {
    max-width: 100%;
}

.bubble.markdown-body h1,
.bubble.markdown-body h2,
.bubble.markdown-body h3 {
    margin: 0.6em 0 0.35em;
    color: var(--user-bubble-text);
    font-weight: 600;
}

[data-theme="light"] .bubble.markdown-body h1,
[data-theme="light"] .bubble.markdown-body h2,
[data-theme="light"] .bubble.markdown-body h3 {
    color: var(--text-primary);
}

.bubble.markdown-body p {
    margin: 0.5em 0;
}

.bubble.markdown-body ul,
.bubble.markdown-body ol {
    margin: 0.5em 0 0.5em 1.25em;
}

.bubble.markdown-body pre {
    margin: 12px 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--code-bg);
    border: 1px solid var(--chip-border);
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Kod bloğu + kopyala */
.code-block-wrapper {
    margin: 12px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--chip-border);
    background: var(--code-bg);
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(56, 189, 248, 0.12);
}

.code-block-lang {
    font-size: 0.72rem;
    font-weight: 500;
    color: #64748b;
    text-transform: lowercase;
    letter-spacing: 0.03em;
}

.code-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.08);
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.code-copy-btn:hover {
    background: rgba(56, 189, 248, 0.18);
    color: #e2e8f0;
    border-color: rgba(56, 189, 248, 0.45);
}

.code-copy-btn.copied {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
    color: #4ade80;
}

.code-copy-btn i {
    font-size: 0.85rem;
}

.bubble.markdown-body .code-block-wrapper pre {
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.bubble.markdown-body code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.88em;
}

.bubble.markdown-body :not(pre) > code {
    background: var(--chip-bg);
    padding: 2px 6px;
    border-radius: 6px;
    color: var(--accent);
}

.bubble.markdown-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
    margin: 10px 0;
    color: var(--text-muted);
}

.bubble.markdown-body a {
    color: var(--accent);
    text-decoration: underline;
}

.history-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 8px 4px;
    line-height: 1.5;
}

.chat-header .status.offline {
    color: #f87171;
}

.chat-header .status.offline::before {
    background: #f87171;
    box-shadow: 0 0 10px #f87171;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.icon-btn:hover:not(:disabled) {
    background: var(--chip-hover);
    color: var(--accent);
}

.icon-btn:disabled,
#send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.sidebar {
    flex-shrink: 0;
    overflow: visible;
}

.history-section {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Geliştirici alanı */
.sidebar-brand {
    flex-shrink: 0;
    margin-top: auto;
    padding: 14px 12px;
    border-radius: 14px;
    border: 1px solid var(--chip-border);
    background: var(--chip-bg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.sidebar-brand-logo {
    width: min(120px, 100%);
    height: auto;
    max-height: 56px;
    object-fit: contain;
    display: block;
    border-radius: 10px;
}

.sidebar-brand-text {
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--text-muted);
    font-weight: 500;
}

[data-theme="light"] .sidebar-brand {
    background: rgba(255, 255, 255, 0.85);
}

.history-section::-webkit-scrollbar {
    width: 4px;
}

.history-section::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 10px;
}

@media (min-width: 901px) {
    #sidebar-toggle {
        visibility: hidden;
        pointer-events: none;
    }
}

/* ——— Mobil: native app (Gemini tarzı) ——— */
@media (max-width: 900px) {
    html,
    body {
        width: 100%;
        height: 100%;
        height: 100dvh;
        max-width: 100vw;
        overflow: hidden;
        overscroll-behavior: none;
    }

    body {
        display: block;
        padding: 0;
        margin: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .blob {
        opacity: 0.35;
        filter: blur(80px);
        animation: none;
    }

    .app-container {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        height: 100%;
        height: 100dvh;
        min-height: 100dvh;
        margin: 0;
        padding: 0;
        gap: 0;
        position: relative;
    }

    .sidebar-toggle {
        display: none;
    }

    .chat-header {
        position: relative;
        flex-shrink: 0;
        z-index: 50;
        padding: 6px 8px;
        padding-top: max(8px, env(safe-area-inset-top));
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        background: rgba(3, 7, 18, 0.55);
        backdrop-filter: blur(28px) saturate(160%);
        -webkit-backdrop-filter: blur(28px) saturate(160%);
        gap: 0;
        min-height: calc(52px + env(safe-area-inset-top));
    }

    [data-theme="light"] .chat-header {
        background: rgba(255, 255, 255, 0.55);
        border-bottom-color: rgba(148, 163, 184, 0.18);
    }

    .chat-header .logo {
        font-size: 1.02rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .header-actions {
        display: none;
    }

    .chat-header .status {
        display: none;
    }

    .quick-prompts {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(86vw, 320px);
        max-width: 320px;
        z-index: 120;
        border-radius: 0 20px 20px 0;
        padding: 16px;
        padding-top: max(16px, env(safe-area-inset-top));
        transform: translateX(-105%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.45);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 110;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        border: none;
        padding: 0;
        margin: 0;
        cursor: pointer;
    }

    .sidebar-backdrop[hidden] {
        display: none !important;
    }

    body.sidebar-open .sidebar-backdrop:not([hidden]) {
        display: block;
    }

    .chat-wrapper {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
        min-height: 0;
        height: 100%;
        margin: 0;
        border-radius: 0;
        border: none;
        box-shadow: none;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        display: flex;
        flex-direction: column;
    }

    .chat-wrapper.glass-effect {
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .chat-box {
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        padding: 8px 16px 16px;
        padding-bottom: calc(var(--input-area-height, 88px) + var(--keyboard-offset, 0px) + 8px);
        gap: 14px;
        -webkit-overflow-scrolling: touch;
    }

    .message-content-col {
        max-width: 100%;
        width: 100%;
    }

    .user-message .message-content-col {
        max-width: 88%;
        width: fit-content;
    }

    .ai-message .message-content-col {
        max-width: 100%;
        width: 100%;
    }

    .bubble {
        padding: 12px 14px;
        font-size: 0.94rem;
        line-height: 1.55;
        border-radius: 16px;
    }

    .ai-message .bubble {
        background: rgba(15, 23, 42, 0.55);
        border: none;
        border-radius: 4px 16px 16px 16px;
        padding: 4px 2px;
    }

    [data-theme="light"] .ai-message .bubble {
        background: transparent;
        color: var(--text-primary);
    }

    .user-message .bubble {
        border-radius: 16px 16px 4px 16px;
        padding: 12px 14px;
    }

    .message-actions {
        margin-top: 4px;
        padding-left: 2px;
    }

    .msg-share-btn {
        padding: 6px 12px;
        font-size: 0.7rem;
        min-height: 32px;
    }

    .chat-input-area {
        position: fixed;
        left: 0;
        right: 0;
        bottom: var(--keyboard-offset, 0px);
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 8px 14px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        border-top: none;
        border-radius: 0;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transform: none;
        z-index: 40;
    }

    [data-theme="light"] .chat-input-area {
        background: transparent;
    }

    .quick-prompts {
        display: none;
    }

    .input-composer {
        gap: 4px;
        padding: 6px 8px 6px 10px;
        border-radius: 28px;
        width: 100%;
        background: var(--input-bg);
        border: 1px solid var(--input-border);
        backdrop-filter: blur(40px) saturate(180%);
        -webkit-backdrop-filter: blur(40px) saturate(180%);
    }

    [data-theme="light"] .input-composer {
        background: rgba(255, 255, 255, 0.82);
        border-color: rgba(255, 255, 255, 0.7);
    }

    #user-input {
        font-size: 16px; /* iOS zoom önleme */
        padding: 10px 4px;
        min-width: 0;
    }

    #attach-btn,
    .credit-ring-btn,
    .theme-toggle {
        width: 40px;
        height: 40px;
    }

    .composer-end,
    .composer-end #voice-btn,
    #send-btn,
    .stop-btn {
        width: 42px;
        height: 42px;
        flex-shrink: 0;
    }

    .credit-widget.expanded .credit-panel {
        width: min(300px, calc(100vw - 48px));
        min-width: 260px;
    }

    .code-block-wrapper {
        margin: 10px 0;
        border-radius: 10px;
        max-width: 100%;
    }

    .bubble.markdown-body pre {
        font-size: 0.8rem;
        padding: 12px;
    }

    body.keyboard-open {
        overflow: hidden;
        height: 100%;
        min-height: 0;
    }

    body.keyboard-open .app-container {
        position: fixed;
        top: var(--vv-top, 0px);
        left: 0;
        right: 0;
        width: 100%;
        height: var(--vv-height, 100dvh);
        max-height: var(--vv-height, 100dvh);
        min-height: 0;
        margin: 0;
    }

    body.keyboard-open .chat-wrapper {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    body.keyboard-open .chat-header {
        position: relative;
        top: auto;
        flex-shrink: 0;
        padding-top: max(6px, env(safe-area-inset-top));
        min-height: calc(52px + env(safe-area-inset-top));
        background: var(--bg-base);
    }

    body.keyboard-open .chat-input-area {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        padding-bottom: 8px;
        flex-shrink: 0;
    }

    body.keyboard-open .chat-box {
        padding-bottom: 12px;
        min-height: 0;
    }

    body.keyboard-open .empty-state {
        min-height: 0;
        padding: 8px 12px;
        gap: 10px;
        justify-content: center;
    }

    body.keyboard-open .empty-hero-mark {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    body.keyboard-open .empty-hero-title {
        font-size: 1.05rem;
    }
}

/* Çok dar telefonlar */
@media (max-width: 380px) {
    .chat-header .status {
        display: none;
    }

    .user-message .message-content-col {
        max-width: 92%;
    }
}

body.keyboard-open .chat-box {
    scroll-behavior: smooth;
}

body.sidebar-open {
    overflow: hidden;
}

/* ——— Feature pack styles ——— */

.header-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}

.chat-header .logo {
    gap: 10px;
}

.lang-toggle {
    width: 40px;
    height: 40px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--accent);
}

.sidebar-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--chip-border);
    background: var(--input-bg);
    color: var(--text-muted);
    flex-shrink: 0;
}

.sidebar-search {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
}

.history-item {
    position: relative;
    padding-right: 36px;
}

.history-item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-menu {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-item-menu:hover {
    background: var(--chip-hover);
    color: var(--accent);
}

.chat-context-menu {
    position: fixed;
    z-index: 200;
    min-width: 200px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--chip-border);
    background: var(--credit-panel-bg);
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
}

.ctx-item:hover {
    background: var(--chip-hover);
    color: var(--accent);
}

.ctx-item.ctx-danger:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}

.message-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.user-message .message-meta {
    text-align: right;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    min-height: 55%;
    padding: 24px 16px 8px;
    gap: 18px;
    text-align: center;
}

.empty-hero-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    object-fit: contain;
    filter: drop-shadow(0 0 18px rgba(56, 189, 248, 0.35));
}

.empty-hero-title {
    max-width: 320px;
    font-size: 1.45rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.empty-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 360px;
}

.empty-chip {
    border: 1px solid var(--chip-border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 100px;
    padding: 8px 14px;
    font-size: 0.82rem;
    cursor: pointer;
}

.empty-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

@media (max-width: 900px) {
    .empty-hero-title {
        font-size: 1.35rem;
    }
}

.doc-bar {
    margin: 2px 4px 0;
}

.doc-bar-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.doc-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 6px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-size: 0.78rem;
    max-width: 220px;
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.doc-chip-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.doc-chip-icon.is-image {
    background: transparent;
    padding: 0;
    overflow: hidden;
}

.doc-chip-icon.is-video {
    background: #6366f1;
}

.doc-chip-thumb {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.msg-attach-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.user-message .msg-attach-preview {
    justify-content: flex-end;
}

.msg-attach-preview img {
    max-width: min(220px, 70vw);
    max-height: 140px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
}

.user-message .msg-attach-preview img {
    max-width: 88px;
    max-height: 88px;
    border-radius: 10px;
}

.msg-file-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.2);
    max-width: 220px;
}

.msg-file-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: #ef4444;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.msg-file-name {
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-message .bubble.attach-only {
    padding: 8px 10px;
}

.code-mode-bar {
    display: none !important;
}

.doc-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.doc-chip-status {
    font-size: 0.64rem;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    color: var(--text-secondary);
    white-space: nowrap;
}

.doc-chip-status.is-pending {
    background: rgba(250, 204, 21, 0.12);
    color: #fde68a;
}

.doc-chip-status.is-ready {
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
}

.doc-chip-status.is-error {
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
}

.doc-chip-remove {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 2px;
}

/* [hidden] asla display:flex ile ezilmesin */
[hidden] {
    display: none !important;
}

.code-mode-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 2px 10px;
    scrollbar-width: none;
}

.code-mode-bar[hidden] {
    display: none !important;
}

.doc-bar[hidden],
.chat-context-menu[hidden],
.attach-sheet[hidden],
.stop-btn[hidden],
#send-btn[hidden],
#voice-btn[hidden] {
    display: none !important;
}

.code-mode-bar::-webkit-scrollbar {
    display: none;
}

.code-mode-chip {
    flex: 0 0 auto;
    padding: 8px 14px;
    border-radius: 100px;
    border: 1px solid rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.stop-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #ef4444;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.stop-btn:hover {
    filter: brightness(1.08);
}

.msg-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--chip-border);
    border-radius: 100px;
    background: var(--chip-bg);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.msg-action-btn:hover {
    background: var(--chip-hover);
    color: var(--accent);
    border-color: var(--accent);
}

.msg-action-btn.speaking {
    color: var(--accent);
    border-color: var(--accent);
}

.credit-panel-stats {
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    .chat-header .logo span {
        font-size: 1rem;
    }

    .header-logo {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 420px) {
    .empty-hero-title {
        font-size: 1.22rem;
    }

    .lang-toggle {
        width: 36px;
        height: 36px;
    }
}

@media (hover: hover) and (pointer: fine) {
    .attach-sheet-item:hover .attach-sheet-icon {
        background: rgba(56, 189, 248, 0.22);
    }

    [data-theme="light"] .attach-sheet-item:hover .attach-sheet-icon {
        background: rgba(2, 132, 199, 0.2);
    }
}

/* Mobilde tıklama sonrası yapışan mavi hover / tap highlight */
@media (hover: none), (pointer: coarse) {
    .icon-btn,
    .nav-btn,
    .haptic-btn,
    .empty-chip,
    .quick-prompt-chip,
    .code-mode-chip,
    .ctx-item,
    .history-item,
    .history-item-menu,
    .msg-action-btn {
        transition: opacity 0.15s ease, transform 0.15s ease;
    }

    .icon-btn:hover:not(:disabled),
    .nav-btn:hover,
    .new-chat:hover,
    .history-item:hover,
    .history-item-menu:hover,
    .quick-prompt-chip:hover:not(:disabled),
    .code-mode-chip:hover,
    .credit-ring-btn:hover,
    .code-copy-btn:hover,
    .ctx-item:hover,
    .ctx-item.ctx-danger:hover,
    .empty-chip:hover,
    .msg-action-btn:hover,
    .msg-share-btn:hover,
    .attach-sheet-item:hover,
    .doc-chip-remove:hover {
        background: unset;
        color: unset;
        border-color: unset;
        filter: none;
        transform: none;
        box-shadow: none;
    }

    #send-btn:hover:not(:disabled),
    .stop-btn:hover {
        filter: none;
        transform: none;
    }

    .attach-sheet-item:hover .attach-sheet-icon {
        background: rgba(56, 189, 248, 0.12);
        color: var(--accent);
    }

    [data-theme="light"] .attach-sheet-item:hover .attach-sheet-icon {
        background: rgba(2, 132, 199, 0.12);
    }
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
.icon-btn:focus:not(:focus-visible),
.nav-btn:focus:not(:focus-visible),
.haptic-btn:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

.privacy-banner {
    margin: 0 0 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.1);
    color: var(--text-primary);
}

.privacy-banner p {
    font-size: 0.82rem;
    margin-bottom: 10px;
    line-height: 1.4;
}

.privacy-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.privacy-btn {
    border: 1px solid var(--chip-border);
    background: var(--chip-bg);
    color: var(--text-primary);
    border-radius: 100px;
    padding: 7px 12px;
    font-size: 0.75rem;
    cursor: pointer;
}

.privacy-btn.ghost {
    background: transparent;
}

.smart-suggestions,
.smart-suggestions[hidden] {
    display: none !important;
}

.smart-suggestions::-webkit-scrollbar {
    display: none;
}

.smart-chip {
    flex: 0 0 auto;
    border: 1px solid var(--chip-border);
    background: var(--chip-bg);
    color: var(--text-secondary);
    border-radius: 100px;
    padding: 8px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    white-space: nowrap;
}

.code-run-btn {
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.code-run-out {
    margin: 0;
    padding: 10px 12px;
    font-size: 0.78rem;
    background: rgba(0, 0, 0, 0.35);
    color: #bbf7d0;
    border-top: 1px solid var(--chip-border);
    white-space: pre-wrap;
    word-break: break-word;
}

.code-run-out.is-error {
    color: #fecaca;
}

#auto-speak-btn.is-on {
    color: var(--accent);
    background: var(--chip-bg);
}

/* ——— Tasarım Stüdyosu ——— */
.design-studio {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.design-studio[hidden] {
    display: none !important;
}

.design-studio-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.design-studio-sheet {
    position: relative;
    z-index: 1;
    width: min(920px, 100%);
    max-height: min(92dvh, 820px);
    overflow: auto;
    border-radius: 24px;
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: auto;
}

.studio-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.studio-head h2 {
    font-size: 1.15rem;
    font-weight: 650;
}

.studio-sub {
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.studio-tabs {
    display: flex;
    gap: 8px;
}

.studio-tab {
    flex: 1;
    border: 1px solid var(--chip-border);
    background: var(--chip-bg);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 8px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.studio-tab.is-on {
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent);
    border-color: rgba(56, 189, 248, 0.4);
}

.studio-body {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 14px;
    min-height: 0;
}

.studio-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.studio-label,
.studio-field span,
.studio-color span {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

#studio-prompt,
.studio-field input[type="text"],
.studio-field select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--input-border);
    background: rgba(0, 0, 0, 0.28);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 0.9rem;
    outline: none;
}

#studio-prompt {
    resize: vertical;
    min-height: 76px;
    font-family: inherit;
}

.studio-row,
.studio-type-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.studio-field.studio-grow {
    grid-column: span 2;
}

.studio-colors {
    grid-column: span 2;
    display: flex;
    gap: 12px;
}

.studio-color input[type="color"] {
    width: 100%;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
}

.studio-field input[type="range"] {
    width: 100%;
}

.design-studio[data-mode="ai"] .studio-type-fields {
    display: none;
}

.studio-preview-wrap {
    min-height: 220px;
}

.studio-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 16px;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
        repeating-conic-gradient(rgba(148,163,184,0.08) 0% 25%, transparent 0% 50%) 0 0 / 24px 24px;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.studio-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.studio-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.studio-preview-empty i {
    font-size: 1.4rem;
    color: var(--accent);
}

.studio-status {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.studio-results {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.studio-results-empty {
    grid-column: 1 / -1;
    padding: 12px;
    border-radius: 12px;
    border: 1px dashed var(--chip-border);
    color: var(--text-muted);
    text-align: center;
    font-size: 0.8rem;
}

.studio-result-card {
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.studio-result-card:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.35);
}

.studio-result-card.is-active {
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.12);
}

.studio-result-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.18);
}

.studio-result-meta {
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.studio-result-meta span:last-child {
    color: var(--text-muted);
}

.studio-actions {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 4px;
}

.studio-primary,
.studio-secondary {
    position: relative;
    z-index: 2;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 650;
    cursor: pointer;
    border: 1px solid transparent;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.studio-primary {
    background: var(--send-bg);
    color: var(--send-color);
}

.studio-secondary {
    background: var(--chip-bg);
    color: var(--text-primary);
    border-color: var(--chip-border);
}

.studio-secondary:disabled,
.studio-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.msg-gen-card {
    margin-bottom: 8px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    max-width: min(420px, 100%);
}

.msg-gen-card img {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.25);
}

.msg-gen-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.msg-gen-bar button {
    border: none;
    background: var(--chip-bg);
    color: var(--accent);
    border-radius: 999px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
}

@media (max-width: 720px) {
    .studio-body {
        grid-template-columns: 1fr;
    }

    .studio-preview {
        aspect-ratio: 4 / 3;
        max-height: 280px;
    }

    .attach-sheet {
        max-width: min(320px, calc(100vw - 28px));
    }

    .studio-results {
        grid-template-columns: 1fr;
    }
}
