:root {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --accent: #6ae4ff;
  --accent-2: #8a7dff;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1100px 600px at 20% 10%, rgba(106, 228, 255, 0.18), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(138, 125, 255, 0.16), transparent 52%),
    radial-gradient(900px 700px at 40% 100%, rgba(255, 120, 220, 0.10), transparent 56%),
    linear-gradient(180deg, #071021, #060b16 60%, #050812);
}

.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: center;
  place-items: center;
  padding: 28px 16px;
  overflow: hidden;
}

.topbar,
.workspace {
  width: min(1280px, 100%);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 420px);
  gap: 14px;
  align-items: stretch;
  margin-top: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.04));
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: conic-gradient(from 180deg, var(--accent), var(--accent-2), #ff78dc, var(--accent));
  box-shadow: 0 10px 28px rgba(106, 228, 255, 0.22);
}

.title {
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.1;
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.status {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}

.chat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.20);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
  height: min(72vh, 720px);
  min-height: 420px;
  max-height: 720px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.drive-panel {
  height: min(72vh, 720px);
  min-height: 420px;
  max-height: 720px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.20);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.drive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.drive-header h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.drive-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.drive-link {
  flex: 0 0 auto;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  border: 1px solid rgba(106, 228, 255, 0.32);
  border-radius: 10px;
  background: rgba(106, 228, 255, 0.10);
}

.drive-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.drive-btn {
  border: 1px solid rgba(106, 228, 255, 0.35);
  background: linear-gradient(180deg, rgba(106, 228, 255, 0.22), rgba(106, 228, 255, 0.10));
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  padding: 8px 10px;
  font-size: 13px;
}

.drive-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.drive-body {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.drive-notice {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.12);
}

.drive-notice.is-hidden {
  display: none;
}

.drive-list {
  min-height: 0;
  overflow: auto;
  padding: 8px;
  scrollbar-color: rgba(106, 228, 255, 0.44) rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
}

.drive-list.is-hidden {
  display: none;
}

.drive-list::-webkit-scrollbar {
  width: 10px;
}

.drive-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.drive-list::-webkit-scrollbar-thumb {
  background: rgba(106, 228, 255, 0.38);
  border: 2px solid rgba(0, 0, 0, 0.22);
  border-radius: 999px;
}

.drive-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  margin: 8px 0;
}

.drive-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(106, 228, 255, 0.22);
  background: rgba(106, 228, 255, 0.10);
  color: var(--text);
  font-weight: 900;
  font-size: 12px;
}

.drive-meta {
  min-width: 0;
}

.drive-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.drive-action {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.drive-action:hover {
  border-color: rgba(106, 228, 255, 0.30);
}

.drive-action.danger {
  border-color: rgba(255, 120, 220, 0.28);
  background: rgba(255, 120, 220, 0.10);
}

.drive-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.drive-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
}

.drive-frame.is-hidden {
  display: none;
}

.messages {
  min-height: 0;
  padding: 18px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-color: rgba(106, 228, 255, 0.44) rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
}

.messages::-webkit-scrollbar {
  width: 10px;
}

.messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(106, 228, 255, 0.38);
  border: 2px solid rgba(0, 0, 0, 0.22);
  border-radius: 999px;
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 10px 0;
}

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

.avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(106, 228, 255, 0.28);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(106, 228, 255, 0.26), rgba(138, 125, 255, 0.16));
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  box-shadow: 0 8px 24px rgba(106, 228, 255, 0.15);
}

.bubble {
  max-width: min(76ch, 84%);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  line-height: 1.35;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg.user .bubble {
  background: linear-gradient(180deg, rgba(106, 228, 255, 0.18), rgba(106, 228, 255, 0.06));
  border-color: rgba(106, 228, 255, 0.28);
}

.msg.bot .bubble {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.05));
}

.typing .bubble {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding-inline: 14px;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  animation: typing-bounce 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.14s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes typing-bounce {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-5px);
  }
}

.meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}

.file-input {
  display: none;
}

.input {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 12px;
  outline: none;
}

.input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.input:focus {
  border-color: rgba(106, 228, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(106, 228, 255, 0.12);
}

.send,
.icon-btn {
  border: 1px solid rgba(106, 228, 255, 0.35);
  background: linear-gradient(180deg, rgba(106, 228, 255, 0.22), rgba(106, 228, 255, 0.10));
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}

.send {
  padding: 12px 14px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.send:disabled,
.icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 560px) {
  .app {
    padding: 14px 10px;
  }
  .topbar {
    padding: 12px 12px;
  }
  .workspace {
    grid-template-columns: 1fr;
    overflow-y: auto;
    align-self: stretch;
  }
  .chat {
    height: calc(100vh - 118px);
    min-height: 360px;
  }
  .drive-panel {
    height: 420px;
    min-height: 420px;
  }
  .messages {
    padding: 14px 12px;
  }
  .bubble {
    max-width: 88%;
  }
}
