:root {
  --navy: #140d42;
  --accent: #3f37c9;
  --white: #ffffff;
  --line: #b8bed4;
  --thumb: #6f7385;
  --font: "Comic Sans MS", "Comic Sans", cursive;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #f3f4f8;
  color: var(--navy);
  font-family: var(--font);
  font-size: 14px;
}

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  background-color: var(--white);
  border-bottom: none;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand img {
  height: 36px;
  width: auto;
  display: block;
}

nav {
  display: flex;
  gap: 22px;
}

nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--navy);
  font-weight: bold;
  font-size: 14px;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}

nav a:hover,
nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

main.container {
  padding: 36px 20px 64px;
}

nav img {
  width: 20px;
  height: 20px;
}

.hidden {
  display: none;
}

.section-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-bar h2 {
  font-size: 20px;
  color: var(--navy);
}

.section-bar a {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
}

.section-bar a:hover {
  text-decoration: underline;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
}

.toolbar input {
  width: 240px;
  padding: 7px 10px;
  font-family: var(--font);
  font-size: 13px;
  background-color: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--navy);
}

.toolbar input:focus {
  outline: none;
  border-color: var(--accent);
}

.mode-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background-color: var(--white);
}

.mode-switch button {
  border: none;
  background: none;
  padding: 6px 12px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: bold;
  color: var(--navy);
  cursor: pointer;
}

.mode-switch button + button {
  border-left: 1px solid var(--line);
}

.mode-switch button.active {
  background-color: var(--navy);
  color: var(--white);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.game-card {
  text-decoration: none;
  color: inherit;
  display: block;
}

.game-card:hover .game-title {
  text-decoration: underline;
}

.thumb,
.modal-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--thumb);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: bold;
  user-select: none;
}

.thumb {
  font-size: 46px;
}

.thumb img,
.modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-meta {
  padding: 8px 0;
}

.game-title {
  font-size: 13px;
  font-weight: bold;
  color: var(--navy);
}

.games-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.games-list .game-card {
  display: flex;
  align-items: center;
}

.games-list .thumb {
  width: 112px;
  height: 63px;
  aspect-ratio: auto;
  font-size: 20px;
  flex-shrink: 0;
}

.games-list .card-meta {
  padding: 0 16px;
}

.empty-msg {
  color: #4a4f66;
  font-size: 14px;
}

dialog {
  margin: auto;
  border: none;
  padding: 0;
  background-color: var(--white);
  color: var(--navy);
  font-family: var(--font);
  width: 360px;
  max-width: calc(100% - 24px);
}

dialog::backdrop {
  background: rgba(20, 13, 66, 0.45);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--navy);
  color: var(--white);
}

.modal-head h3 {
  font-size: 15px;
}

.modal-head button {
  background: none;
  border: none;
  color: var(--white);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.modal-thumb {
  font-size: 48px;
}

.modal-box p {
  padding: 16px;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .topbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 10px;
  }

  nav {
    flex-wrap: wrap;
    gap: 14px;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar input {
    width: 100%;
  }
}

@media (min-width: 721px) {
  .topbar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 200px;
  }

  .topbar-inner {
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 32px;
    height: 100%;
    padding: 24px;
  }

  nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  main.container {
    max-width: none;
    margin-left: 200px;
    padding: 32px;
  }

  #home-grid {
    grid-template-columns: 2fr 1fr;
    align-items: start;
  }

  #home-grid .game-card:first-child {
    grid-row: span 2;
  }
}