* { margin: 0; padding: 0; box-sizing: border-box; }
:root { --mint: #2ee59d; --violet: #a855f7; --purple: #7c3aed; }
body { font-family: 'Bricolage Grotesque', sans-serif; overflow: hidden; }
.hand { font-family: 'Patrick Hand', cursive; }

.app-container {
  --bg: #1a1a2e; --bg2: #15152a; --bg3: #24244a; --text: #f1f0ff; --border: rgba(255,255,255,.09);
  display: flex; height: 100vh; color: var(--text);
  background:
    radial-gradient(circle at 85% 10%, rgba(46,229,157,.10), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(168,85,247,.14), transparent 45%),
    var(--bg);
}
.app-container.light {
  --bg: #fbf8ff; --bg2: #ffffff; --bg3: #f1ecfb; --text: #231d33; --border: rgba(40,20,80,.12);
}
.doodle.app-container { background-image:
    radial-gradient(circle at 85% 10%, rgba(46,229,157,.10), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(168,85,247,.14), transparent 45%),
    radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: auto, auto, 22px 22px; }
.light.doodle.app-container { background-image: radial-gradient(rgba(80,40,160,.08) 1px, transparent 1px); background-size: 22px 22px; }

.sidebar { background: var(--bg2); border-right: 1px solid var(--border); }
.header { background: color-mix(in srgb, var(--bg2) 85%, transparent); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
.logo-text { font-weight: 800; font-size: 1.35rem; letter-spacing: -.03em; }
.doodle .logo-text { font-family: 'Patrick Hand', cursive; font-weight: 400; font-size: 1.8rem; color: var(--mint); }
.berry-logo .bow { transition: transform .3s; transform-origin: center; }
.berry-logo:hover .bow { animation: wiggle .5s ease-in-out 2; }
.whisk { animation: twitch 2.5s infinite; }
@keyframes wiggle { 0%,100%{transform:rotate(0)} 25%{transform:rotate(-14deg)} 75%{transform:rotate(14deg)} }
@keyframes twitch { 0%,90%,100%{transform:translateX(0)} 95%{transform:translateX(3px)} }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #888; }
.status-dot.ok { background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.status-dot.busy { background: #ffd23f; animation: pulse 1s infinite; }
.status-dot.error { background: #ff4d6d; }
@keyframes pulse { 50% { opacity: .3; } }

.icon-btn { padding: .5rem; border-radius: .6rem; opacity: .75; transition: all .15s; }
.icon-btn:hover { opacity: 1; background: var(--bg3); }
.primary-btn { background: var(--purple); color: #fff; padding: .5rem 1rem; border-radius: .7rem; font-weight: 600; transition: all .15s; }
.primary-btn:hover { background: var(--violet); transform: translateY(-1px); }
.tool-btn { background: var(--bg3); border: 1px solid var(--border); padding: .45rem .8rem; border-radius: .6rem; transition: all .15s; color: var(--text); }
.tool-btn:hover:not(:disabled) { border-color: var(--mint); }
.tool-btn:disabled { opacity: .35; }
.tool-btn.active { background: var(--mint); color: #062; border-color: var(--mint); font-weight: 700; }
.tool-btn.silly { background: linear-gradient(90deg, rgba(46,229,157,.2), rgba(168,85,247,.25)); }

.doodle .primary-btn, .doodle .tool-btn, .doodle .chip, .doodle .message, .doodle .doodle-box, .doodle .input-wrap {
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
}
.doodle .primary-btn, .doodle .tool-btn { font-family: 'Patrick Hand', cursive; font-size: 1.05rem; }

.chat-item { border: 1px solid transparent; transition: all .15s; }
.chat-item:hover { background: var(--bg3); }
.chat-item.active { background: rgba(124,58,237,.18); border-color: rgba(168,85,247,.5); }
.side-whisk { color: var(--violet); font-weight: 900; animation: twitch 1.5s infinite; }

.messages-area { scrollbar-width: thin; scrollbar-color: var(--violet) transparent; }
.message { max-width: min(78%, 720px); padding: .85rem 1.1rem; position: relative; }
.message-user { background: linear-gradient(135deg, #6d28d9, #8b5cf6); color: #fff; border-radius: 1.2rem 1.2rem .3rem 1.2rem; box-shadow: 0 6px 20px rgba(124,58,237,.3); }
.message-ai { background: var(--bg3); border: 1px solid var(--border); border-radius: 1.2rem 1.2rem 1.2rem .3rem; }
.message-err { border-color: #ff4d6d; }
.doodle .message-user { box-shadow: 4px 4px 0 var(--mint); }
.doodle .message-ai { border: 2px solid var(--border); }
.msg-actions { opacity: 0; transition: opacity .2s; }
.msg-row:hover .msg-actions { opacity: 1; }
.msg-actions button { opacity: .6; } .msg-actions button:hover { opacity: 1; }
.msg-img { max-height: 260px; max-width: 100%; border-radius: .8rem; cursor: zoom-in; }
.message-content { line-height: 1.6; word-wrap: break-word; }
.prose-x p { margin-bottom: .5rem; } .prose-x p:last-child { margin-bottom: 0; }
.prose-x ul, .prose-x ol { margin: 0 0 .5rem 1.4rem; } .prose-x ul { list-style: disc; } .prose-x ol { list-style: decimal; }
.prose-x h1, .prose-x h2, .prose-x h3 { font-weight: 800; margin: .8rem 0 .4rem; }
.prose-x a { color: var(--mint); text-decoration: underline; }
.prose-x code { background: rgba(46,229,157,.15); padding: .1rem .35rem; border-radius: .3rem; font-family: 'JetBrains Mono', monospace; font-size: .85em; }
.prose-x blockquote { border-left: 3px solid var(--violet); padding-left: .8rem; opacity: .8; }

.code-block-wrapper { border-radius: .7rem; overflow: hidden; background: #14141f; border: 1px solid #2c2c44; color: #ddd; }
.code-head { background: #1d1d2e; }
.code-block-wrapper pre { padding: 1rem; background: #14141f !important; }
.code-block-wrapper code { font-family: 'JetBrains Mono', monospace; background: transparent !important; }

.typing-indicator { display: flex; gap: 5px; padding: .6rem 1rem; background: var(--bg3); border-radius: 1rem; }
.typing-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); animation: bounce 1.2s infinite; }
.typing-dot:nth-child(2) { background: var(--violet); } .typing-dot:nth-child(3) { background: #ff4fa3; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-8px)} }
.squiggle path { stroke-dasharray: 120; animation: draw 1.2s linear infinite; }
@keyframes draw { from { stroke-dashoffset: 240; } to { stroke-dashoffset: 0; } }

.hero-title { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.05; }
.doodle .hero-title { font-family: 'Patrick Hand', cursive; font-weight: 400; }
.marker { background: linear-gradient(transparent 60%, rgba(46,229,157,.5) 60%); padding: 0 .2em; }
.chip { padding: .55rem 1rem; border: 1.5px dashed var(--violet); border-radius: 999px; background: var(--bg3); opacity: 0; animation: pop .4s forwards; transition: transform .15s; }
.chip:hover { transform: rotate(-2deg) scale(1.05); border-color: var(--mint); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.9); } to { opacity: 1; transform: none; } }

.input-area { border-top: 1px solid var(--border); }
.input-wrap { background: var(--bg3); border: 1.5px solid var(--border); border-radius: 1rem; padding: .3rem .4rem; transition: border-color .2s; }
.input-wrap:focus-within { border-color: var(--violet); }
.input-wrap textarea { color: var(--text); font-family: inherit; font-size: 1rem; }
.send-btn { background: var(--mint); color: #053; padding: .6rem; border-radius: .7rem; margin-bottom: .2rem; transition: all .15s; }
.send-btn:disabled { background: var(--border); color: inherit; opacity: .5; }
.send-btn:not(:disabled):hover { transform: rotate(-8deg) scale(1.08); }
.pending { animation: pop .3s; }

.warn { background: rgba(255,210,63,.15); border: 1px solid rgba(255,210,63,.4); }
.drop-overlay { position: fixed; inset: 0; z-index: 45; background: rgba(46,229,157,.12); border: 4px dashed var(--mint); display: flex; align-items: center; justify-content: center; pointer-events: none; color: var(--mint); }

.overlay { background: rgba(5,5,15,.65); backdrop-filter: blur(4px); animation: fade .2s; }
.panel { background: var(--bg2); border: 1px solid var(--border); border-radius: 1rem; color: var(--text); animation: rise .25s; }
.sub-box { background: var(--bg3); padding: 1rem; border-radius: .8rem; }
.field { background: var(--bg); border: 1px solid var(--border); color: var(--text); outline: none; }
.field:focus { border-color: var(--violet); }
.switch { width: 44px; height: 24px; border-radius: 99px; background: var(--border); position: relative; transition: background .2s; }
.switch div { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--mint); } .switch.on div { transform: translateX(20px); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

.studio { background: #101020; color: #fff; animation: fade .2s; }
.studio .tool-btn { --bg3: #22223c; --text: #fff; --border: rgba(255,255,255,.12); }
.studio-top { border-bottom: 1px solid rgba(255,255,255,.08); }
.canvas-stack { max-width: 100%; max-height: 100%; box-shadow: 0 0 0 3px var(--mint), 0 20px 60px rgba(0,0,0,.6); border-radius: 6px; overflow: hidden; }
.canvas-stack canvas { max-width: calc(100vw - 24px); max-height: calc(100vh - 220px); width: auto; height: auto; }
.draw-layer { width: 100% !important; height: 100% !important; touch-action: none; cursor: crosshair; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); transition: transform .15s; }
.swatch.active { transform: scale(1.2); border-color: #fff; box-shadow: 0 0 0 2px var(--violet); }
.sticker-btn { font-size: 1.4rem; width: 42px; height: 42px; border-radius: 10px; background: #22223c; transition: transform .15s; }
.sticker-btn.active { background: var(--mint); transform: rotate(-6deg) scale(1.1); }

@media (max-width: 768px) { .message { max-width: 90%; } .input-wrap textarea { font-size: 16px; } }