/* ============================================================
   ANGEL DENPA CHAT // aesthetic celeste-azulado + pixel + CRT
   ============================================================ */

:root {
  --bg: #d3e9ff;
  --bg2: #f2f8ff;
  --panel: #ffffff;
  --blue: #1f6fd6;
  --accent: #4d9bff;
  --blue-soft: #d5e9ff;
  --deep: #5b7bff;
  --deep-soft: #e4ebff;
  --cyan: #0096c7;
  --teal: #00a39b;
  --green: #149a3c;
  --yellow: #b88600;
  --orange: #e06300;
  --purple: #6a3fd6;
  --red: #d61f3c;
  --text: #00284d;
  --dim: #5a87b8;
  --glow: rgba(31, 111, 214, 0.45);
}

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

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  color: var(--text);
  font-family: 'Pixelify Sans', 'Courier New', monospace;
  font-size: 17px;
  overflow: hidden;
}

::selection { background: var(--blue); color: #fff; }

/* ---------- CRT overlays ---------- */

.crt {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, 0.12) 100%);
  animation: crt-flicker 4s infinite steps(1);
}

.crt::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.06) 3px,
    rgba(0, 0, 0, 0) 4px
  );
}

.crt::after {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(31, 111, 214, 0.04) 0 1px,
    rgba(0, 0, 0, 0) 1px 3px
  );
}

@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.9; }
  94% { opacity: 1; }
  97% { opacity: 0.94; }
  98% { opacity: 1; }
}

.scanlines {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 51;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.05) 0px,
    rgba(0, 0, 0, 0) 1px,
    rgba(0, 0, 0, 0) 3px
  );
  mix-blend-mode: multiply;
}

.vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 52;
  box-shadow: inset 0 0 140px 30px rgba(0, 60, 130, 0.15);
}

/* ---------- dreamy sky backgrounds ---------- */

.login-body, .chat-body {
  background:
    radial-gradient(circle at 15% 20%, rgba(77, 155, 255, 0.4), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(91, 123, 255, 0.35), transparent 45%),
    radial-gradient(circle at 80% 15%, rgba(0, 150, 199, 0.25), transparent 40%),
    linear-gradient(160deg, #d3e9ff, #dce7ff, #d9f2ff);
}

.login-body { display: flex; align-items: center; justify-content: center; padding: 16px; }
.chat-body { display: flex; align-items: center; justify-content: center; padding: 22px; }

/* ---------- retro kawaii window ---------- */

.terminal {
  background: linear-gradient(180deg, var(--bg2), var(--panel));
  border: 4px solid #fff;
  outline: 4px solid var(--blue);
  box-shadow:
    0 0 0 8px var(--deep),
    0 0 34px var(--glow),
    inset 0 0 46px rgba(77, 155, 255, 0.12);
  position: relative;
  z-index: 10;
}

.winbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  background: linear-gradient(90deg, var(--blue), var(--deep));
  border-bottom: 4px solid #fff;
  font-family: 'Press Start 2P', 'Pixelify Sans', monospace;
  font-size: 10px;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
  letter-spacing: 0.5px;
}

.winbar-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.winbar-btns { display: flex; gap: 4px; }

.winbtn {
  display: inline-block;
  min-width: 22px;
  text-align: center;
  padding: 2px 4px;
  background: #fff;
  border: 2px solid var(--text);
  box-shadow: inset 0 0 0 1px rgba(31, 111, 214, 0.3);
  font-size: 9px;
  cursor: default;
  user-select: none;
  color: var(--text);
}
.winbtn.danger { color: var(--red); }

/* ---------- login ---------- */

.login-terminal {
  width: min(760px, 100%);
  padding: 24px 32px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.angel-art {
  text-align: center;
  color: var(--blue);
  font-size: 22px;
  line-height: 1.1;
  font-weight: 700;
  text-shadow:
    0 0 8px var(--accent),
    0 0 22px var(--accent),
    0 0 40px var(--deep);
  animation: angel-glow 2.6s ease-in-out infinite;
}

@keyframes angel-glow {
  0%, 100% { opacity: 1; filter: brightness(1); }
  50% { opacity: 0.82; filter: brightness(1.25); }
}

.sparkles {
  text-align: center;
  color: var(--cyan);
  font-size: 14px;
  letter-spacing: 6px;
  text-shadow: 0 0 8px var(--cyan);
  animation: blink 1.6s steps(2) infinite;
}

.glitch { position: relative; }

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  text-align: center;
  opacity: 0;
  pointer-events: none;
}
.glitch::before {
  color: var(--cyan);
  transform: translate(2px, -1px);
  clip-path: inset(0 0 60% 0);
  animation: glitch-a 3.2s infinite linear alternate-reverse;
}
.glitch::after {
  color: var(--purple);
  transform: translate(-2px, 1px);
  clip-path: inset(40% 0 0 0);
  animation: glitch-b 3.2s infinite linear alternate;
}

