.gm-hub {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  max-width: 960px;
  width: 100%;
  margin: 0 auto 1.75rem;
  padding: 0;
  box-sizing: border-box;
}

.gm-hub[hidden] {
  display: none !important;
}

.gm-card {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 168px;
  width: 100%;
  max-width: 100%;
  padding: 1rem 1.05rem 1.1rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fafafa;
  color: inherit;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(210, 0, 0, 0.15);
}

.gm-card--play {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  z-index: 1;
}

.gm-card--play:hover,
.gm-card--play:focus-visible {
  border-color: var(--mg-primary, #d20000);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(210, 0, 0, 0.12);
  outline: none;
}

@media (hover: none) {
  .gm-card--play:hover {
    transform: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  }

  .gm-card--play:active {
    border-color: var(--mg-primary, #d20000);
    background: #fff;
  }
}

.gm-card--soon {
  opacity: 1;
  background: #e4e4e4;
  border-color: rgba(0, 0, 0, 0.08);
  color: #555;
  box-shadow: none;
}

.gm-card--soon .gm-card__title {
  color: #555;
}

.gm-card--soon .gm-card__desc {
  color: #6a6a6a;
}

.gm-card--soon .gm-card__diff-label {
  color: #777;
}

.gm-card__top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  width: 100%;
}

.gm-card__diff {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.gm-card__diff-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
}

.gm-card__diff-dots > span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #d0d0d0;
  display: block;
}

.gm-card__diff-dots > span.is-on {
  background: var(--mg-primary, #d20000);
}

.gm-card__diff-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #666;
}

.gm-card__title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.gm-card__desc {
  font-size: 0.9rem;
  color: #555;
  flex: 1;
}

.gm-card__cta {
  align-self: flex-start;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mg-primary, #d20000);
}

.gm-card__cta--muted {
  color: #777;
  font-weight: 700;
}

.gm-intro__test {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: #7a4b00;
  font-weight: 700;
}

.gm {
  max-width: 720px;
  margin: 0 0 2.5rem;
  scroll-margin-top: 6.5rem;
}

.gm[hidden] {
  display: none !important;
}

.gm.gm--focus {
  max-width: 760px;
  width: 100%;
  margin: 1.25rem auto 2.5rem;
  position: relative;
  z-index: 2;
}

.gm__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 3;
}

.gm__status {
  font-size: 0.9rem;
  color: #555;
}

.gm-intro[hidden],
body.gm-playing .gm-intro {
  display: none !important;
}

body.gm-playing .gm-hub {
  display: none !important;
}

@media (max-width: 860px) {
  .mg-main {
    max-width: 100%;
    width: 100%;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
    box-sizing: border-box;
  }

  .gm-hub {
    grid-template-columns: 1fr;
    max-width: none;
    width: 100%;
    gap: 0.85rem;
  }

  .gm-card {
    min-height: 0;
    padding: 1rem 1rem 1.05rem;
  }

  .gm-card--play {
    min-height: 3.25rem;
  }

  .gm.gm--focus {
    max-width: none;
    width: 100%;
    margin: 0 0 1.5rem;
    padding: 0.35rem 0 1rem;
    min-height: 0;
    box-sizing: border-box;
  }

  .gm.gm--focus .gm__screen {
    min-height: 0;
  }

  .gm__sheet {
    color: #000;
    font-size: 1.05rem;
    line-height: 1.55;
  }

  .gm__toolbar .mg-btn {
    min-height: 2.75rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.gm__screen {
  background: var(--mg-base, rgba(250, 250, 250, 0.92));
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 1.25rem 1.35rem 1.5rem;
}

.gm__lead {
  margin-top: 0;
}

.gm__screen--intro .mg-btn {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.gm__progress {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  font-weight: 700;
}

.gm__bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.gm__bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--mg-primary, #d20000);
  transition: width 0.35s ease;
}

.gm__room-title {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.gm__room-theme {
  margin: 0 0 1rem;
  color: #555;
}

.gm__sheet {
  margin: 0 0 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  border: 1px dashed rgba(0, 0, 0, 0.22);
  background: rgba(255, 252, 245, 0.96);
  color: #000;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
}

.gm__sheet[hidden] {
  display: none !important;
}

.gm__inline-q {
  margin: 0.85rem 0 0.5rem;
  padding: 1rem 1.05rem 1.1rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.gm__inline-q[hidden] {
  display: none !important;
}

.gm__inline-q-label {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #777;
}

.gm__inline-q-title {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  line-height: 1.35;
}

.gm__inline-q-actions {
  margin-top: 0.85rem;
  display: flex;
  justify-content: flex-end;
}

.gm--diario .gm__player {
  display: none;
}

.gm--diario .gm__stage {
  min-height: 0;
  padding: 0.85rem 0.65rem 1rem;
  background: transparent;
  border: 0;
  overflow: visible;
}

.gm__stage {
  position: relative;
  min-height: 200px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(6, 147, 227, 0.12), rgba(210, 0, 0, 0.06)),
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.03) 0,
      rgba(0, 0, 0, 0.03) 12px,
      transparent 12px,
      transparent 24px
    );
  background-size: cover;
  background-position: center;
  padding: 1.25rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  overflow: hidden;
  isolation: isolate;
}

.gm__stage--photo::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.58);
  z-index: 0;
}

