* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: #008080;
  font: 13px Tahoma, Verdana, "Segoe UI", sans-serif;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

[hidden] { display: none !important; }

/* Raised grey 3D window */
.window {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: inset -1px -1px #808080, inset 1px 1px #dfdfdf;
  padding: 3px;
  display: flex;
  flex-direction: column;
}

.titlebar {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  font-weight: bold;
  padding: 3px 6px;
  user-select: none;
}

.sunken {
  background: #fff;
  border: 2px solid;
  border-color: #808080 #fff #fff #808080;
  box-shadow: inset 1px 1px #404040;
}

button {
  font: inherit;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: inset -1px -1px #808080;
  padding: 3px 12px;
  min-width: 72px;
  cursor: pointer;
}
button:active:not(:disabled) {
  border-color: #404040 #fff #fff #404040;
  box-shadow: inset 1px 1px #808080;
}
button:disabled { color: #808080; text-shadow: 1px 1px #fff; cursor: default; }
button.on { border-color: #404040 #fff #fff #404040; background: #d4d0c8; }

input {
  font: inherit;
  padding: 3px 4px;
  border: 2px solid;
  border-color: #808080 #fff #fff #808080;
  box-shadow: inset 1px 1px #404040;
  outline: none;
}

fieldset {
  border: 1px solid #808080;
  box-shadow: 1px 1px #fff, inset 1px 1px #fff;
  margin: 0 0 8px;
  padding: 4px 6px 6px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Main window */
.main { width: 100%; max-width: 900px; height: 100%; max-height: 640px; }

.main .body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 200px;
  grid-template-rows: 1fr auto;
  gap: 6px;
  padding: 6px;
  min-height: 0;
}

.log {
  overflow-y: auto;
  padding: 4px 6px;
  font: 13px "Courier New", Courier, monospace;
  line-height: 1.4;
  word-wrap: break-word;
}
.log .line { margin: 0; white-space: pre-wrap; }
.log .time { color: #808080; }
.log .nick { font-weight: bold; }
.log .system { color: #008000; }
.log a { color: #0000ee; }

.side { display: flex; flex-direction: column; min-height: 0; }
.side fieldset:first-child { flex: 1; }

.list {
  list-style: none;
  margin: 0;
  padding: 2px;
  overflow-y: auto;
  flex: 1;
  min-height: 48px;
}
.list li { padding: 1px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list li.me { font-weight: bold; }
.list li.speaking { background: #00a000; color: #fff; }
.list li .tag { color: #808080; font-size: 11px; }
.list li.speaking .tag { color: #dfffdf; }

.buttons { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.buttons button { flex: 1; min-width: 0; padding: 3px 4px; }

.note { margin: 6px 0 0; font-size: 11px; color: #800000; }

.compose { grid-column: 1 / -1; display: flex; gap: 6px; }
.compose input { flex: 1; min-width: 0; }

.statusbar { display: flex; gap: 2px; margin-top: 2px; }
.statusbar span { background: none; padding: 2px 6px; font-size: 12px; box-shadow: none; border-width: 1px; }
.statusbar span:first-child { flex: 1; }

/* Name prompt */
.dialog { width: 320px; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.dialog .body { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.dialog p { margin: 0 0 6px; }
.dialog .buttons { justify-content: center; }
.dialog .buttons button { flex: 0 0 auto; min-width: 80px; }
.error { color: #800000; min-height: 1em; margin: 0 !important; font-size: 12px; }

@media (max-width: 640px) {
  body { padding: 0; }
  .main { max-height: none; }
  .main .body { grid-template-columns: 1fr; grid-template-rows: 1fr auto auto; }
  .side { order: -1; flex-direction: row; gap: 6px; max-height: 150px; }
  .side fieldset { flex: 1; margin: 0; }
  .compose { grid-column: auto; }
  .dialog { width: calc(100% - 32px); }
}
