:root {
  color-scheme: light;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #f4f5f7;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem max(1rem, calc((100vw - 1200px) / 2));
  background: #17202a;
  color: #fff;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.4rem;
  font-size: 1.35rem;
}

h2 {
  font-size: 1.1rem;
}

h3 {
  margin-top: 1.2rem;
  font-size: 0.95rem;
}

header p {
  margin-bottom: 0;
  color: #bdc3c7;
}

main {
  width: min(1200px, calc(100% - 2rem));
  margin: 1rem auto 3rem;
}

section {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #d5d8dc;
  border-radius: 6px;
  background: #fff;
}

.section-heading,
.toolbar,
.connection-summary {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.connection-summary a {
  color: #fff;
}

.section-heading {
  justify-content: space-between;
  align-items: center;
}

.section-heading h2 {
  margin-bottom: 0;
}

.connection-summary {
  justify-content: flex-end;
  align-items: center;
}

label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.8rem;
}

input,
select,
button {
  min-height: 36px;
  border: 1px solid #85929e;
  border-radius: 4px;
  background: #fff;
  color: inherit;
  font: inherit;
}

input,
select {
  padding: 0.4rem 0.55rem;
}

button {
  cursor: pointer;
  padding: 0.4rem 0.7rem;
  border-color: #2471a3;
  background: #2471a3;
  color: #fff;
}

button:hover:not(:disabled) {
  background: #1a5276;
}

button.secondary {
  border-color: #5d6d7e;
  background: #5d6d7e;
}

button.danger {
  border-color: #a93226;
  background: #a93226;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status {
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.status.ok {
  background: #1e8449;
  color: #fff;
}

.status.error {
  background: #922b21;
  color: #fff;
}

.status.neutral {
  background: #566573;
  color: #fff;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.6rem;
  margin: 0 0 1rem;
}

.weapon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.weapon-actions {
  margin-bottom: 0.8rem;
}

.weapon-facts {
  margin-top: 0.8rem;
}

.notice {
  margin: 0.8rem 0;
  padding: 0.65rem;
  border-left: 4px solid #2471a3;
  background: #ebf5fb;
}

.lobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.room-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem;
  border: 1px solid #aed6f1;
  border-radius: 4px;
  background: #f8fbfd;
}

.room-card strong,
.room-card span {
  overflow-wrap: anywhere;
}

.facts div {
  min-width: 0;
  padding: 0.6rem;
  border: 1px solid #e5e7e9;
  background: #fafafa;
}

.facts dt {
  color: #626567;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.facts dd {
  overflow-wrap: anywhere;
  margin: 0.25rem 0 0;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

.compact-table {
  max-width: 850px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

th,
td {
  padding: 0.45rem;
  border: 1px solid #d5d8dc;
  text-align: left;
  white-space: nowrap;
}

th {
  background: #eaecee;
}

#fish-arena {
  position: relative;
  height: 240px;
  overflow: hidden;
  margin-bottom: 0.8rem;
  border: 1px solid #5dade2;
  border-radius: 4px;
  background: #d6eaf8;
}

.fish-marker {
  position: absolute;
  min-height: 28px;
  padding: 0.25rem 0.45rem;
  transform: translate(-50%, -50%);
  border-color: #117864;
  background: #117864;
  font-size: 0.7rem;
  white-space: nowrap;
  transition: left 0.8s linear, top 0.8s linear;
}

.event-log {
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 0;
  padding-left: 2rem;
  font-size: 0.78rem;
}

.event-log li {
  margin-bottom: 0.35rem;
  overflow-wrap: anywhere;
}

pre {
  max-height: 400px;
  overflow: auto;
  padding: 0.8rem;
  background: #17202a;
  color: #ecf0f1;
  font-size: 0.75rem;
}

@media (max-width: 720px) {
  header {
    display: block;
  }

  .connection-summary {
    justify-content: flex-start;
    margin-top: 1rem;
  }

  #fish-arena {
    height: 180px;
  }
}
