*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ctrl-h: 88px;   /* control bar total height */
  --btn-bg: #2a1500;
  --btn-border: #7a4a10;
  --btn-active: #c87020;
  --red: #8b1a1a;
  --green: #1a5c1a;
}

html, body {
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: sans-serif;
}

/* Game fills viewport above control bar */
#dos {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--ctrl-h);
  touch-action: none;
}

/* On desktop (no mobile UA), let the game fill the full window */
body.desktop #dos {
  bottom: 0;
}

/* Control bar */
#ctrl {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--ctrl-h);
  background: #110800;
  border-top: 1px solid #4a2800;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 4px 6px;
  user-select: none;
  -webkit-user-select: none;
}

#ctrl-main,
#ctrl-arrows {
  display: flex;
  gap: 3px;
  flex: 1;
}

#ctrl-arrows {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  /* Aligns to right third of the bar */
  margin-left: auto;
  width: 33%;
  gap: 3px;
}

/* Buttons */
.cb {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--btn-border);
  border-radius: 5px;
  background: var(--btn-bg);
  color: #d4a84b;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 80ms, transform 80ms;
}

.cb:active,
.cb.active {
  background: var(--btn-active);
  color: #fff;
  transform: scale(0.93);
}

.cb.red   { background: var(--red);   border-color: #c04040; }
.cb.green { background: var(--green); border-color: #40a040; }
.cb.red:active,   .cb.red.active   { background: #cc3333; }
.cb.green:active, .cb.green.active { background: #33aa33; }

.cb.arrow { font-size: 16px; }

/* Portrait-mode hint overlay */
#landscape-hint {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 10, 0, 0.93);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#landscape-hint.hidden { display: none !important; }

@media (orientation: portrait) and (max-width: 900px) {
  #landscape-hint { display: flex; }
}

.hint-inner {
  text-align: center;
  color: #d4a84b;
  font-family: serif;
  padding: 2rem;
}
.hint-icon {
  font-size: 4rem;
  animation: rot 2s ease-in-out infinite;
  display: block;
  margin-bottom: 1rem;
}
.hint-inner p { font-size: 1.1rem; }

@keyframes rot {
  0%, 100% { transform: rotate(0deg); }
  50%       { transform: rotate(90deg); }
}