.gm__stage > * {
  position: relative;
  z-index: 1;
}

.gm__player {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--mg-primary, #d20000);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(210, 0, 0, 0.35);
  animation: gm-pulse 1.8s ease-in-out infinite;
}

@keyframes gm-pulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.gm__doors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  width: 100%;
  max-width: 420px;
}

.gm__door {
  appearance: none;
  border: 2px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(2px);
  border-radius: 10px;
  min-height: 110px;
  padding: 0.85rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.gm__door:hover:not(:disabled) {
  border-color: var(--mg-primary, #d20000);
  transform: translateY(-2px);
}

.gm__door:disabled {
  cursor: default;
  opacity: 0.95;
}

.gm__door.is-open {
  border-color: #2e7d32;
  background: rgba(46, 125, 50, 0.08);
}

.gm__door-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(210, 0, 0, 0.1);
  color: var(--mg-primary, #d20000);
  font-weight: 700;
}

.gm__door.is-open .gm__door-icon {
  background: rgba(46, 125, 50, 0.15);
  color: #2e7d32;
}

.gm__door-label {
  font-weight: 700;
  text-align: center;
}

.gm__hint-line {
  margin: 1rem 0 0;
  color: #555;
  font-size: 0.95rem;
}

.gm__win-lead {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0.35rem 0 0.75rem;
}

#gmWinBody {
  white-space: pre-line;
}

.gm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.gm__modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.gm__modal[hidden] {
  display: none;
}

.gm__modal-card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 1.2rem 1.25rem 1.35rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  max-height: 90vh;
  overflow: auto;
}

.gm__modal-door {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gm__modal-card h3 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  line-height: 1.35;
}

.gm__options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.gm__option {
  appearance: none;
  text-align: left;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fafafa;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

.gm__option:hover:not(:disabled) {
  border-color: var(--mg-accent, #0693e3);
  background: #fff;
}

.gm__option.is-reveal {
  border-color: #2e7d32;
}

.gm__feedback {
  margin-top: 0.9rem;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  font-size: 0.95rem;
}

.gm__feedback p {
  margin: 0 0 0.45rem;
}

.gm__feedback p:last-child {
  margin-bottom: 0;
}

.gm__feedback--ok {
  background: rgba(46, 125, 50, 0.12);
  color: #1b5e20;
}

.gm__feedback--ko {
  background: rgba(210, 0, 0, 0.08);
  color: #5d0000;
}

.gm__modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 560px) {
  .gm__doors {
    grid-template-columns: 1fr;
  }

  .gm__door {
    min-height: 88px;
  }
}
