:root {
  --bg:#fff5f7; --fg:#111;
  --accent:#ff1493; --radius:.5rem;
  --msg-user-bg:#e3f2ff; --msg-assist-bg:#ffe0f0;
}
[data-theme="dark"] {
  --bg:#1e1e1e; --fg:#eee;
  --msg-user-bg:#2a3b4c; --msg-assist-bg:#4a2a3c;
}
*{box-sizing:border-box;margin:0;padding:0;}
body{
  font-family:system-ui,Arial,sans-serif;
  background:var(--bg);color:var(--fg);
  display:flex;flex-direction:column;height:100vh;
}
header{
  padding:.8rem 1rem;background:var(--accent);color:#fff;
  font-size:1.2rem;font-weight:bold;
  display:flex;justify-content:space-between;align-items:center;
}
header button{
  padding:.4rem .8rem;background:#fff;color:var(--accent);
  border:none;border-radius:var(--radius);cursor:pointer;
  font-size:.9rem;
}
header button:hover{background:#f0f0f0;}
main{
  flex:1;overflow-y:auto;padding:1rem;display:flex;flex-direction:column;gap:.6rem;
}
.message{
  max-width:80%;padding:.6rem .9rem;border-radius:var(--radius);
}
.message img{
  max-width:100%;border-radius:var(--radius);margin-top:.5rem;
  display:block;
}
.user{align-self:flex-end;background:var(--msg-user-bg);}
.assist{align-self:flex-start;background:var(--msg-assist-bg);}
footer{
  display:flex;gap:.5rem;padding:.8rem 1rem;background:#fff;
  border-top:1px solid #ddd;
}
footer input{
  flex:1;padding:.6rem .9rem;border:1px solid #ccc;border-radius:var(--radius);
}
footer button{
  padding:.6rem 1rem;background:var(--accent);color:#fff;border:none;border-radius:var(--radius);
  cursor:pointer;
}
footer button:disabled{opacity:.6;cursor:not-allowed;}
.spinner{
  border:2px solid #f3f3f3;
  border-top:2px solid var(--accent);
  border-radius:50%;width:16px;height:16px;
  animation:spin .8s linear infinite;margin-left:.5rem;
}
@keyframes spin{to{transform:rotate(360deg);}}
/* Toast */
#toast{
  position:fixed;bottom:1rem;right:1rem;max-width:300px;
}
.toast{
  background:#333;color:#fff;padding:.6rem 1rem;margin-top:.5rem;
  border-radius:var(--radius);opacity:0;transform:translateY(20px);
  animation:toast-in .3s forwards;
}
@keyframes toast-in{to{opacity:1;transform:translateY(0);}}
/* Age Gate */
dialog{
  border:none;border-radius:var(--radius);padding:2rem;
  box-shadow:0 4px 12px rgba(0,0,0,.15);
  background:var(--bg,#fff5f7);color:var(--fg,#111);
}
dialog::backdrop{
  background:rgba(0,0,0,0.5);
}
dialog button{
  margin-top:1rem;padding:.6rem 1.2rem;background:var(--accent);
  color:#fff;border:none;border-radius:var(--radius);cursor:pointer;
}

/* Story Mode UI */
.mode-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-left: 12px;
}

.mode-badge.story-mode {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.mode-badge.free-mode {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.settings-section {
  margin: 1.5rem 0;
}

.settings-section h3 {
  margin-bottom: 1rem;
  color: var(--fg);
}

.mode-toggle {
  margin: 1rem 0;
}

.toggle-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: 12px;
}

.toggle-slider {
  position: relative;
  width: 50px;
  height: 24px;
  background: #ccc;
  border-radius: 12px;
  transition: background 0.3s;
}

.toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
  background: #667eea;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.3s;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider::after {
  transform: translateX(26px);
}

.setting-description {
  font-size: 0.9rem;
  color: #666;
  margin: 8px 0;
  line-height: 1.5;
}

.toast.scene-transition {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}

.toast .scene-icon {
  font-size: 1.5rem;
}

.toast .scene-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast .scene-name {
  font-weight: 600;
  font-size: 1rem;
}

.toast .scene-message {
  font-size: 0.85rem;
  opacity: 0.9;
}
