
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: #0B0F1A;
  color: #FFFFFF;
  font-family: Arial, sans-serif;
  overscroll-behavior: none;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  width: 100vw;
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(240px, 36dvh) 1fr;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 8%, rgba(0, 229, 255, 0.24), transparent 34%),
    radial-gradient(circle at 82% 8%, rgba(255, 45, 154, 0.20), transparent 34%),
    linear-gradient(180deg, #11162A 0%, #0B0F1A 100%);
}

#top {
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid #00E5FF;
}

#cameraZone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#settingsToggle {
  position: absolute;
  top: max(0px, env(safe-area-inset-top));
  left: 0;
  z-index: 110;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  box-shadow: none;
}

#titleHotspot {
  display: none;
}

#status {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  z-index: 10;
  margin: 0;
  font-size: 12px;
  color: rgba(248, 215, 255, 0.75);
  text-align: center;
  pointer-events: none;
}

#vtuberStage {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 18px 8px;
  pointer-events: none;
}

.vtuber {
  display: flex;
  align-items: flex-end;
  transition: opacity 160ms ease;
}

.vtuber img {
  height: min(205px, 28dvh);
  max-width: 42vw;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(0, 0, 0, 0.45));
}

.vtuber.is-hidden {
  visibility: hidden;
}

.vtuber.is-hidden img {
  opacity: 0;
}

#settingsPanel {
  position: absolute;
  top: 48px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(0, 229, 255, 0.38);
  border-radius: 20px;
  background: rgba(7, 11, 24, 0.97);
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

#settingsPanel.hidden {
  display: none;
}

#settingsHeader {
  display: grid;
  grid-template-columns: 1fr 42px;
  align-items: center;
  gap: 8px;
}

#settingsPageTitle {
  text-align: left;
  font-size: 17px;
  font-weight: 900;
  color: #FFFFFF;
  letter-spacing: 0.8px;
}

#closeSettingsBtn {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #00E5FF;
  color: #0B0F1A;
  font-size: 18px;
  font-weight: 900;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.settings-field,
.checkbox-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 800;
}

.settings-field.full,
.checkbox-label.full,
.actions.full {
  grid-column: 1 / -1;
}

.checkbox-label {
  flex-direction: row;
  align-items: center;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  margin: 0;
}

#settingsPanel input,
#settingsPanel select,
#settingsPanel button {
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 10px;
}

#settingsPanel input,
#settingsPanel select {
  padding: 10px 11px;
  background: #FFFFFF;
  color: #111827;
  font-size: 12px;
  font-weight: 700;
}

#settingsPanel button {
  padding: 11px 12px;
  background: #FF2D9A;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 900;
}

.secondary-action {
  background: rgba(255, 255, 255, 0.10) !important;
  border: 1px solid rgba(0, 229, 255, 0.28) !important;
  color: #FFFFFF !important;
}

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

.chat-injector {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

#bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 8px 10px;
  gap: 7px;
  overflow: hidden;
}

#banner {
  width: 100%;
  padding: 6px;
  display: flex;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  text-align: center;
  font-size: 10px;
  font-weight: 900;
}

.legend.cyan {
  color: #00E5FF;
}

.legend.magenta {
  color: #FF2D9A;
}

.legend.dark {
  color: #B7BFCC;
}

#board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
  margin-top: 2px;
}

.board-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.tile {
  width: clamp(46px, 10vw, 58px);
  height: clamp(46px, 10vw, 58px);
  border-radius: 11px;
  background: #2E3440;
  border: 2px solid rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(20px, 4.4vw, 28px);
  font-weight: 900;
  color: #FFFFFF;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.tile.pending {
  border-color: rgba(0, 229, 255, 0.5);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.18);
}

.tile.revealing {
  transform: scale(1.05);
}

.tile.correct {
  background: #00E5FF;
  color: #061018;
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.72);
}

.tile.present {
  background: #FF2D9A;
  color: #FFFFFF;
  box-shadow: 0 0 18px rgba(255, 45, 154, 0.60);
}

.tile.absent {
  background: #111827;
  color: #FFFFFF;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

#keyboard {
  width: 100%;
  display: grid;
  gap: 4px;
  margin-top: 2px;
}

.key-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.key {
  min-width: 22px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  background: #4B5563;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.key.correct {
  background: #00E5FF;
  color: #061018;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.55);
}

.key.present {
  background: #FF2D9A;
  color: #FFFFFF;
  box-shadow: 0 0 12px rgba(255, 45, 154, 0.45);
}

.key.absent {
  background: #2E3440;
  color: #D6DAE3;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

#wordliveSystemBanner {
  position: fixed;
  left: 50%;
  top: max(12px, env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 10050;
  display: none;
  max-width: min(92vw, 720px);
  padding: 14px 20px;
  border-radius: 18px;
  border: 2px solid rgba(0, 229, 255, 0.78);
  background:
    radial-gradient(circle at 50% 25%, rgba(255,45,154,0.22), transparent 42%),
    linear-gradient(180deg, rgba(11,15,26,0.97) 0%, rgba(24,32,48,0.96) 100%);
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.4px;
  text-align: center;
  box-shadow: 0 0 26px rgba(0,229,255,0.28), 0 0 40px rgba(255,45,154,0.18);
  pointer-events: none;
  text-wrap: balance;
}

#wordliveSystemBanner.is-visible {
  display: block;
}

@media (max-width: 420px) {
  #app {
    grid-template-rows: minmax(228px, 34dvh) 1fr;
  }

  #settingsPanel {
    top: 44px;
  }

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

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

  .key {
    min-width: 20px;
    padding: 0 6px;
    font-size: 10px;
  }
}