@keyframes glitch-a {
  0%, 90% { opacity: 0; }
  91% { opacity: 0.8; }
  93% { opacity: 0; }
  95% { opacity: 0.8; }
  96% { opacity: 0; }
}
@keyframes glitch-b {
  0%, 90% { opacity: 0; }
  92% { opacity: 0.7; }
  94% { opacity: 0; }
  96% { opacity: 0.7; }
  98% { opacity: 0; }
}

.boot-line {
  color: var(--deep);
  font-weight: 600;
  text-shadow: 0 0 5px rgba(91, 123, 255, 0.45);
  white-space: pre-wrap;
  word-break: break-word;
}

.login-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text);
}

.prompt {
  color: var(--green);
  font-weight: 700;
  text-shadow: 0 0 6px rgba(20, 154, 60, 0.5);
}

.login-question {
  color: var(--blue);
  font-size: 24px;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(31, 111, 214, 0.6);
  animation: blink 1s steps(2) infinite;
  flex-shrink: 0;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.cmd-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 20px;
  caret-color: var(--blue);
  border-bottom: 3px solid var(--blue-soft);
  padding: 2px 4px;
}
.cmd-input:focus { border-bottom-color: var(--blue); }

.login-error {
  color: var(--red);
  font-weight: 700;
  letter-spacing: 1px;
  min-height: 22px;
  text-shadow: 0 0 8px rgba(214, 31, 60, 0.5);
  animation: glitch-shake 0.3s steps(2) 3;
  opacity: 0;
  transition: opacity 0.15s;
}
.login-error.show { opacity: 1; }

@keyframes glitch-shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 1px); }
  50% { transform: translate(3px, -1px); }
  75% { transform: translate(-2px, -2px); }
  100% { transform: translate(0, 0); }
}

.blink-cursor-line {
  color: var(--green);
  animation: blink 0.8s steps(1) infinite;
}

/* ---------- chat window (square, bigger) ---------- */

.chat-terminal {
  width: min(1240px, 100%);
  height: min(860px, 94vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chanbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 14px;
  background: linear-gradient(90deg, var(--blue-soft), var(--deep-soft));
  border-bottom: 3px solid #fff;
  font-size: 14px;
}

.chan-name {
  color: var(--blue);
  font-weight: 700;
  text-shadow: 0 0 6px rgba(31, 111, 214, 0.5);
  white-space: nowrap;
}

.chan-info {
  color: var(--dim);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  scrollbar-color: var(--blue) transparent;
  scrollbar-width: thin;
  font-size: 18px;
  line-height: 1.55;
  background: #fbfdff;
  word-break: break-word;
}

.messages::-webkit-scrollbar { width: 10px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--blue), var(--deep));
  border: 2px solid #fff;
  border-radius: 0;
}

.msg-line { word-break: break-word; white-space: pre-wrap; }

.time { color: var(--dim); text-shadow: none; font-size: 15px; }

.nick { font-weight: 700; }
.nick.self, .dot.self { color: var(--cyan); }
.nick-blue, .dot-blue { color: var(--blue); }
.nick-cyan, .dot-cyan { color: var(--cyan); }
.nick-teal, .dot-teal { color: var(--teal); }
.nick-green, .dot-green { color: var(--green); }
.nick-yellow, .dot-yellow { color: var(--yellow); }
.nick-orange, .dot-orange { color: var(--orange); }
.nick-purple, .dot-purple { color: var(--purple); }
.nick-red, .dot-red { color: var(--red); }

.msg-line.system {
  color: var(--deep);
  font-style: italic;
  text-align: center;
  margin: 2px 0;
  text-shadow: 0 0 5px rgba(91, 123, 255, 0.3);
  animation: fadein 0.25s ease;
}

.msg-line.private { color: var(--yellow); text-shadow: 0 0 5px rgba(184, 134, 0, 0.3); }

.msg-line.self .text { color: var(--blue); }

