:root {
  color-scheme: dark;
  --bg: #101316;
  --panel: #181d22;
  --panel-2: #20262d;
  --line: #303842;
  --text: #edf2f7;
  --muted: #9aa7b5;
  --green: #52c47a;
  --red: #ff6d6d;
  --yellow: #e7b85a;
  --blue: #67aaf9;
  --violet: #b98cff;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 16px;
  height: 100vh;
  padding: 16px;
}

.memo-panel,
.players-panel,
.messages-panel {
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.memo-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.side-panels {
  display: grid;
  grid-template-rows: minmax(160px, 0.75fr) minmax(260px, 1.25fr);
  gap: 16px;
  min-width: 0;
  min-height: 0;
}

.players-panel,
.messages-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header.compact {
  padding: 14px 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
}

.muted {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.status,
.count {
  flex: none;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-ok {
  color: var(--green);
}

.status-warn {
  color: var(--yellow);
}

.status-bad {
  color: var(--red);
}

textarea {
  width: 100%;
  height: 100%;
  min-height: 280px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 18px;
  background: #12171b;
  color: var(--text);
  font: 15px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.memo-actions {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

input,
button {
  height: 40px;
  border-radius: 6px;
  font: inherit;
}

input {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 0 12px;
  outline: 0;
}

input:focus,
textarea:focus {
  box-shadow: inset 0 0 0 1px var(--blue);
}

button {
  border: 0;
  background: var(--green);
  color: #07130d;
  font-weight: 700;
  padding: 0 18px;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.save-status {
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-status.ok {
  color: var(--green);
}

.save-status.warn {
  color: var(--yellow);
}

.save-status.bad {
  color: var(--red);
}

.players-list,
.messages-list {
  min-height: 0;
  margin: 0;
  padding: 12px;
  overflow: auto;
}

.players-list {
  list-style: none;
}

.players-list li {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-weight: 650;
}

.players-list .empty {
  color: var(--muted);
  font-weight: 400;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 10px;
  border-left: 3px solid var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 6px;
}

.message time {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.message span {
  overflow-wrap: anywhere;
}

.message.chat {
  border-left-color: var(--blue);
}

.message.death {
  border-left-color: var(--red);
}

.message.advancement {
  border-left-color: var(--violet);
}

.message.join {
  border-left-color: var(--green);
}

.message.quit {
  border-left-color: var(--yellow);
}

.message.event {
  border-left-color: var(--muted);
}

@media (max-width: 840px) {
  .dashboard {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .memo-panel {
    min-height: 70vh;
  }

  .side-panels {
    grid-template-rows: minmax(220px, auto) minmax(360px, auto);
  }

  .memo-actions {
    grid-template-columns: 1fr;
  }

  .save-status {
    min-height: 20px;
  }
}
