/* Modern in-game HUD: the office remains the primary surface. */
#shell {
  position: relative;
  display: block;
  height: 100svh;
  overflow: hidden;
  background: radial-gradient(circle at 48% 42%, #183126, #07110d 72%);
  font-family: Inter, "Segoe UI", sans-serif;
}

#shell header {
  position: absolute;
  z-index: 12;
  top: 16px;
  left: 16px;
  right: 364px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 5px 18px;
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 22px;
  background: rgba(6, 18, 14, .62);
  box-shadow: 0 16px 45px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.1);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
}

#shell .brand {
  grid-column: 1;
  grid-row: 1;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: .98rem;
  letter-spacing: .03em;
}
#shell .brand small { display: none; margin-left: 8px; color: rgba(220,237,227,.55); font-size: .58rem; letter-spacing: .08em; }

#shell .day {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  font-size: .72rem;
  letter-spacing: .08em;
  color: rgba(220, 237, 227, .58);
}

#shell .timer {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  margin: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 1.55rem;
  letter-spacing: .03em;
}

#shell header > div:last-child {
  grid-column: 1 / 3;
  grid-row: 2;
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr);
  align-items: center;
  gap: 10px;
}

#shell .meter-label {
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: .66rem;
  letter-spacing: .08em;
  color: rgba(220, 237, 227, .58);
}

#shell .meter {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
}

#shell .meter span {
  border-radius: inherit;
  box-shadow: 0 0 16px rgba(222,109,98,.45);
}

#gameWrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 108px 364px 22px 18px;
}

#gameWrap canvas {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 24px;
  background: rgba(14,32,24,.86);
  box-shadow: 0 24px 70px rgba(0,0,0,.38), inset 0 1px rgba(255,255,255,.08);
  image-rendering: auto;
}

#shell aside {
  position: absolute;
  z-index: 10;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 332px;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 24px;
  background: rgba(6,18,14,.6);
  box-shadow: 0 20px 55px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.08);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
}

#shell .side-title {
  padding: 17px 18px 12px;
  border: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: .8rem;
  letter-spacing: .12em;
}

#shell .chat {
  gap: 9px;
  padding: 8px 13px 13px;
}

#shell .msg {
  border: 1px solid rgba(255,255,255,.1);
  border-left: 3px solid var(--green);
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  padding: 11px 12px;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: .78rem;
}

#shell .msg.system { border-left-color: var(--yellow); }

#shell .tasks {
  max-height: 42%;
  overflow: auto;
  border: 0;
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 15px 17px 18px;
  background: rgba(0,0,0,.14);
}

#shell .tasks h2,
#shell .tasks ul {
  font-family: Inter, "Segoe UI", sans-serif;
}

#shell .tasks h2 { font-size: .7rem; }
#shell .tasks ul { gap: 9px; font-size: .76rem; line-height: 1.35; }

#shell #prompt {
  bottom: 30px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  background: rgba(5,15,12,.72);
  padding: 10px 17px;
  font-family: Inter, "Segoe UI", sans-serif;
  backdrop-filter: blur(15px);
}

#shell .touch button {
  border-color: rgba(255,255,255,.2);
  border-radius: 16px;
  background: rgba(5,15,12,.56);
  box-shadow: 0 10px 28px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.1);
  backdrop-filter: blur(15px);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  cursor: pointer;
}

#shell .touch,
#shell .dpad,
#shell .dpad * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

#shell .touch button:focus {
  outline: none;
}

#shell .touch button:active {
  background: rgba(243,216,107,.2);
  border-color: rgba(243,216,107,.65);
  transform: scale(.96);
}

#shell .touch .act {
  border-radius: 50% !important;
  background: rgba(5,15,12,.68);
}

