/* ==========================================================================
   Dojo Chat — attachments, downloads, the Files panel and the game player.
   Same console theme as style.css; all variables come from there.
   Mobile first: everything stays clean at 375px with no horizontal scroll.
   ========================================================================== */

/* ───────── attach button in the composer ───────── */

.round-btn.attach {
  font-size: 17px;
  line-height: 1;
  color: var(--text);
}
.round-btn.attach:hover {
  border-color: rgba(93, 194, 30, 0.6);
  box-shadow: var(--orb-shadow), var(--glow);
}

/* ───────── chips above the composer ───────── */

.attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-width: var(--col);
  margin: 0 auto 8px;
  padding: 0 2px;
}

.chip-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 6px 9px 7px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background-image: var(--sheen), var(--fill-2);
  color: var(--text);
  font-size: 12.5px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 2px 8px rgba(0, 0, 0, 0.45);
}
.chip-file.ready { border-color: rgba(93, 194, 30, 0.5); }
.chip-file.failed { border-color: rgba(255, 120, 110, 0.6); opacity: 0.8; }

.chip-file .cf-name {
  max-width: 44vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.chip-file .cf-size { color: var(--muted); font-size: 11.5px; flex: 0 0 auto; }
.chip-file .cf-dl { color: var(--accent-2); flex: 0 0 auto; }

.chip-file .cf-x {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.chip-file .cf-x:hover { background: rgba(255, 90, 80, 0.25); color: #fff; }

.chip-file .cf-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
}
.chip-file .cf-bar i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent);
  transition: width 0.15s linear;
}
.chip-file.ready .cf-bar { opacity: 0; }

/* chips saved with a question, inside the green bubble */
.bubble-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.user-msg .chip-file {
  border-color: rgba(4, 35, 6, 0.35);
  background-image: none;
  background-color: rgba(4, 35, 6, 0.22);
  color: var(--ink);
  box-shadow: none;
  text-decoration: none;
}
.user-msg .chip-file .cf-size { color: rgba(4, 35, 6, 0.7); }
.user-msg .chip-file .cf-dl { color: rgba(4, 35, 6, 0.9); }
.user-msg .chip-file:hover { background-color: rgba(4, 35, 6, 0.34); text-decoration: none; }
.um-text { display: block; }

/* ───────── drag and drop ───────── */

.chat.dropping { position: relative; }
.chat.dropping::after {
  content: "Drop files here";
  position: fixed;
  inset: calc(var(--bar) + 8px) 10px 92px 10px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(93, 194, 30, 0.7);
  border-radius: 20px;
  background: rgba(5, 12, 6, 0.72);
  color: var(--accent-2);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}
@media (min-width: 1024px) {
  .chat.dropping::after { left: calc(var(--nav) + 10px); }
}

/* ───────── code block buttons ───────── */

.codebar-btns { display: inline-flex; gap: 6px; flex: 0 0 auto; }
.dl-btn { white-space: nowrap; }

/* ───────── buttons under a reply ───────── */

.reply-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0 0;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

/* the big glossy PLAY button */
.play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(126, 224, 58, 0.7) !important;
  background-image: var(--sheen), var(--green-fill) !important;
  color: var(--ink) !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 3px 12px rgba(0, 0, 0, 0.5),
              0 0 20px rgba(93, 194, 30, 0.45) !important;
  cursor: pointer;
}
.play-btn:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 0 28px rgba(93,194,30,0.75) !important; }
.reply-tools .play-btn { min-height: 38px; padding: 0 18px; font-size: 14px; }
.proj-play { margin-top: 9px; }

/* ───────── the Files panel ───────── */

.file-cards { display: grid; gap: 9px; margin: 10px 0 18px; }

.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-image: var(--sheen), var(--fill);
  box-shadow: var(--panel-shadow);
}
.fc-main { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fc-main strong {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc-sub { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.fc-btns { display: flex; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }
.fc-btns .btn { white-space: nowrap; }

#filesSearch { margin-bottom: 4px; }

/* ───────── the full-screen player ───────── */

body.playing { overflow: hidden; }

.player {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(93,194,30,0.10), rgba(0,0,0,0) 60%),
    linear-gradient(180deg, #080c09, #020403);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.player-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  padding: 8px 10px;
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0) 60%),
    linear-gradient(180deg, rgba(26,32,27,0.96), rgba(10,14,11,0.96));
}
.player-bar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(93,194,30,0), rgba(93,194,30,0.8), rgba(93,194,30,0));
}
.player-title {
  flex: 1 1 110px;
  min-width: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-btns { display: flex; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }
.player-btns .btn { min-height: 32px; padding: 0 10px; font-size: 12.5px; }

.player-hint {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-stage {
  flex: 1 1 auto;
  min-height: 0;
  background: #000;
}
.player-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.player-stage:fullscreen { background: #000; }

/* on-screen controls */
.player-pad {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 14px;
  background: linear-gradient(to top, rgba(5, 8, 6, 0.96), rgba(5, 8, 6, 0.6));
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}
.pad-dir { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pad-mid { display: flex; gap: 46px; }
.pad-ab { display: flex; gap: 12px; align-items: center; }

.player-pad button {
  width: 54px; height: 54px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background-image: var(--sheen), var(--fill-2);
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--orb-shadow);
}
.player-pad .pad-ab button {
  width: 62px; height: 62px;
  border-color: rgba(126, 224, 58, 0.6);
  background-image: var(--sheen), var(--green-fill);
  color: var(--ink);
}
.player-pad button.on {
  box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.6), 0 0 18px rgba(93, 194, 30, 0.6);
  transform: translateY(1px);
}

@media (max-width: 420px) {
  .player-btns .btn { min-height: 30px; padding: 0 8px; font-size: 11.5px; }
  .player-pad button { width: 48px; height: 48px; font-size: 15px; }
  .player-pad .pad-ab button { width: 55px; height: 55px; }
  .pad-mid { gap: 38px; }
  .chip-file .cf-name { max-width: 40vw; }
}

@media (min-width: 760px) {
  .player-pad { justify-content: center; gap: 60px; }
}

/* 📎 menu: files or a whole folder */
.attach-menu {
  position: fixed; z-index: 80; width: 248px; max-width: calc(100vw - 16px);
  display: flex; flex-direction: column; gap: 4px; padding: 6px;
  border-radius: var(--radius-s, 12px); border: 1px solid rgba(93, 194, 30, 0.45);
  background: var(--fill, #121812); color: var(--text, #eef4ec);
  box-shadow: var(--panel-shadow, none), 0 10px 28px rgba(0, 0, 0, 0.55), var(--glow, none);
  backdrop-filter: blur(10px);
}
.attach-menu button {
  display: block; width: 100%; text-align: left; padding: 11px 12px; border: 0; border-radius: 9px;
  background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.attach-menu button:hover, .attach-menu button:focus-visible {
  background: rgba(93, 194, 30, 0.18); outline: none;
}
.attach-menu-note { padding: 4px 12px 6px; font-size: 12px; line-height: 1.35; color: var(--muted, #a7b6a5); }
