
/* DBZ Bloodlines Message Mode — isolated from Classic UI */
#mm-toggle{background:#d99424;color:#101523;font-weight:800;border-color:#e6b15b;white-space:nowrap}
#mm-app{display:none;position:fixed;inset:0;z-index:10000;background:#0b1020;color:#e8eef9;font-family:system-ui,-apple-system,Segoe UI,sans-serif;flex-direction:column;overflow:hidden}
body.mm-active #mm-app{display:flex}
body.mm-active{overflow:hidden}
#mm-app *{box-sizing:border-box}
.mm-head{display:flex;align-items:center;gap:10px;padding:calc(10px + env(safe-area-inset-top)) 14px 10px;background:#141d31;border-bottom:1px solid #30405e;flex-shrink:0}
.mm-brand{font-weight:900;letter-spacing:.03em;color:#f7b13d;flex:1}
.mm-sub{font-size:11px;color:#a5b5d0;font-weight:400;letter-spacing:0}
#mm-classic{font-size:12px;background:#283754}
.mm-tabs{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;padding:8px;background:#10192c;flex-shrink:0}
.mm-tab{border:0;border-radius:9px;background:transparent;color:#aebdd4;font-weight:700;padding:12px 6px;font-size:14px}
.mm-tab.active{background:#2c3d5e;color:#fff}
.mm-view{display:none;flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:14px;gap:10px;flex-direction:column}
.mm-view.active{display:flex}
.mm-event{align-self:center;color:#a9b9d2;background:#1a2740;padding:9px 12px;border-radius:12px;font-size:13px;max-width:100%;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.45}
.mm-event.room{align-self:stretch;background:#243454;border-left:3px solid #f7b13d;color:#e8eef9}
.mm-event.output{align-self:stretch;background:#182239;font-family:ui-monospace,monospace}
.mm-chat-message{max-width:85%;background:#243454;border-radius:15px 15px 15px 4px;padding:10px 13px;align-self:flex-start;font-size:14px;overflow-wrap:anywhere;white-space:pre-wrap;line-height:1.45}
.mm-chat-message.mine{background:#285caa;border-radius:15px 15px 4px 15px;align-self:flex-end}
.mm-chat-name{font-size:11px;color:#b7c6e0;font-weight:800;margin-bottom:3px}
.mm-player{width:100%;text-align:left;background:#1e2b46;border:1px solid #344362;padding:14px;border-radius:12px;font-size:14px}
.mm-player.active{border-color:#e4a83d;color:#ffc86d}
.mm-player .unread{background:#bf3c4d;border-radius:20px;padding:2px 7px;margin-left:6px}
.mm-section{color:#93a9c9;font-size:11px;font-weight:800;letter-spacing:.08em;margin:12px 0 2px}
.mm-actions{display:flex;gap:6px;overflow-x:auto;padding:8px 12px;background:#10192c;flex-shrink:0}
.mm-actions button{white-space:nowrap;background:#253553;padding:10px 13px;font-size:13px}
.mm-compose{display:flex;gap:8px;align-items:center;padding:10px 12px calc(10px + env(safe-area-inset-bottom));background:#141d31;border-top:1px solid #30405e;flex-shrink:0}
#mm-input{flex:1;min-width:0;background:#0c1425;border:1px solid #3c4b68;color:white;border-radius:14px;padding:13px;font-size:16px;outline:none}
#mm-send{background:#e4a53a;color:#131725;font-weight:900;border:0;padding:13px 16px}
#mm-target{font-size:12px;color:#a8bbd9;padding:7px 14px;background:#141d31;flex-shrink:0}
@media(min-width:850px){#mm-app{left:50%;transform:translateX(-50%);max-width:850px;box-shadow:0 0 0 100vmax #070b14,0 0 35px #000}}
@media(prefers-reduced-motion:reduce){#mm-app *{scroll-behavior:auto!important}}

/* Group consecutive MUD output lines into readable blocks */
.mm-game-block{
 border-radius:10px;
 padding:12px 14px;
 line-height:1.4;
 white-space:normal;
}

.mm-game-line{
 white-space:pre-wrap;
 min-height:1.2em;
}


/* ==========================================
   iPhone Chrome / Safari viewport fix
   ========================================== */

html,
body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.mm-active {
    overflow: hidden;
}

@media (max-width: 849px) {

    body.mm-active #mm-app {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;

        width: 100%;
        height: 100%;
        max-width: 100%;

        transform: none;
        overflow: hidden;
    }

    #mm-app .mm-view {
        min-width: 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #mm-app .mm-compose {
        width: 100%;
        min-width: 0;
    }

    #mm-app #mm-input {
        flex: 1 1 0;
        min-width: 0;
        width: 0;
        font-size: 16px !important;
    }
}

#mm-app input,
#mm-app textarea,
#mm-app select {
    font-size: 16px !important;
}

#mm-app button,
#mm-app .mm-tabs,
#mm-app .mm-actions {
    touch-action: manipulation;
}

#mm-send {
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}


/* Prevent iOS from zooming into the command input */
@supports (-webkit-touch-callout: none) {
  #mm-app #mm-input {
    font-size: 18px !important;
    line-height: 24px !important;
    -webkit-text-size-adjust: 100%;
    transform: none !important;
    zoom: 1;
  }
}



/* ==========================================
   Mobile Mode — Movement Controls
   ========================================== */

.mm-movement {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: #10192c;
  flex-shrink: 0;
  width: 100%;
  min-width: 0;
}

.mm-direction-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, 44px);
  gap: 6px;
  flex: 1;
  max-width: 300px;
  min-width: 0;
}

.mm-vertical-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, 44px);
  grid-auto-flow: column;
  gap: 6px;
  width: 124px;
  flex: 0 0 124px;
}

#mm-app .mm-movement button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0;
  border: 1px solid #344362;
  border-radius: 9px;
  background: #253553;
  color: #e8eef9;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#mm-app .mm-movement button.mm-color {
  background: #9a671d;
  border-color: #d99424;
  color: #fff;
}

#mm-app .mm-movement button:active {
  background: #3c5684;
}

#mm-app .mm-movement button.mm-look:active {
  background: #bb852c;
}


/* Left-align commands entered by the player */
#mm-game .mm-event:not(.room):not(.output) {
  align-self: flex-start;
  text-align: left;
}

/* Hide movement controls while typing */
body.mm-active #mm-app:has(#mm-input:focus) #mm-actions {
  display: none !important;
}


/* Keep movement buttons stable during touch interactions */
#mm-actions {
  touch-action: manipulation;
}

#mm-actions button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* Hide movement controls only while the keyboard is being used */
/*
body.mm-active #mm-app:has(#mm-input:focus) #mm-actions {
  display: flex !important;
}*/

/* Keep movement buttons stable and responsive */
#mm-actions {
  touch-action: manipulation;
}

#mm-actions button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body.mm-active #mm-actions {
  flex-shrink: 0;
  visibility: visible;
  opacity: 1;
}

body.mm-active #mm-actions button {
  pointer-events: auto;
}