:root{
  --bg:#07070a;
  --panel: rgba(0,0,0,.35);
  --panel-strong: rgba(0,0,0,.45);
  --line: rgba(120,255,120,.25);
  --glow: rgba(120,255,120,.18);

  --text:#f2f2f2;
  --muted:rgba(255,255,255,.65);
  --accent:#9dff7a;
  --gold:#ffd75e;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  color:var(--text);
  font-family: Roboto, system-ui, -apple-system, Segoe UI, sans-serif;
  background:
    radial-gradient(circle at 30% 0%, rgba(120,255,120,.08), transparent 55%),
    radial-gradient(circle at 70% 20%, rgba(255,215,94,.06), transparent 50%),
    var(--bg);
}

/* =============================
   PAGE WRAP
   ============================= */

.frame{
  width: 100%;
  margin: 0 auto;
  padding: 18px 16px 44px;
}

/* =============================
   CHAT PANEL (CRT)
   ============================= */

/* Lock width and keep consistent across rooms */
.crt{
  position:relative;
  width: min(920px, 100%);
  margin: 0 auto;

  height: min(72vh, 560px);
  display:flex;
  flex-direction:column;

  border-radius: 22px;
  border: 1px solid var(--line);
  background: radial-gradient(circle at top, rgba(0,255,150,.10), rgba(0,0,0,.82));
  box-shadow: 0 0 34px rgba(120,255,120,.10);
  overflow:hidden;
}

.scanlines{
  pointer-events:none;
  position:absolute;
  inset:0;
  opacity:0.22;
  mix-blend-mode: screen;
  background-image: linear-gradient(
    transparent 0,
    rgba(255,255,255,0.06) 1px,
    transparent 2px
  );
  background-size: 100% 3px;
}

/* =============================
   FLOATING ROOM SELECTOR
   ============================= */

.room-float{
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;

  display: flex;
  align-items: center;
  gap: 8px;

  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 0 18px rgba(0,0,0,.45) inset;
}

.room-float label{
  font-family:"Press Start 2P", monospace;
  font-size:10px;
  color: rgba(255,255,255,.75);
  letter-spacing:.08em;
}

.room-float select{
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(120,255,120,.35);
  color: var(--accent);
  border-radius: 10px;
  padding: 6px 8px;
  font-family: Roboto, system-ui, sans-serif;
  font-size: 12px;
}

/* =============================
   LOG
   ============================= */

.log{
  position:relative;
  z-index:1;
  padding: 14px;
  flex: 1;
  min-height: 0;     /* critical for scroll inside flex */
  overflow-y: auto;
  overflow-x: hidden;

  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  line-height: 1.55;

  /* never let long lines stretch the panel */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.line{
  display:flex;
  gap:10px;
  padding: 4px 0;
  white-space: pre-wrap;
}

.time{
  color: rgba(255,255,255,.55);
  min-width: 72px;
}

.name{
  color: var(--accent);
  min-width: 110px;
}

.text{
  color: rgba(255,255,255,.90);
  flex:1;
}

.sys .name{ color: rgba(255,255,255,.65); }
.sys .text{ color: rgba(255,215,94,.92); }

/* Optional scrollbars (webkit) */
.log::-webkit-scrollbar{ width: 10px; }
.log::-webkit-scrollbar-thumb{ border-radius: 10px; }

/* =============================
   DOCK (inputs)
   Expects:
   - .who (contains #handle)
   - .rooms (contains #roomSelect)
   - form#form.form (contains #msg + #send)
   - .meta
   ============================= */

.dock{
  position:relative;
  z-index:1;
  border-top: 1px solid rgba(255,255,255,.10);
  padding: 12px;
  background: rgba(0,0,0,.28);

  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-areas:
    "who   rooms"
    "form  form"
    "meta  meta";
  gap: 10px;
  align-items: center;
}

.who{ grid-area: who; }

.rooms{
  grid-area: rooms;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.room-label{
  font-family:"Press Start 2P", monospace;
  font-size:10px;
  color: rgba(255,255,255,.75);
  letter-spacing:.08em;
}

#handle,
#msg{
  width:100%;
  background: rgba(0,0,0,.40);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: Roboto, system-ui, sans-serif;
  font-size: 12px;
  outline: none;
}

#handle::placeholder,
#msg::placeholder{
  color: rgba(255,255,255,.40);
}

#roomSelect{
  background: rgba(0,0,0,.40);
  border: 1px solid rgba(120,255,120,.35);
  color: #9dff7a;
  border-radius: 12px;
  padding: 8px 10px;
  font-family: Roboto, system-ui, sans-serif;
  font-size: 12px;
}

.form{
  grid-area: form;
  display:flex;
  gap:8px;
  align-items:center;
  width: 100%;
}

#msg{
  flex: 1;
  min-width: 0; /* critical: makes the input actually expand */
}

#send{
  border-radius: 12px;
  border: 1px solid rgba(255,215,94,.40);
  background: rgba(255,215,94,.10);
  color: var(--text);
  padding: 10px 12px;
  cursor:pointer;
  font-family:"Press Start 2P", monospace;
  font-size: 10px;
  white-space: nowrap;
}

#send:hover{
  border-color: rgba(255,215,94,.55);
  box-shadow: 0 0 22px rgba(255,215,94,.10) inset;
}

.meta{
  grid-area: meta;
  display:flex;
  gap:8px;
  align-items:center;
  color: rgba(255,255,255,.65);
  font-family: Roboto, system-ui, sans-serif;
  font-size: 12px;
}

.dot{ color: rgba(255,215,94,.90); }
.sep{ opacity: .7; }
.hint{ opacity: .85; }

/* =============================
   RESPONSIVE
   ============================= */

@media (max-width: 720px){
  .dock{
    grid-template-columns: 1fr;
    grid-template-areas:
      "who"
      "rooms"
      "form"
      "meta";
  }
  .rooms{ justify-self: start; }
  .name{ min-width: 90px; }
  .time{ min-width: 64px; }
}

/* Room selector floats top-right */
.room-float{
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 3;
}

/* Reserve space so messages never hide behind it */
.log{
  padding-top: 62px; /* adjust: 56–72 depending on your selector height */
}
