.mc-shell {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 16px 22px;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

.cg-shell-game .cg-stage-main #game-root > .mc-shell {
  max-width: min(100%, 780px) !important;
}

.mc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.mc-statline {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}

.mc-stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--cg-line);
  border-radius: 9px;
  background: linear-gradient(180deg, #ffffff, #f2f5ef);
  box-shadow: 0 4px 12px rgba(33, 43, 40, 0.06);
}

.mc-stat span {
  display: block;
  color: var(--cg-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
}

.mc-stat strong {
  display: block;
  color: var(--cg-ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}

.mc-stat:first-child {
  border-color: rgba(196, 122, 23, 0.5);
}

.mc-stat:first-child strong {
  color: var(--cg-amber);
}

.mc-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.mc-btn,
.mc-close {
  min-height: 44px;
  min-width: 44px;
  padding: 0 13px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #eef2ec);
  color: var(--cg-ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(33, 43, 40, 0.07);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.mc-btn:hover:not(:disabled),
.mc-close:hover {
  transform: translateY(-1px);
  border-color: var(--cg-blue);
}

.mc-btn:focus-visible,
.mc-close:focus-visible,
.mc-canvas:focus-visible,
.mc-pad-btn:focus-visible,
.mc-seg-btn:focus-visible {
  outline: 3px solid rgba(49, 95, 157, 0.38);
  outline-offset: 3px;
}

.mc-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.mc-icon {
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 17px;
}

.mc-primary {
  border-color: transparent;
  background: linear-gradient(180deg, #2b6ee0, #1c4fac);
  color: #fff;
}

.mc-hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}

.mc-hud-cell {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid rgba(140, 180, 255, 0.28);
  border-radius: 999px;
  background: rgba(6, 10, 26, 0.72);
  color: #dce9ff;
  backdrop-filter: blur(6px);
}

.mc-hud-cell span {
  color: #8fa6d6;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mc-hud-cell strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mc-h-phase strong { color: #ff8a7a; }
.mc-h-pel strong { color: #ffd166; }
.mc-h-power.is-hot { border-color: #ffd166; background: rgba(60, 40, 120, 0.85); }
.mc-h-power.is-hot strong { color: #ffd166; }
.mc-hid { display: none; }

.mc-powerbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.mc-powerbar i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ffd166, #ff8a4a);
  box-shadow: 0 0 10px #ffd166;
  transform: scaleX(0);
  transform-origin: left;
}

.mc-stage {
  position: relative;
  width: min(100%, 720px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #1d2b52;
  border-radius: 14px;
  background: #060a18;
  box-shadow: var(--cg-shadow), 0 0 0 1px rgba(106, 164, 255, 0.14) inset;
  touch-action: none;
}

.mc-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 19 / 21;
  cursor: pointer;
}

.mc-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  display: grid;
  gap: 2px;
  width: min(88%, 320px);
  padding: 10px 14px;
  border: 1px solid rgba(140, 180, 255, 0.35);
  border-radius: 10px;
  background: rgba(8, 14, 34, 0.78);
  color: #dce9ff;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.mc-hint strong {
  font-size: 15px;
}

.mc-hint span {
  color: #8fa6d6;
  font-size: 12px;
}

.mc-card {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  gap: 6px;
  width: min(88%, 330px);
  padding: 18px 16px;
  border: 1px solid rgba(140, 180, 255, 0.4);
  border-radius: 14px;
  background: rgba(9, 14, 32, 0.93);
  color: #e6efff;
  text-align: center;
  transform: translate(-50%, -50%);
  animation: mc-pop 260ms cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
}

@keyframes mc-pop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.mc-card > span {
  color: #8fa6d6;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mc-card > strong {
  font-size: 30px;
  line-height: 1.05;
}

.mc-card p {
  margin: 0;
  color: #a9bde4;
  font-size: 13px;
}

.mc-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.mc-card-actions .mc-btn {
  flex: 1 1 0;
}

.mc-hidden {
  display: none !important;
}

.mc-pad {
  display: none;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(2, 64px);
  gap: 8px;
  justify-content: center;
  margin: 12px auto 0;
}

.mc-pad-btn {
  min-width: 64px;
  min-height: 64px;
  padding: 0;
  border: 1px solid #2b3c66;
  border-radius: 16px;
  background: linear-gradient(180deg, #1b2947, #101a33);
  color: #cfe0ff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(6, 12, 28, 0.28);
  touch-action: manipulation;
}

.mc-pad-btn.is-on,
.mc-pad-btn:active {
  border-color: #6aa4ff;
  background: linear-gradient(180deg, #2b4a8f, #1b2f5c);
  transform: translateY(1px);
}

.mc-pad-up { grid-column: 2; grid-row: 1; }
.mc-pad-left { grid-column: 1; grid-row: 2; }
.mc-pad-down { grid-column: 2; grid-row: 2; }
.mc-pad-right { grid-column: 3; grid-row: 2; }

.mc-below {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(100%, 720px);
  margin: 12px auto 0;
  flex-wrap: wrap;
}

.mc-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--cg-line);
  border-radius: 12px;
  background: var(--cg-panel);
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
}

.mc-seg-btn {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--cg-muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.mc-seg-btn.is-on {
  border-color: var(--cg-blue);
  background: linear-gradient(180deg, #2b6ee0, #1c4fac);
  color: #fff;
}

.mc-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 14, 28, 0.6);
  backdrop-filter: blur(3px);
}

.mc-modal-card {
  position: relative;
  max-width: 460px;
  padding: 22px 22px 20px;
  border: 1px solid var(--cg-line);
  border-radius: 16px;
  background: var(--cg-panel);
  box-shadow: var(--cg-shadow);
}

.mc-modal-card h2 {
  margin: 0 0 10px;
  font-size: 21px;
}

.mc-modal-card p {
  margin: 0 0 9px;
  color: var(--cg-muted);
  font-size: 14px;
  line-height: 1.5;
}

.mc-modal-card p:last-child {
  margin-bottom: 0;
}

.mc-modal-card b {
  color: var(--cg-ink);
}

.mc-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 15px;
}

@media (pointer: coarse) {
  .mc-pad {
    display: grid;
  }
}

@media (min-width: 900px) {
  .mc-stage {
    width: min(100%, 720px, calc((100vh - 235px) * 19 / 21));
  }
  .mc-below {
    width: min(100%, 720px, calc((100vh - 235px) * 19 / 21));
  }
}

@media (max-width: 640px) {
  .mc-shell {
    max-width: 100%;
    padding: 0 0 12px;
  }
  .cg-shell-game .cg-stage-main #game-root > .mc-shell {
    max-width: 100% !important;
  }
  .mc-topbar {
    padding: 0 8px;
    gap: 6px;
  }
  .mc-stat {
    padding: 5px 7px;
    gap: 4px;
  }
  .mc-stat span {
    font-size: 9px;
  }
  .mc-stat strong {
    font-size: 14px;
  }
  .mc-stat-lvl {
    display: none;
  }
  .mc-share-top {
    display: none;
  }
  .mc-stage {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .mc-below {
    padding: 0 10px;
    margin-top: 8px;
  }
  .mc-seg-btn {
    padding: 0 10px;
    font-size: 14px;
  }
  .mc-pad {
    grid-template-columns: repeat(3, 58px);
    grid-template-rows: repeat(2, 54px);
    margin-top: 8px;
  }
  .mc-pad-btn {
    min-width: 58px;
    min-height: 54px;
  }
}
