  /* ---------- the chat window (retro frame) ---------- */
  .cframe { background: #0d1b3d; border: 4px solid #1c3a7a; border-radius: 12px; box-shadow: inset 0 0 0 2px #2a4f9e, 0 0 0 1px #0a1430; padding: 8px 12px 12px; }
  .ctabrow { display: flex; justify-content: space-between; align-items: flex-end; padding-left: 24px; margin-bottom: -1px; }
  .ctab { display: inline-block; margin: 0; font-size: 15px; font-weight: normal; line-height: 1.2; color: #fff; padding: 7px 18px 6px; background: linear-gradient(#2b55a8, #1a3a7c); border: 1px solid #10285a; border-bottom: none; border-radius: 8px 8px 0 0; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
  .cmin { width: 24px; height: 18px; margin-bottom: 2px; border: 1px solid #0a1430; border-radius: 4px; background: linear-gradient(#c3d3f5, #162c5c); color: #cfe0ff; font-size: 12px; line-height: 14px; text-align: center; }
  .cmain { display: flex; gap: 6px; height: 530px; position: relative; }
  #left { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  #logwrap { position: relative; flex: 1; min-height: 0; display: flex; }
  #log { flex: 1; min-width: 0; overflow-y: auto; background: #fff; border: 1px solid #2a4f9e; padding: 8px; font-size: 12px; line-height: 17px; color: #2f8a2f; word-wrap: break-word; }
  .topic { font-weight: bold; }
  .msg { color: #222; }
  .msg .n { font-weight: bold; }
  .me { color: #8a1c9c; }
  .self { background: #0a246a; color: #fff; padding: 0 1px; }
  .selftxt { background: #000; color: #fff; padding: 0 2px; }

  #toolbar { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 4px; }
  #toolbar .btn2 { width: 22px; height: 22px; text-align: center; line-height: 21px; font: italic bold 15px Georgia, serif; color: #2a5db0; background: linear-gradient(#cdd9f7, #9db6ec); border: 1px solid #3b63b8; border-radius: 3px; cursor: pointer; user-select: none; }
  #toolbar .btn2.emo { font: 15px "Segoe UI Emoji","Apple Color Emoji","Noto Color Emoji",sans-serif; line-height: 20px; }
  #toolbar .btn2.on { outline: 2px solid #1a3a7c; }
  #toolbar select { font: 11px Tahoma, sans-serif; height: 22px; padding: 0 4px; color: #222; background: linear-gradient(#f4f7ff, #dde7ff); border: 1px solid #3b63b8; border-radius: 3px; }
  #ubtn { display: none; margin-left: auto; font: 11px Tahoma, sans-serif; padding: 3px 9px; border: 1px solid #3b63b8; border-radius: 3px; background: linear-gradient(#f4f7ff, #dde7ff); color: #1a3a7c; cursor: pointer; }
  #input { width: 100%; height: 42px; padding: 6px 10px; font: 13px Tahoma, Verdana, sans-serif; color: #222; background: #fff; border: 1px solid #2a4f9e; border-radius: 4px; outline: none; }
  #input::placeholder { color: #b5b5b5; }
  #input:disabled { background: #eef1fa; }

  /* font + colour panel and emoji panel */
  #pop { display: none; position: absolute; left: 4px; bottom: 82px; z-index: 6; background: #f1f5ff; border: 2px solid #2a4f9e; border-radius: 8px; box-shadow: 0 3px 10px rgba(0,0,0,.25); padding: 8px; font-size: 12px; color: #1a3a7c; max-width: calc(100% - 8px); max-height: calc(100% - 92px); overflow-y: auto; }
  #pop.show { display: block; }
  #pop label { display: block; margin: 6px 0 3px; font-weight: bold; }
  #flist { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; max-height: 128px; overflow-y: auto; width: 296px; max-width: 100%; }
  #flist span { padding: 3px 6px; border: 1px solid #c3d3f5; border-radius: 3px; background: #fff; cursor: pointer; font-size: 14px; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #flist span:hover { background: #e3ebff; }
  #flist span.sel { background: #2b55a8; color: #fff; border-color: #1a3a7c; }
  #sws { width: 296px; max-width: 100%; line-height: 0; }
  .sw { display: inline-block; width: 20px; height: 20px; margin: 1px; border: 1px solid #666; border-radius: 3px; cursor: pointer; vertical-align: top; }
  .sw.sel { outline: 2px solid #000; outline-offset: 1px; }
  .crow { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
  .crow input[type=color] { width: 38px; height: 26px; padding: 0; border: 1px solid #3b63b8; background: none; cursor: pointer; }
  .tgl { display: inline-block; min-width: 30px; padding: 3px 8px; margin-right: 4px; border: 1px solid #3b63b8; border-radius: 3px; background: linear-gradient(#f4f7ff, #dde7ff); cursor: pointer; text-align: center; font-size: 14px; color: #222; }
  .tgl.sel { background: #2b55a8; color: #fff; }
  .big { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 88px; height: 38px; margin: 0 6px 6px 0; padding: 0 12px; border: 2px solid #3b63b8; border-radius: 6px; background: linear-gradient(#f4f7ff, #c3d3f5); cursor: pointer; font-size: 16px; color: #222; user-select: none; }
  .big:hover { background: linear-gradient(#fff, #dde7ff); }
  .big.sel { background: linear-gradient(#3b63b8, #1a3a7c); color: #fff; border-color: #10285a; box-shadow: inset 0 2px 4px rgba(0,0,0,.25); }
  .big b { font-size: 20px; }
  #szrow { display: flex; align-items: center; gap: 8px; width: 296px; max-width: 100%; }
  #szrow input[type=range] { flex: 1; accent-color: #1a3a7c; }
  #szval { min-width: 46px; text-align: right; font-weight: bold; }
  #toolbar .q { font: bold 13px Tahoma, sans-serif; font-style: normal; text-decoration: none; }
  #toolbar .q.sel { background: linear-gradient(#3b63b8, #1a3a7c); color: #fff; }
  #prev { margin-top: 8px; padding: 6px 8px; background: #fff; border: 1px solid #c3d3f5; border-radius: 4px; min-height: 30px; font-size: 15px; word-break: break-word; width: 296px; max-width: 100%; }
  #emojis { width: 288px; max-width: 100%; }
  #emojis .tabs { display: flex; gap: 4px; margin-bottom: 4px; }
  #emojis .tabs span { flex: 1; text-align: center; padding: 3px 0; border: 1px solid #3b63b8; border-radius: 3px; cursor: pointer; font-size: 16px; background: #e3ebff; }
  #emojis .tabs span.sel { background: #2b55a8; }
  #egrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; max-height: 190px; overflow-y: auto; }
  #egrid span { text-align: center; font-size: 20px; line-height: 30px; cursor: pointer; border-radius: 4px; font-family: "Segoe UI Emoji","Apple Color Emoji","Noto Color Emoji",sans-serif; }
  #egrid span:hover { background: #dde7ff; }

  /* user list with status dots */
  #grip { width: 6px; height: 20px; align-self: center; background: repeating-linear-gradient(#3b63b8 0 2px, transparent 2px 4px); opacity: .55; }
  #right { width: 134px; background: #fff; border: 1px solid #2a4f9e; overflow-y: scroll; overflow-x: hidden; font-size: 11px; color: #2f8a2f; }
  .u { height: 23.5px; display: flex; align-items: center; gap: 8px; padding-left: 7px; white-space: nowrap; overflow: hidden; cursor: pointer; }
  .u:hover { background: #e3ebff; }
  .u i { position: relative; width: 16px; height: 20px; flex: none; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='20' viewBox='0 0 16 20'><defs><linearGradient id='g' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='%23e3ecfb'/><stop offset='1' stop-color='%237f9fd6'/></linearGradient></defs><circle cx='8' cy='6' r='4.2' fill='url(%23g)' stroke='%235f7fb8' stroke-width='.9'/><path d='M1.2 19c0-6.500 3-8 6.800-8s6.800 1.500 6.800 8z' fill='url(%23g)' stroke='%235f7fb8' stroke-width='.9'/></svg>") no-repeat center; }
  .u i::after { content: ""; position: absolute; right: -3px; bottom: 0; width: 8px; height: 8px; border-radius: 50%; border: 1px solid #fff; background: #3fae2a; }
  .u.s-away i::after { background: #e6a817; }
  .u.s-busy i::after { background: #d33; }
  .u.s-off i::after { background: #999; }
  .u.s-away, .u.s-busy { color: #56608a; }
  .u.s-off { color: #999; }
  .u em { font-size: 9px; color: #999; font-style: normal; margin-left: -3px; }
  #right::-webkit-scrollbar, #log::-webkit-scrollbar { width: 16px; }
  #right::-webkit-scrollbar-track, #log::-webkit-scrollbar-track { background: #dde7ff; border-left: 1px solid #2a4f9e; }
  #right::-webkit-scrollbar-thumb, #log::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #10285a, #2b55a8 45%, #10285a); border: 1px solid #0a1430; border-radius: 3px; }
  #right::-webkit-scrollbar-button:vertical:start:decrement, #log::-webkit-scrollbar-button:vertical:start:decrement { display: block; height: 16px; background: #1c3a7a url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16'><path d='M4 10l4-4 4 4z' fill='%23dff2a8'/></svg>") center no-repeat; }
  #right::-webkit-scrollbar-button:vertical:end:increment, #log::-webkit-scrollbar-button:vertical:end:increment { display: block; height: 16px; background: #1c3a7a url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16'><path d='M4 6l4 4 4-4z' fill='%23dff2a8'/></svg>") center no-repeat; }
  @supports (-moz-appearance: none) { #right, #log { scrollbar-color: #2b55a8 #dde7ff; } }

  /* nickname gate: nothing connects until this is submitted */
  #gate { position: absolute; inset: 0; background: rgba(225,230,242,.45); -webkit-backdrop-filter: blur(2.5px); backdrop-filter: blur(2.5px); display: flex; align-items: center; justify-content: center; z-index: 5; border: 1px solid #2a4f9e; }
  #gate form { background: #fff; border: 2px solid #2a4f9e; border-radius: 8px; padding: 16px 18px; width: min(310px, 92%); text-align: center; font-size: 13px; color: #1a3a7c; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
  #gate b { display: block; font-size: 15px; margin-bottom: 8px; }
  #gate input[type=text], #gate input[type=password] { width: 100%; padding: 8px; margin: 4px 0 8px; border: 1px solid #2a4f9e; border-radius: 4px; font: 14px Tahoma, sans-serif; }
  #gate .gnote { font-size: 11px; color: #56608a; line-height: 1.4; margin: 2px 0 10px; text-align: center; }
  #gate button { width: 100%; padding: 10px; font: bold 15px Tahoma, sans-serif; color: #fff; cursor: pointer; background: linear-gradient(#3b63b8, #1a3a7c); border: 1px solid #10285a; border-radius: 6px; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
  #gerr { color: #a11; font-size: 12px; min-height: 16px; margin-bottom: 6px; }

  /* click menu on a name */
  #menu { position: fixed; display: none; background: #f1f5ff; border: 1px solid #1c3a7a; box-shadow: 2px 2px 4px rgba(0,0,0,.3); font-size: 13px; z-index: 30; min-width: 150px; }
  #menu div { padding: 6px 18px; cursor: pointer; }
  #menu div:hover { background: #2b55a8; color: #fff; }
  #menu .hd { background: #dde7ff; font-weight: bold; color: #1a3a7c; cursor: default; font-size: 12px; }
  #menu .hd:hover { background: #dde7ff; color: #1a3a7c; }

  /* private message windows */
  #pms { position: fixed; right: 12px; bottom: 0; z-index: 20; display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 8px; pointer-events: none; }
  .pmw { pointer-events: auto; width: 270px; background: #0d1b3d; border: 3px solid #1c3a7a; border-bottom: none; border-radius: 10px 10px 0 0; box-shadow: 0 -2px 10px rgba(0,0,0,.3); display: flex; flex-direction: column; height: 320px; }
  .pmw .ph { display: flex; align-items: center; gap: 6px; padding: 5px 8px; background: linear-gradient(#2b55a8, #1a3a7c); color: #fff; font-size: 13px; text-shadow: 0 1px 0 rgba(0,0,0,.25); cursor: pointer; border-radius: 6px 6px 0 0; }
  .pmw .ph b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pmw .ph .x { cursor: pointer; padding: 0 4px; font-size: 16px; line-height: 14px; }
  .pmw .ph .dot { width: 9px; height: 9px; border-radius: 50%; background: #3fae2a; border: 1px solid #fff; flex: none; }
  .pmw .ph .dot.s-away { background: #e6a817; } .pmw .ph .dot.s-busy { background: #d33; } .pmw .ph .dot.s-off { background: #999; }
  .pmw.flash .ph { background: linear-gradient(#ffd54a, #e0a000); }
  .pmw .pl { flex: 1; overflow-y: auto; background: #fff; margin: 4px 4px 0; border: 1px solid #2a4f9e; padding: 6px; font-size: 12px; line-height: 17px; color: #222; word-wrap: break-word; }
  .pmw .pi { margin: 4px; height: 34px; padding: 4px 8px; border: 1px solid #2a4f9e; border-radius: 4px; outline: none; font: 13px Tahoma, sans-serif; }
  .pmw.min { height: auto; } .pmw.min .pl, .pmw.min .pi { display: none; }
  .pmw .note { color: #a15; font-style: italic; }

  @media (max-width: 600px) {
    .cmain { height: min(60vh, 500px); min-height: 380px; }
    #ubtn { display: inline-block; }
    #right { display: none; position: absolute; right: 0; top: 0; bottom: 38px; z-index: 4; width: 150px; box-shadow: -2px 0 6px rgba(0,0,0,.25); }
    #right.open { display: block; }
    #grip { display: none; }
    #pms { left: 8px; right: 8px; }
    .pmw { width: 100%; height: 55vh; }
    .pmw:not(:first-child) { display: none; }
  }
/* ---- navy theme overrides ---- */
.ctabrow{display:flex;justify-content:space-between;align-items:flex-end}
#toolbar .btn2,#toolbar select,#ubtn{background:linear-gradient(#27447f,#162c5c);border-color:#3b63b8;color:#cfe0ff}
#toolbar .q.sel{background:linear-gradient(#5b86d6,#2b55a8);color:#fff}
.cmin{background:linear-gradient(#2b55a8,#1a3a7c);border-color:#10285a;color:#bcd0ff}
.ctab{color:#fff}
.chat-note{font-size:12px;color:#56608a;text-align:center;margin:6px 0 0}
#chat{font:16px/1.4 Tahoma,Verdana,Arial,sans-serif;color:#222}
#chat *,#menu *,#pms *{box-sizing:border-box}
#pop{color:#1a3a7c}
#flist span.sel,.tgl.sel,#emojis .tabs span.sel{background:#2b55a8;color:#fff;border-color:#1a3a7c}
.pmw .ph{color:#fff}
.ts{color:#8b93ad;font-size:11px;margin-right:2px}
#inrow{display:flex;gap:6px}
#inrow #input{flex:1;min-width:0;width:auto}
#send{flex:0 0 auto;height:42px;padding:0 18px;font:bold 14px Tahoma,Verdana,sans-serif;color:#fff;background:linear-gradient(#3b63b8,#1a3a7c);border:1px solid #10285a;border-radius:4px;cursor:pointer}
#send:hover:not(:disabled){background:linear-gradient(#4a74cc,#22498f)}
#send:disabled{opacity:.45;cursor:default}
#gate .gmeet{font-size:12px;color:#1a3a7c;text-align:center;margin:2px 0 4px}
#newmsg{display:none;position:absolute;left:50%;bottom:10px;transform:translateX(-50%);z-index:3;padding:5px 14px;font:bold 12px Tahoma,Verdana,sans-serif;color:#fff;background:#2b55a8;border:1px solid #10285a;border-radius:16px;cursor:pointer;box-shadow:0 2px 6px rgba(0,0,0,.35)}
.pmw.flash .ph{background:linear-gradient(#ffd54a,#e0a000)}
.pmw{box-shadow:0 -2px 8px rgba(0,0,0,.35)}
#gate button{background:linear-gradient(#3b63b8,#1a3a7c);border-color:#10285a;color:#fff}
#menu .hd{color:#1a3a7c}
#gate a{color:#1a3a7c}
/* reserve the chat's space so the page does not jump when the chat loads */
#chat-room{min-height:615px}
@media (max-width:600px){#chat-room{min-height:calc(max(380px, min(60vh, 500px)) + 85px)}}
