/* 1. Use a more-intuitive box-sizing model. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2. Remove default margin */
* {
  margin: 0;
}

dialog {
  margin: auto;
}

/* Typographic tweaks!
  3. Add accessible line-height
  4. Improve text rendering */
body {
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
}

/* 5. Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* 6. Remove built-in form typography styles */
input,
button,
textarea,
select {
  font: inherit;
}

/* 7. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

.hex-grid__container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: 1rem;
  align-items: center;
  border-radius: 1rem;
  background-color: black;
}

.hex-grid__list {
  --hex-size: 2em;
  --col-gap: 1em;
  --sans-gap: calc(var(--hex-size) - var(--col-gap));
  display: grid;
  list-style-type: none;
  margin: 0;
  padding: 1rem;
  background-color: black;
  border-radius: 2rem;
  grid-template-columns: calc(var(--sans-gap) / 2) var(--sans-gap) calc(var(--sans-gap) / 2);
  grid-auto-columns: var(--sans-gap) calc(var(--sans-gap) / 2);
  grid-auto-rows: 1fr;
  grid-gap: calc(0.5 * var(--col-gap)) var(--col-gap);
}

.hex-grid__item {
  position: relative;
  grid-column: var(--col)/span 3;
  grid-row: var(--row)/span 2;
  height: 0;
  padding-bottom: 86.6%;
}

.hex-grid__content {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
}

.hex {
  color: white;
  background-color: transparent;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  clip-path: polygon(75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%, 25% 0);
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 1;
}

.hex-free {
  height: calc(var(--hex-size) * 2);
  width: calc(var(--hex-size) * 2.309);
}

.hex-highlighted {
  background-color: #5555cc;
  transform-origin: center;
  transform: scale(120%);
}

.hex-highlighted > * {
  transform: scale(91%);
}

body {
  --hex-size: 1.5rem;
}

p {
  max-width: 40ch;
  margin-bottom: 0.5rem;
}

li {
  max-width: 40ch;
}

#main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "t t t" "l c r" "b b b";
  gap: 1rem;
  padding: 0.5rem;
  height: 100vh;
  background: #3333aa;
}

#menu {
  grid-area: t;
  min-width: 75%;
  overflow-x: auto;
  display: flex;
  flex-direction: row;
  gap: 1rem;
  gap: 0.5rem;
}

#map {
  grid-area: c;
  min-width: 25%;
  min-height: 25%;
  overflow: auto;
}

#tool-left {
  grid-area: l;
  min-height: 25%;
  overflow-y: auto;
  overflow-x: clip;
  display: flex;
  flex-direction: row;
  gap: 1rem;
  /*Hack to give a little more space for the scrollbar */
  padding-right: 0.5rem;
  margin-right: -0.5rem;
}

#tool-right {
  grid-area: r;
  min-height: 25%;
  overflow-y: auto;
  overflow-x: clip;
}

#stats {
  grid-area: b;
  min-width: 75%;
  overflow-x: auto;
  display: flex;
  flex-direction: row;
  gap: 1rem;
  padding: 0.5rem;
  flex-wrap: wrap;
  justify-content: start;
  align-items: start;
  border-radius: 1rem;
  background: white;
}

.modal-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.body-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.save-text {
  display: block;
  overflow-wrap: anywhere;
  max-width: 40ch;
  border: 1px solid black;
  padding: 1rem;
}

.toolbar-vertical {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  gap: 0.5rem;
}

.tile-Empty {
  background-image: url("/assets/tile-empty.webp");
}

.tile-System {
  background-image: url("/assets/tile-system.webp");
}

.tile-Home {
  background-image: url("/assets/tile-home.webp");
}

.tile-Rex {
  background-image: url("/assets/tile-rex.webp");
}

.tile-Hyperlane {
  background-image: url("/assets/lanes/lanebg.webp");
}

.tile-rotate {
  background-color: #bbb;
}

.tile-rotate > * {
  font-size: 3em;
  line-height: 1;
  margin-top: -0.25lh;
}

.tool-btn {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.tool-cursor {
  position: absolute;
  z-index: 100;
  pointer-events: none;
  font-size: 0.5rem;
  --hex-size: 1rem;
  padding-top: 0.5rem;
  padding-left: 0.5rem;
}

.stats-table {
  text-align: center;
  border-collapse: collapse;
}

.stats-table thead {
  border-bottom: 1px solid black;
}

.stats-table td, .stats-table th {
  border-inline: 1px solid black;
  padding-inline: 0.5rem;
}

.stats-table tr > *:first-child {
  border-left: none;
}

.stats-table tr > *:last-child {
  border-right: none;
}

.input-group {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

.input-group > input {
  flex-grow: 1;
}

.flex-row {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

.checkbox-list {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.5rem;
}

.gap-m {
  gap: 0.5rem;
}
