:root {
  --gt-bg: #f8fafc;
  --gt-panel: #ffffff;
  --gt-text: #0f172a;
  --gt-muted: #475569;
  --gt-border: #dbe3ef;
  --gt-border-strong: #94a3b8;
  --gt-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.gt-shell {
  font-family: "Space Grotesk", sans-serif;
  color: var(--gt-text);
  max-width: 1200px;
  margin: 20px auto;
  padding: 26px;
  border-radius: 14px;
  border: 1px solid var(--gt-border);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 45%, #eef2ff 100%);
  box-shadow: var(--gt-shadow);
  position: relative;
}

.gt-overlay {
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  margin: 4px 0 14px;
}

.gt-overlay-show {
  display: flex;
}

.gt-overlay-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--gt-border);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.gt-overlay-icon {
  font-size: 24px;
  line-height: 1;
  color: #334155;
  animation: gtOverlaySpin 1.1s linear infinite;
}

.gt-overlay-card-connected {
  border-color: rgba(15, 118, 110, 0.28);
  background: rgba(20, 184, 166, 0.08);
}

.gt-overlay-card-connected .gt-overlay-icon {
  color: #0f766e;
  animation: none;
}

.gt-overlay-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gt-overlay-text strong {
  font-size: 14px;
  font-family: "JetBrains Mono", monospace;
  color: #0f172a;
}

.gt-overlay-text span {
  font-size: 12px;
  color: #475569;
}

@keyframes gtOverlaySpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.gt-head {
  margin-bottom: 16px;
}

.gt-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #334155;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
}

.gt-title {
  margin: 0;
  font-size: clamp(30px, 4.6vw, 50px);
  line-height: 1;
  letter-spacing: -0.02em;
}

.gt-subtitle {
  margin: 10px 0 0;
  color: var(--gt-muted);
  font-size: 15px;
}

.gt-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gt-field label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: "JetBrains Mono", monospace;
  color: var(--gt-muted);
}

.gt-field select {
  width: 100%;
  border: 1px solid var(--gt-border);
  background: var(--gt-panel);
  color: var(--gt-text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.gt-btn {
  border: 1px solid var(--gt-border);
  background: var(--gt-panel);
  color: var(--gt-text);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.gt-btn .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  font-variation-settings:
    "FILL" 1,
    "wght" 500,
    "GRAD" 0,
    "opsz" 24;
}

.gt-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--gt-border-strong);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.gt-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.gt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.gt-bottom-grid {
  align-items: stretch;
}

.gt-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr);
  gap: 10px;
  margin-bottom: 10px;
  align-items: stretch;
}

.gt-side-stack {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  height: 100%;
}

.gt-visual-panel {
  margin-bottom: 10px;
}

.gt-top-grid > .gt-visual-panel {
  margin-bottom: 0;
}

.gt-visual-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.gt-visual-head h3 {
  margin: 0;
}

.gt-visual-layout-field {
  width: 100%;
  max-width: 320px;
  margin-bottom: 0;
  display: block;
}

.gamepad-visualization-svg-container {
  border: 1px solid var(--gt-border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px;
}

#XBOX,
#Playstation {
  display: none;
  width: 100%;
  height: auto;
  max-height: 360px;
}

#XBOX.gt-controller-svg-active,
#Playstation.gt-controller-svg-active {
  display: block;
}

#XBOX [id^="xbox-button-"],
#Playstation [id^="playstation-button-"] {
  transition: stroke 0.12s ease, fill 0.12s ease, transform 0.08s linear;
  transform-box: fill-box;
  transform-origin: center;
}

#XBOX .gt-is-active,
#Playstation .gt-is-active {
  stroke: #0b1220 !important;
  fill: rgba(15, 23, 42, 0.22) !important;
}

.gt-panel {
  border: 1px solid var(--gt-border);
  border-radius: 10px;
  background: var(--gt-panel);
  padding: 12px;
}

.gt-panel h3 {
  margin: 0 0 16px;
  font-size: 14px;
  font-family: "JetBrains Mono", monospace;
}

.gt-triggers-panel > h3 {
  min-height: 42px;
  display: flex;
  align-items: center;
}

.gt-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.gt-panel-head h3 {
  margin: 0;
}

.gt-log-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.gt-kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 7px 10px;
}

.gt-kv > span {
  font-size: 12px;
  color: var(--gt-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: "JetBrains Mono", monospace;
}

.gt-kv > strong {
  font-size: 13px;
  color: var(--gt-text);
  overflow-wrap: anywhere;
}

#gtName {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gt-kv-label-center {
  display: flex;
  align-items: center;
}

.gt-kv-action {
  display: flex;
  align-items: center;
  min-height: 36px;
}

.gt-btn-compact {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 12px;
  gap: 6px;
}

.gt-telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
}

.gt-card {
  border: 1px solid var(--gt-border);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.gt-label {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  color: var(--gt-muted);
}

.gt-card strong {
  display: block;
  margin-top: 7px;
  font-size: 13px;
}

.gt-card progress {
  width: 100%;
  height: 14px;
}

.gt-stick-grid {
  width: 95px;
  height: 95px;
  margin-top: 8px;
  background:
    linear-gradient(to right, #dbe3ef 1px, transparent 1px) 0 0 / 33.33% 100%,
    linear-gradient(to bottom, #dbe3ef 1px, transparent 1px) 0 0 / 100% 33.33%,
    #ffffff;
  border: 1px solid var(--gt-border);
  border-radius: 8px;
  position: relative;
}

.gt-dot {
  width: 10px;
  height: 10px;
  background: #334155;
  border-radius: 999px;
  position: absolute;
  transform: translate(-50%, -50%);
}

.gt-log-table {
  width: 100%;
  border-collapse: collapse;
}

.gt-log-table th,
.gt-log-table td {
  padding: 8px;
  border-bottom: 1px solid var(--gt-border);
  text-align: left;
  font-size: 13px;
}

.gt-log-table tbody {
  display: block;
  height: 340px;
  max-height: 340px;
  overflow: auto;
}

.gt-log-table thead,
.gt-log-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.gt-action {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.gt-action-pressed {
  color: #0f766e;
  background: rgba(20, 184, 166, 0.1);
  border: 1px solid rgba(15, 118, 110, 0.25);
}

.gt-action-released {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(185, 28, 28, 0.25);
}

.gt-log-empty {
  color: var(--gt-muted);
  text-align: center !important;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.02em;
  padding-top: 20px;
  padding-bottom: 20px;
}

@media (max-width: 980px) {
  .gt-log-actions {
    width: 100%;
  }

  .gt-log-actions .gt-btn {
    flex: 1 1 160px;
    justify-content: center;
  }

  .gt-grid {
    grid-template-columns: 1fr;
  }

  .gt-top-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .gt-side-stack {
    grid-template-rows: auto;
    height: auto;
  }

}

@media (max-width: 680px) {
  .gt-shell {
    margin: 12px auto;
    padding: 16px;
  }

  .gt-kv {
    grid-template-columns: 120px 1fr;
  }

  .gt-telemetry-grid {
    grid-template-columns: 1fr;
  }

  .gt-visual-head {
    flex-direction: column;
    align-items: stretch;
  }

  .gt-visual-layout-field {
    max-width: 100%;
  }
}
