* {
  box-sizing: border-box;
}

:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
  background: #0b1020;
  color: #edf2ff;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(rgba(11, 16, 32, .68), rgba(11, 16, 32, .78)),
    url("img/background.jpg") center / cover fixed no-repeat;
}

button, input {
  font: inherit;
}

.app {
  width: min(1800px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.site-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  min-height: 52px;
  margin-bottom: 26px;
  padding: 0 4px;
  border-bottom: 1px solid #273451;
}

.site-name {
  color: #edf2ff;
  font-size: 1.05rem;
  font-weight: 850;
  letter-spacing: .02em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 0;
}

.about-link {
  color: #c2cee6;
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
}

.about-link:hover {
  color: #fff;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
}

.mode-switch {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  border: 1px solid #273451;
  border-radius: 10px;
  background: rgba(18, 26, 48, .7);
}

.mode-btn {
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #aebbd5;
  font-weight: 750;
}

.mode-btn.is-active {
  border-color: #4565a0;
  background: #243657;
  color: #fff;
}

.game-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.options-menu {
  position: relative;
}

.options-menu summary {
  list-style: none;
}

.options-menu summary::-webkit-details-marker {
  display: none;
}

.icon-btn {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid #30415f;
  border-radius: 11px;
  background: #1a2641;
  color: #dce6ff;
  cursor: pointer;
  font-size: 1.25rem;
}

.icon-btn:hover {
  background: #243657;
}

.language-btn {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
}

.language-menu {
  position: relative;
  padding: 0;
}

.language-menu summary {
  list-style: none;
}

.language-menu summary::-webkit-details-marker {
  display: none;
}

.language-panel {
  position: absolute;
  z-index: 6;
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  min-width: 120px;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: #121a30;
  border: 1px solid #30415f;
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, .32);
}

.language-panel button {
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #dce6ff;
  cursor: pointer;
  text-align: left;
}

.language-panel button:hover {
  background: #243657;
}

.options-panel {
  position: absolute;
  z-index: 6;
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  min-width: 205px;
  flex-direction: column;
  gap: 11px;
  padding: 14px;
  background: #121a30;
  border: 1px solid #30415f;
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, .32);
}

.options-panel strong {
  color: #edf2ff;
  font-size: .86rem;
}

.options-panel label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #c2cee6;
  font-size: .86rem;
  white-space: nowrap;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1;
}

.subtitle {
  margin: 12px 0 0;
  color: #9aa8c7;
}

.panel {
  background: rgba(18, 26, 48, .88);
  border: 1px solid #273451;
  border-radius: 18px;
  box-shadow: 0 18px 55px rgba(0,0,0,.22);
  margin-bottom: 20px;
}

.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px 0;
}

.game-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-direction: column;
  gap: 20px;
  padding: 0;
}

.game-info strong {
  font-size: 1.35rem;
}

.game-info span {
  color: #8f9dbb;
  margin-left: 6px;
}

.status {
  color: #aebbd5;
  text-align: left;
}

.guess-form {
  padding: 20px 22px 22px;
}

.guess-form label {
  display: block;
  margin-bottom: 8px;
  font-size: .88rem;
  color: #aebbd5;
}

.input-row {
  display: flex;
  gap: 10px;
}

.autocomplete {
  position: relative;
  flex: 1;
  min-width: 0;
}

input {
  min-width: 0;
  flex: 1;
  border: 1px solid #344463;
  background: #0e1629;
  color: #fff;
  border-radius: 11px;
  padding: 13px 15px;
  outline: none;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  padding: 0;
  accent-color: #6f9cff;
}

input:focus {
  border-color: #6f9cff;
  box-shadow: 0 0 0 3px rgba(111,156,255,.13);
}

.suggestions {
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  max-height: 250px;
  overflow-y: auto;
  padding: 6px;
  background: #121a30;
  border: 1px solid #30415f;
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, .32);
}

.suggestions[hidden] {
  display: none;
}

.suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #dce6ff;
  font-size: .92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.suggestion-meta {
  display: inline-flex;
  min-width: 92px;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  color: #aebbd5;
  font-size: .8rem;
}

.suggestion-nation-icon,
.suggestion-type-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 auto;
}

.suggestion-type-icon {
  filter: invert(1);
}

.suggestion-tier {
  min-width: 18px;
  font-weight: 800;
  text-align: center;
}

.suggestion:hover,
.suggestion[aria-selected="true"] {
  background: #1a2948;
  color: #fff;
}

button {
  border: 0;
  border-radius: 11px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 750;
  transition: transform .12s ease, opacity .12s ease, background .12s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.primary-btn {
  background: #4f7df0;
  color: white;
}

.secondary-btn {
  background: #1a2641;
  color: #dce6ff;
  border: 1px solid #30415f;
}

.error {
  min-height: 20px;
  margin: 8px 0 0;
  color: #ff8e9d;
  font-size: .88rem;
}

.hint-field {
  display: inline-block;
  margin-top: 2px;
  margin-bottom: 10px;
  position: relative;
  z-index: 6;
  color: #8f9dbb;
  font-size: .8rem;
}

.hint-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid #30415f;
  border-radius: 9px;
  background: #1a2641;
  color: #dce6ff;
  font-size: .82rem;
  cursor: pointer;
}

.hint-btn::after {
  content: "▸";
  font-size: .75rem;
}

.hint-field[open] .hint-btn::after {
  transform: rotate(90deg);
}

.hint-btn:not(.disabled):hover,
.hint-option:hover {
  background: #243657;
}

.hint-btn.disabled {
  opacity: .5;
  cursor: not-allowed;
}

.hint-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.hint-option {
  padding: 8px 12px;
  border: 1px solid #30415f;
  border-radius: 9px;
  background: #121a30;
  color: #dce6ff;
  font-size: .82rem;
}

.table-panel {
  overflow: hidden;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 22px 0;
  color: #aebbd5;
  font-size: .82rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.exact-dot {
  background: #4ade80;
}

.wrong-dot {
  background: #f87171;
}

.near-dot {
  background: #f5b437;
}

.table-info {
  padding: 12px 22px 16px;
  color: #8f9dbb;
  font-size: .8rem;
}

.table-info summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #c2cee6;
  cursor: pointer;
  list-style: none;
}

.table-info summary::-webkit-details-marker {
  display: none;
}

.info-question {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid #71809f;
  border-radius: 50%;
  color: #c2cee6;
  font-size: .7rem;
  font-weight: 800;
}

.table-info-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
  padding-left: 23px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1220px;
}

th, td {
  padding: 16px 12px;
  text-align: center;
  border-bottom: 1px solid #24314d;
  white-space: nowrap;
}

th {
  background: #111a30;
  color: #93a4c7;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  position: sticky;
  top: 0;
  z-index: 1;
}

th .table-icon {
  display: block;
  width: 30px;
  height: 30px;
  margin: 0 auto 6px;
  object-fit: contain;
}

th .header-help {
  display: flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
}

th > span {
  display: block;
}

td:first-child, th:first-child {
  text-align: left;
  padding-left: 18px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.cell {
  display: inline-flex;
  min-width: 58px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 7px 10px;
  font-weight: 750;
}

.exact {
  background: rgba(34, 197, 94, .18);
  color: #70e69a;
  border: 1px solid rgba(34, 197, 94, .28);
}

.wrong {
  background: rgba(239, 68, 68, .14);
  color: #ff8b98;
  border: 1px solid rgba(239, 68, 68, .22);
}

.near {
  background: rgba(245, 180, 55, .17);
  color: #ffd36e;
  border: 1px solid rgba(245, 180, 55, .27);
}

.name-cell {
  font-weight: 800;
  color: #f1f5ff;
}

.nation-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nation-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex: 0 0 auto;
}

.type-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: invert(1);
}

.consumable-cell {
  min-width: 58px;
}

.consumable-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.consumable-x {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  color: #a4a9b5;
  font-family: Arial Black, Arial, sans-serif;
  font-size: 1.65rem;
  font-weight: 900;
  line-height: 1;
}

.arrow {
  margin-left: 5px;
  font-size: .9em;
}

.win-message {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(34,197,94,.3);
  background: rgba(34,197,94,.1);
  border-radius: 12px;
  color: #a5f3c1;
}

.win-message span {
  font-size: 1.6rem;
}

.win-message p {
  margin: 3px 0 0;
  color: #91bca0;
}

.hidden {
  display: none;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 4px;
  color: #71809f;
}

.app-footer-legal {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 6px 6px;
  color: #71809f;
}

@media (max-width: 700px) {
  body {
    background-attachment: scroll;
  }

  .app {
    width: min(100% - 18px, 1500px);
    padding-top: 22px;
  }

  .hero {
    align-items: flex-start;
  }

  .hero .secondary-btn {
    padding: 10px 12px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .status {
    text-align: left;
  }

  .input-row {
    flex-direction: column;
  }

  .game-toolbar {
    flex-wrap: wrap;
  }

  .suggestions {
    max-height: 220px;
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .table-wrap::-webkit-scrollbar {
    height: 16px;
  }

  .table-wrap::-webkit-scrollbar-thumb {
    background: #526481;
    border-radius: 6px;
  }
}