@keyframes fadein {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

/* ---------- sidebar ---------- */

.sidebar {
  width: 200px;
  flex-shrink: 0;
  border-left: 4px solid #fff;
  background: linear-gradient(180deg, var(--blue-soft), var(--deep-soft));
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 10px 8px;
  color: var(--blue);
  text-shadow: 0 0 6px rgba(31, 111, 214, 0.6);
  border-bottom: 3px solid #fff;
  letter-spacing: 1px;
}

.userlist {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 8px;
}

.user {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  font-size: 15px;
  transition: background 0.1s;
}
.user:hover { background: rgba(31, 111, 214, 0.12); }

.dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.self-tag { color: var(--dim); font-size: 12px; }

.sidebar-status {
  padding: 6px 8px;
  border-top: 3px solid #fff;
  color: var(--green);
  font-weight: 600;
  font-size: 13px;
  text-shadow: 0 0 5px rgba(20, 154, 60, 0.4);
  word-break: break-word;
}

/* ---------- input ---------- */

.inputline {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 4px solid #fff;
  padding: 10px 14px;
  background: linear-gradient(90deg, var(--bg2), var(--deep-soft));
}

.inputline .prompt { font-size: 20px; }

.inputline .cmd-input { border-bottom: none; }

/* ---------- tool buttons / input bar ---------- */

.tool-btn {
  flex-shrink: 0;
  background: #fff;
  border: 3px solid var(--blue);
  box-shadow: 3px 3px 0 var(--deep);
  color: var(--blue);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 3px 8px;
  cursor: pointer;
  transition: transform 0.05s, box-shadow 0.05s;
}
.tool-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--deep); }
.tool-btn.active { background: var(--blue); color: #fff; }

.tool-btn.send-btn {
  background: var(--blue);
  border-color: var(--deep);
  color: #fff;
  font-size: 16px;
  padding: 4px 12px;
  letter-spacing: 1px;
  box-shadow: 3px 3px 0 var(--deep);
}
.tool-btn.send-btn:hover { background: var(--blue-soft); color: var(--deep); }
.tool-btn.send-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--deep); }

.pass-input {
  margin-top: 8px;
  display: block;
  width: 100%;
}

/* ---------- kaomoji tray ---------- */

.kaomoji-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 168px;
  overflow-y: auto;
  padding: 8px 10px;
  border-top: 3px solid #fff;
  background: linear-gradient(90deg, var(--blue-soft), var(--deep-soft));
  scrollbar-width: thin;
  scrollbar-color: var(--blue) transparent;
}

.kao-btn {
  flex-shrink: 0;
  background: #fff;
  border: 2px solid var(--deep);
  color: var(--text);
  font-family: 'Pixelify Sans', monospace;
  font-size: 15px;
  padding: 2px 6px;
  cursor: pointer;
  white-space: nowrap;
}
.kao-btn:hover { background: var(--blue-soft); }

/* ---------- message actions (edit / delete) ---------- */

.msg-line { position: relative; }

.msg-action {
  position: absolute;
  top: 3px;
  opacity: 0;
  background: #fff;
  border: 2px solid var(--deep);
  color: var(--deep);
  font-size: 11px;
  line-height: 1;
  padding: 1px 4px;
  cursor: pointer;
}
.msg-line:hover .msg-action { opacity: 1; }

.msg-action.edit { right: 26px; }
.msg-action.del { right: 4px; color: var(--red); border-color: var(--red); }

.edit-input {
  background: #fff;
  border: 2px solid var(--blue);
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  padding: 0 4px;
  outline: none;
  width: 70%;
  max-width: 60ch;
}

.edited { color: var(--dim); font-size: 13px; font-style: italic; }

/* ---------- image messages ---------- */

.imgline .nick::after { content: ' '; }

.img-link {
  color: var(--blue);
  font-weight: 700;
  text-decoration: underline dotted;
  cursor: pointer;
}
.img-link:hover { color: var(--cyan); text-decoration: underline; }

/* ---------- admin panel ---------- */

.admin-panel {
  border-top: 4px solid #fff;
  display: flex;
  flex-direction: column;
  max-height: 40%;
  min-height: 0;
  background: rgba(255, 255, 255, 0.55);
}

