@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg: #080808;
  --surface: #111;
  --border: #1e1e1e;
  --accent: #00ff88;
  --accent2: #00cfff;
  --text: #e8e8e8;
  --muted: #555;
  --mc-green: #55ff55;
  --mc-bg: #1a1a0a;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Mono', monospace;
  height: 100vh;
  overflow: hidden;
}

.app {
  display: flex;
  height: 100vh;
}

.chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

/* ─── TOP ROW ─────────────────────────────────────────────── */
.topRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: #090909;
}

.topRow-right {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.pill {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.pill::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  background: radial-gradient(circle, rgba(0,255,136,0.25) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: width 0.35s ease, height 0.35s ease;
  border-radius: 50%;
}

.pill:hover::after { width: 130px; height: 130px; }

.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 4px 16px rgba(0,255,136,0.18);
}

.pill:active { transform: scale(0.96); }

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 18px rgba(0,255,136,0.35);
  transform: translateY(-1px);
}

.text-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-block;
}

.text-btn:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

/* ─── MESSAGES ───────────────────────────────────────────── */
#messages {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

#messages::-webkit-scrollbar { width: 3px; }
#messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.msg {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.65;
  animation: msgIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  max-width: 82%;
  word-break: break-word;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.user-msg {
  background: #0e1f14;
  border: 1px solid rgba(0,255,136,0.14);
  align-self: flex-end;
  color: var(--accent);
}

.ai-msg {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  color: var(--text);
}

.sys-msg {
  background: transparent;
  border: 1px dashed var(--border);
  align-self: center;
  color: var(--muted);
  font-size: 10px;
  padding: 5px 14px;
  border-radius: 999px;
  max-width: 100%;
}

/* ─── INPUT BAR ─────────────────────────────────────────── */
.inputBar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: #090909;
}

#input {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,255,136,0.07);
}

#send {
  background: var(--accent);
  border: none;
  color: #000;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#send:hover {
  background: #00ffaa;
  transform: scale(1.06);
  box-shadow: 0 0 16px rgba(0,255,136,0.38);
}

#send:active { transform: scale(0.96); }
#send:disabled { opacity: 0.5; cursor: default; transform: none; }

/* ─── ICON BUTTONS ──────────────────────────────────────── */
.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon-btn:hover {
  border-color: var(--accent2);
  color: var(--accent2);
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(0,207,255,0.18);
}

.imagegen-btn:hover {
  border-color: #ff88cc;
  color: #ff88cc;
  box-shadow: 0 0 10px rgba(255,136,204,0.22);
}

/* ─── MINECRAFT MODE ────────────────────────────────────── */
body.minecraft-mode { background: var(--mc-bg); }
body.minecraft-mode .chat { background: var(--mc-bg); }

body.minecraft-mode .user-msg {
  background: #0a1a0a;
  border: 2px solid #2a5a2a;
  color: var(--mc-green);
  text-shadow: 0 0 6px rgba(85,255,85,0.4);
  border-radius: 2px;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

body.minecraft-mode .ai-msg {
  background: #111107;
  border: 2px solid #4a4a1a;
  color: #ffff55;
  text-shadow: 0 0 6px rgba(255,255,85,0.25);
  border-radius: 2px;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

body.minecraft-mode .topRow {
  background: #0d1a0d;
  border-bottom: 2px solid #2a5a2a;
}

body.minecraft-mode .pill.active {
  background: #2a7a2a;
  border-color: var(--mc-green);
  color: var(--mc-green);
  box-shadow: 0 0 14px rgba(85,255,85,0.28);
}

body.minecraft-mode .inputBar {
  background: #0d1a0d;
  border-top: 2px solid #2a5a2a;
}

body.minecraft-mode #input {
  background: #0a120a;
  border-color: #2a5a2a;
  color: var(--mc-green);
  font-family: 'Courier New', monospace;
}

body.minecraft-mode #send {
  background: #2a7a2a;
  color: var(--mc-green);
  border-radius: 2px;
  font-family: 'Courier New', monospace;
}

body.minecraft-mode #send:hover {
  background: #3a9a3a;
  box-shadow: 0 0 14px rgba(85,255,85,0.35);
}

/* ─── MODAL ──────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease;
}

.modal.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  max-width: 540px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideUp 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-title {
  font-size: 14px;
  font-weight: 700;
  color: #ff88cc;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.modal-subtitle {
  font-size: 11px;
  color: var(--muted);
}

#imageResult {
  min-height: 50px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  align-self: flex-end;
  transition: all 0.2s;
}

.modal-close:hover { border-color: #ff88cc; color: #ff88cc; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }
