.trie-game {
  display: grid;
  gap: 12px;
}

.trie-hero {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #d2dce8;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.trie-emblem {
  position: relative;
  width: 54px;
  height: 54px;
  border: 1px solid #bfd4ce;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbf6 0%, #e9f6ef 100%);
  overflow: hidden;
}

.trie-emblem::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 7px;
  height: 11px;
  border-radius: 999px;
  background: #9b6b3d;
}

.trie-emblem-stem {
  position: absolute;
  left: 25px;
  bottom: 16px;
  width: 5px;
  height: 27px;
  border-radius: 999px;
  background: #167f59;
}

.trie-emblem-leaf {
  position: absolute;
  bottom: 28px;
  width: 19px;
  height: 13px;
  border-radius: 99px 2px 99px 2px;
  background: #20a06f;
}

.trie-emblem-leaf-left {
  left: 10px;
  transform: rotate(-28deg);
}

.trie-emblem-leaf-right {
  right: 9px;
  transform: scaleX(-1) rotate(-28deg);
}

.trie-hero-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.trie-title {
  color: #17202a;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.trie-subtitle {
  color: #475467;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.trie-progress {
  min-width: 52px;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f766e;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}

.trie-mission {
  border: 1px solid #d2dce8;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.trie-mission-title {
  color: #17202a;
  font-size: 15px;
  font-weight: 850;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.trie-word {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.trie-letter {
  min-width: 0;
  min-height: 54px;
  border: 2px solid #d0d9e6;
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  place-items: center;
  gap: 1px;
  padding: 5px 4px;
}

.trie-letter strong {
  color: #17202a;
  font-size: 23px;
  font-weight: 950;
  line-height: 1;
}

.trie-letter small {
  color: #667085;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.trie-letter-active {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.trie-letter-done {
  border-color: #0f766e;
  background: #e7f7f1;
}

.trie-letter-flagged {
  border-color: #b7791f;
  background: #fff7df;
}

.trie-board {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(247, 251, 248, 0.96) 100%),
    repeating-linear-gradient(90deg, rgba(137, 114, 86, 0.08) 0 1px, transparent 1px 34px);
  padding: 12px;
  display: grid;
  gap: 12px;
  overflow: hidden;
}

.trie-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.trie-stat {
  min-width: 0;
  border: 1px solid #d6deea;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
  display: grid;
  gap: 2px;
}

.trie-stat span {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
}

.trie-stat strong {
  color: #17202a;
  font-size: 22px;
  font-weight: 950;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.trie-garden {
  min-width: 0;
  border: 1px solid #cdd8e5;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #f8fbf6 0%, #eff8f1 62%, #e2eee5 100%);
  padding: 12px 10px;
  display: grid;
  justify-items: center;
}

.trie-level {
  width: 100%;
  display: grid;
  place-items: center;
}

.trie-connector {
  width: 6px;
  height: 22px;
  border-radius: 999px;
  background: #9b6b3d;
  margin: 2px 0;
}

.trie-node {
  position: relative;
  min-width: 86px;
  max-width: 100%;
  min-height: 62px;
  border: 2px solid #b9c8d8;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  display: grid;
  place-items: center;
  gap: 1px;
  padding: 7px 12px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform 130ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.trie-node:active,
.trie-seed:active,
.trie-query:active,
.trie-flag-button:active,
.trie-action:active {
  transform: scale(0.97);
}

.trie-node:focus-visible,
.trie-seed:focus-visible,
.trie-query:focus-visible,
.trie-flag-button:focus-visible,
.trie-action:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.trie-node strong {
  position: relative;
  z-index: 1;
  color: #17202a;
  font-size: 21px;
  font-weight: 950;
  line-height: 1;
}

.trie-node small {
  position: relative;
  z-index: 1;
  color: #667085;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.trie-node-soil {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 6px;
  height: 8px;
  border-radius: 999px;
  background: rgba(139, 92, 45, 0.18);
}

.trie-node-root {
  background: #f8fafc;
}

.trie-node-current {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.trie-node-end {
  border-color: #b7791f;
  background: #fff7df;
}

.trie-node-scanned {
  border-color: #0f766e;
  background: #e6f7f0;
}

.trie-node-scan-active {
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.16);
}

.trie-node-flag {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 18px;
  height: 22px;
  opacity: 0;
}

.trie-node-flag::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 3px;
  height: 20px;
  border-radius: 999px;
  background: #8a5a1e;
}

.trie-node-flag::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 1px;
  width: 11px;
  height: 9px;
  border-radius: 2px 5px 5px 2px;
  background: #d97706;
}

.trie-node-end .trie-node-flag {
  opacity: 1;
}

.trie-flag-panel {
  display: none;
}

.trie-flag-panel-active {
  display: block;
}

.trie-flag-button {
  width: 100%;
  min-height: 58px;
  border: 2px solid #d7b56d;
  border-radius: 8px;
  background: #fff9e8;
  color: #17202a;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.trie-flag-button strong {
  display: block;
  color: #17202a;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
}

.trie-flag-button small {
  display: block;
  margin-top: 2px;
  color: #7a4f16;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.trie-flag-icon {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #f8e6b4;
}

.trie-flag-icon::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 8px;
  width: 4px;
  height: 30px;
  border-radius: 999px;
  background: #8a5a1e;
}

.trie-flag-icon::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 9px;
  width: 17px;
  height: 13px;
  border-radius: 2px 7px 7px 2px;
  background: #d97706;
}

.trie-query-panel {
  border: 1px solid #d4dce8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  display: grid;
  gap: 9px;
  opacity: 0.58;
}

.trie-query-panel-active {
  opacity: 1;
}

.trie-query-head {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #344054;
  font-size: 14px;
  font-weight: 850;
}

.trie-query-head strong {
  color: #0f766e;
  font-size: 14px;
  font-weight: 950;
  white-space: nowrap;
}

.trie-query-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.trie-query {
  min-width: 0;
  min-height: 58px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  cursor: pointer;
  touch-action: manipulation;
  text-align: left;
}

.trie-query-disabled {
  cursor: default;
}

.trie-query-orb {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid #2563eb;
  background: #dbeafe;
  box-shadow: inset 0 0 0 5px #ffffff;
}

.trie-query-code {
  min-width: 0;
  color: #17202a;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.trie-query-code small {
  display: block;
  margin-top: 3px;
  color: #667085;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.1;
}

.trie-query strong {
  color: #667085;
  font-size: 13px;
  font-weight: 950;
  line-height: 1.1;
  white-space: nowrap;
}

.trie-query-active {
  border-color: #2563eb;
  background: #eff6ff;
}

.trie-query-true {
  border-color: #0f766e;
  background: #e7f7f1;
}

.trie-query-false {
  border-color: #b7791f;
  background: #fff7df;
}

.trie-status {
  min-height: 44px;
  border: 1px solid #d4dce8;
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  padding: 10px 11px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.trie-status-good {
  border-color: #8ecdb9;
  background: #e9f8f2;
  color: #0f513f;
}

.trie-status-warn {
  border-color: #e3ba67;
  background: #fff8e6;
  color: #7a4f16;
}

.trie-tray {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.trie-seed {
  min-width: 0;
  min-height: 58px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 6px 4px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.trie-seed-dot {
  width: 20px;
  height: 14px;
  border-radius: 999px 999px 7px 7px;
  background: #9b6b3d;
}

.trie-seed strong {
  color: #17202a;
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
}

.trie-seed-active {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.trie-seed-disabled {
  opacity: 0.55;
}

.trie-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.trie-action {
  min-width: 0;
  min-height: 46px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  touch-action: manipulation;
}

.trie-action-primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

@media (min-width: 620px) {
  .trie-game {
    gap: 14px;
  }

  .trie-query-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .trie-board {
    padding: 14px;
  }
}

@media (max-width: 380px) {
  .trie-hero {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .trie-emblem {
    width: 46px;
    height: 46px;
  }

  .trie-progress {
    grid-column: 1 / -1;
    width: 100%;
  }

  .trie-title {
    font-size: 17px;
  }

  .trie-subtitle {
    font-size: 12px;
  }

  .trie-board {
    padding: 10px;
  }

  .trie-stat {
    padding: 7px 6px;
  }

  .trie-stat strong {
    font-size: 20px;
  }

  .trie-query {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 7px;
  }

  .trie-query-orb {
    width: 30px;
    height: 30px;
  }
}
