:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #0e1117;
  color: #f8fafc;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

#app {
  position: relative;
  background: #121922;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  top: 16px;
  left: 16px;
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 8px;
  align-items: center;
  height: 44px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(14, 17, 23, 0.72);
  backdrop-filter: blur(12px);
}

.hud__brand,
.hud__metric {
  height: 32px;
  border-radius: 6px;
  display: grid;
  align-items: center;
}

.hud__brand {
  padding: 0 12px;
  color: #10151d;
  background: #f4f1e8;
  font-size: 12px;
  font-weight: 800;
}

.hud__metric {
  grid-template-columns: auto minmax(32px, auto);
  gap: 6px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.08);
}

.hud__metric span {
  color: #a8b3c2;
  font-size: 11px;
  font-weight: 700;
}

.hud__metric strong {
  color: #79d6ff;
  font-size: 18px;
  line-height: 1;
  text-align: right;
}

.signal {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 5px;
  align-items: end;
  height: 28px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(14, 17, 23, 0.62);
}

.signal span {
  width: 7px;
  border-radius: 2px;
  background: #79d6ff;
  box-shadow: 0 0 10px rgba(121, 214, 255, 0.75);
}

.signal span:nth-child(1) {
  height: 8px;
}

.signal span:nth-child(2) {
  height: 14px;
}

.signal span:nth-child(3) {
  height: 20px;
}

.camera-slate {
  position: absolute;
  top: 58px;
  right: 18px;
  display: grid;
  grid-template-columns: auto minmax(142px, 1fr);
  gap: 6px;
  align-items: center;
  max-width: min(330px, calc(100vw - 36px));
  height: 34px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(14, 17, 23, 0.64);
  backdrop-filter: blur(12px);
}

.camera-slate strong,
.camera-slate span {
  height: 24px;
  border-radius: 6px;
  display: grid;
  align-items: center;
  line-height: 1;
}

.camera-slate strong {
  padding: 0 8px;
  color: #10151d;
  background: #79d6ff;
  font-size: 11px;
  font-weight: 900;
}

.camera-slate span {
  min-width: 0;
  padding: 0 8px;
  overflow: hidden;
  color: #f4f1e8;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-panel {
  position: absolute;
  left: 16px;
  bottom: 96px;
  display: grid;
  gap: 4px;
  width: min(420px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(14, 17, 23, 0.68);
  backdrop-filter: blur(12px);
}

.story-panel strong {
  color: #f4f1e8;
  font-size: 13px;
  line-height: 1.15;
}

.story-panel span {
  color: #b8c7d6;
  font-size: 12px;
  line-height: 1.35;
}

.dialogue-panel {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: grid;
  gap: 5px;
  width: min(560px, calc(100vw - 32px));
  min-height: 66px;
  padding: 10px 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(9, 13, 18, 0.76);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(14px);
}

.dialogue-panel[hidden] {
  display: none;
}

.dialogue-panel strong {
  color: #f8d477;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
}

.dialogue-panel span {
  color: #f8fafc;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.28;
}

.touch-pad {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: none;
  grid-template-columns: 46px 46px 46px;
  grid-template-rows: 46px 46px;
  gap: 6px;
}

.action-pad {
  position: absolute;
  right: 184px;
  bottom: 18px;
  display: none;
  grid-template-columns: 54px 54px;
  gap: 8px;
}

.touch-pad button,
.action-pad button {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #f8fafc;
  background: rgba(14, 17, 23, 0.7);
  font-size: 18px;
  font-weight: 800;
  touch-action: none;
}

.action-pad button {
  width: 54px;
  height: 54px;
  font-size: 21px;
}

.touch-pad button:active,
.touch-pad button.is-active,
.action-pad button:active,
.action-pad button.is-active {
  color: #10151d;
  background: #79d6ff;
}

.touch-pad [data-control="up"] {
  grid-column: 2;
}

.touch-pad [data-control="left"] {
  grid-column: 1;
  grid-row: 2;
}

.touch-pad [data-control="down"] {
  grid-column: 2;
  grid-row: 2;
}

.touch-pad [data-control="right"] {
  grid-column: 3;
  grid-row: 2;
}

.status {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: #ffe8d5;
  background: rgba(122, 38, 25, 0.88);
  font-size: 13px;
  line-height: 1.4;
}

@media (hover: none) and (pointer: coarse) {
  .touch-pad {
    display: grid;
  }

  .action-pad {
    display: grid;
  }

  .hud {
    top: 12px;
    left: 12px;
    grid-template-columns: auto auto;
    height: auto;
  }

  .hud__brand {
    grid-column: span 2;
    justify-content: center;
  }

  .camera-slate {
    top: 72px;
    right: 12px;
    grid-template-columns: auto minmax(104px, 1fr);
    max-width: calc(100vw - 24px);
  }

  .story-panel {
    left: 12px;
    bottom: 268px;
    width: min(360px, calc(100vw - 24px));
  }

  .dialogue-panel {
    bottom: 188px;
    width: min(360px, calc(100vw - 24px));
    min-height: 58px;
    padding: 9px 11px 10px;
  }

  .dialogue-panel span {
    font-size: 13px;
  }
}