.adminlist {
  list-style: none;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.adm-user {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 2px;
  font-size: 14px;
  flex-wrap: wrap;
}
.adm-user .nick { overflow: hidden; text-overflow: ellipsis; }

.adm-btn {
  background: #fff;
  border: 2px solid var(--deep);
  color: var(--deep);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 0 5px;
  cursor: pointer;
}
.adm-btn:hover { background: var(--blue-soft); }
.adm-btn.del { border-color: var(--red); color: var(--red); }
.adm-btn.del:hover { background: var(--red); color: #fff; }

/* ---------- login form + footer ---------- */

.login-form {
  display: flex;
  flex: 1;
  gap: 8px;
  min-width: 0;
  align-items: center;
}

.connect-btn {
  font-size: 16px;
  padding: 4px 12px;
  white-space: nowrap;
}

.login-footer {
  margin-top: 4px;
  text-align: right;
}

.admin-link {
  display: inline-block;
  color: var(--deep);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--deep);
  padding: 2px 10px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 2px 2px 0 var(--deep);
  cursor: pointer;
}
.admin-link:hover { background: var(--deep); color: #fff; }

/* ---------- gate (acceso) ---------- */

.gate-lock { width: min(640px, 100%); }

.gate-title {
  font-family: 'Press Start 2P', 'Pixelify Sans', monospace;
  font-size: 14px;
  line-height: 1.7;
  color: var(--blue);
  text-shadow: 2px 2px 0 var(--blue-soft);
  letter-spacing: 0.5px;
  text-align: center;
  margin-top: 2px;
}

.gate-form-lock {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-top: 4px;
}

.gate-label-lock {
  font-weight: 700;
  color: var(--deep);
  letter-spacing: 1px;
  font-size: 16px;
}

.gate-btn-lock {
  font-size: 16px;
  padding: 5px 12px;
}

.gate-hint {
  color: var(--dim);
  font-size: 12px;
  letter-spacing: 1px;
}

.gate-lock .login-error { text-align: center; }

/* ---------- loading overlay (Linux boot) ---------- */

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #000;
}

.loading-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.55) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0) 3px
  );
  pointer-events: none;
}

.linux-boot {
  width: min(780px, 100%);
  background: #000;
  border: 2px solid #1f5c2f;
  box-shadow: 0 0 30px rgba(45, 255, 94, 0.25), inset 0 0 70px rgba(0, 40, 10, 0.45);
  font-family: 'Courier New', monospace;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.linux-header {
  color: #b8ffc8;
  font-weight: 700;
  letter-spacing: 1px;
  border-bottom: 1px solid #1f5c2f;
  padding-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.linux-cursor { animation: blink 0.8s steps(1) infinite; }

.linux-lines {
  min-height: 240px;
  font-size: 14px;
  line-height: 1.55;
  overflow: hidden;
}

.linux-line {
  color: #2dff5e;
  white-space: pre-wrap;
  word-break: break-word;
  text-shadow: 0 0 6px rgba(45, 255, 94, 0.4);
}

.linux-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.linux-pct {
  color: #b8ffc8;
  font-weight: 700;
  min-width: 44px;
}

.linux-progress .progress-track {
  flex: 1;
  height: 16px;
  background: #04120a;
  border: 2px solid #1f5c2f;
}

.linux-progress .progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0f7a2f, #2dff5e);
  transition: width 0.12s linear;
}

.linux-status {
  color: #7dffab;
  font-size: 13px;
  min-height: 18px;
  animation: blink 0.9s steps(1) infinite;
}

/* ---------- admin dashboard ---------- */

.admin-body { display: flex; align-items: center; justify-content: center; padding: 16px; }

.admin-terminal {
  width: min(1160px, 100%);
  height: min(820px, 94vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.winbar a { text-decoration: none; }

.adm-login {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
}

.adm-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--blue);
  letter-spacing: 1px;
}

.adm-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(320px, 100%);
}

.adm-form label {
  font-size: 13px;
  color: var(--dim);
  font-weight: 700;
}

.adm-dash {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.adm-cols {
  flex: 1;
  display: flex;
  min-height: 0;
}

.adm-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.adm-users-col {
  width: 240px;
  flex-shrink: 0;
  border-right: 4px solid #fff;
  background: linear-gradient(180deg, var(--blue-soft), var(--deep-soft));
}

.adm-users-col .userlist { flex: 1; }

.adm-users-col .adm-user { font-size: 14px; }

.adm-loc {
  width: 100%;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  word-break: break-word;
  min-height: 14px;
}

.adm-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 4px solid #fff;
  padding: 8px 14px;
  background: linear-gradient(90deg, var(--bg2), var(--deep-soft));
}

.adm-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tool-btn.danger { border-color: var(--red); color: var(--red); box-shadow: 3px 3px 0 var(--red); }
.tool-btn.danger.active, .tool-btn.danger:hover { background: var(--red); color: #fff; }
.tool-btn.danger:active { box-shadow: 1px 1px 0 var(--red); }

a.tool-btn { text-decoration: none; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .sidebar { display: none; }
  .chan-info { display: none; }
  .chat-terminal { width: min(1240px, 100%); }
  .edit-input { width: 90%; }
  .adm-users-col { width: 190px; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .login-body, .chat-body { padding: 10px; }
  .chat-terminal { height: 96vh; }
  .messages { font-size: 17px; padding: 12px 12px; }
  .inputline { padding: 8px 10px; flex-wrap: wrap; }
  .inputline .cmd-input { min-width: 100px; }
  .angel-art { font-size: 17px; }
  .login-question { font-size: 20px; }
  .winbar { font-size: 8px; padding: 6px 8px; }
  .kaomoji-tray { padding: 6px 8px; }
}