/* Main Chat now lives inside the office; the side glass only tracks assignments. */
#shell.chat-entity-mode header { right: 282px; }
#shell.chat-entity-mode #gameWrap { padding-right: 282px; }
#shell.chat-entity-mode aside {
  width: 250px;
  top: 16px;
  bottom: auto;
  min-height: 0;
  display: block;
}
#shell.chat-entity-mode .side-title,
#shell.chat-entity-mode .chat { display: none; }
#shell.chat-entity-mode .tasks {
  max-height: none;
  border: 0;
  padding: 17px;
  background: transparent;
}
#shell.chat-entity-mode .tasks li.pending { color: rgba(220,237,227,.42); }
#shell.chat-entity-mode .tasks li.current { color: var(--yellow); font-weight: 800; }
#shell.chat-entity-mode .tasks li.current:before { content: '◉'; }
#shell.chat-entity-mode .tasks li.failed { color: var(--red); text-decoration: line-through; }
#shell.chat-entity-mode .tasks li.failed:before { content: '×'; color: var(--red); }
#shell.chat-entity-mode .tasks li.kadiddle-task { color: #d9ef65; text-shadow: 0 0 12px rgba(185,226,56,.5); }
#shell.kadiddle-alert header { border-color: rgba(185,226,56,.45); box-shadow: 0 0 36px rgba(115,143,25,.22), inset 0 1px rgba(255,255,255,.1); }
#shell.kadiddle-alert .timer { color: #d9ef65; animation: kadiddle-pulse .7s ease-in-out infinite alternate; }
@keyframes kadiddle-pulse { to { text-shadow: 0 0 18px #b9e238; transform: scale(1.04); } }

/* Dialogs and thumbstick styling live in interaction-ui-v1.css. */

@media (max-width: 850px) {
  #shell header {
    top: 10px;
    left: 10px;
    right: 10px;
    grid-template-columns: 1fr auto;
    gap: 5px 10px;
    padding: 11px 13px;
    border-radius: 18px;
  }

  #shell .brand { grid-column: 1; font-size: .82rem; }
  #shell .brand small { display: inline; }
  #shell .timer { grid-column: 2; font-size: 1.2rem; }
  #shell .day { display: none; }
  #shell header > div:last-child { grid-column: 1 / 2; grid-row: 2; }
  #shell .meter-label { display: block; font-size: .58rem; }

  #gameWrap {
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 10px;
    padding: 96px 14px 108px;
  }

  #gameWrap canvas {
    width: 100%;
    height: auto;
    max-height: 100%;
    aspect-ratio: 4 / 3;
    object-fit: fill;
    flex: 0 0 auto;
    border-radius: 18px;
  }

  #shell aside {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    height: 156px;
    grid-template-columns: 1.1fr .9fr;
    grid-template-rows: auto minmax(0,1fr);
    border-radius: 19px;
  }

  #shell .side-title {
    grid-column: 1;
    padding: 10px 12px 5px;
    font-size: .68rem;
  }

  #shell .chat {
    grid-column: 1;
    grid-row: 2;
    padding: 4px 8px 8px;
  }

  #shell .msg {
    padding: 7px 9px;
    border-radius: 11px;
    font-size: .66rem;
  }

  #shell .tasks {
    grid-column: 2;
    grid-row: 1 / 3;
    max-height: none;
    border-top: 0;
    border-left: 1px solid rgba(255,255,255,.12);
    padding: 10px 11px;
  }

  #shell .tasks ul { gap: 5px; font-size: .63rem; }
  #shell .tasks h2 { font-size: .6rem; margin-bottom: 7px; }

  #shell .touch {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 178px;
    padding: 2px 18px 0;
    align-items: center;
    flex: 0 0 auto;
  }

  #shell .dpad {
    grid-template-columns: repeat(3, 58px);
    grid-template-rows: repeat(2, 58px);
    gap: 11px;
  }

  #shell .touch button { border-radius: 19px; font-size: 1.35rem; }
  #shell .touch .act { width: 82px; height: 82px; }
  #shell #prompt { bottom: 270px; }

  #shell.chat-entity-mode header { right: 10px; }
  #shell.chat-entity-mode #gameWrap { padding: 96px 14px 108px; }
  #shell.chat-entity-mode aside {
    top: auto;
    bottom: 8px;
    left: 10px;
    right: 10px;
    width: auto;
    height: 94px;
    display: block;
  }
  #shell.chat-entity-mode .tasks { height: 100%; padding: 10px 13px; overflow: auto; }
  #shell.chat-entity-mode .tasks h2 { margin-bottom: 6px; }
  #shell.chat-entity-mode .tasks ul { grid-template-columns: 1fr 1fr; gap: 3px 10px; }
  #shell.chat-entity-mode .touch { bottom: auto; }
  #shell.chat-entity-mode #prompt { bottom: 300px; }
}

@media (max-height: 680px) and (max-width: 850px) {
  #shell aside { height: 128px; }
  #gameWrap { padding-bottom: 136px; }
  #shell .touch { min-height: 148px; }
}
