:root {
  --mm-red: #DF0000;
  --mm-red-hover: #B30000;
  --mm-black: #000000;
  --mm-white: #FFFFFF;
  --mm-grey: #E5E5E5;
  --mm-bg: #F2F2F2;
  --mm-text: #000000;
  --mm-green: #2ECC71;
  
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --z-header: 100;
  --z-toast: 1000;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background-color: var(--mm-bg);
  color: var(--mm-text);
  line-height: 1.4;
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- 1. Header & Logo --- */
.logo-header {
  background: var(--mm-white);
  padding: 12px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 2px solid var(--mm-red);
  z-index: var(--z-header);
}

#brandLogo {
  height: 32px;
  object-fit: contain;
}

/* --- 2. Layout Elements --- */
.app-main {
  flex: 1;
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--mm-white);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

/* --- 3. Status Bar --- */
.system-status-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 4px 0;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: #888;
}

.dot {
  width: 8px;
  height: 8px;
  background: #CCC;
  border-radius: 50%;
}

.dot.online {
  background: var(--mm-green);
  box-shadow: 0 0 8px var(--mm-green);
}

/* --- 4. Micro Screen Map --- */
.screen-map {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  /* L, Center, R */
  gap: 12px;
  align-items: center;
}

.micro-screen {
  background: #222;
  border: 3px solid var(--mm-grey);
  border-radius: 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

/* Screen Header (The small label) */
.ms-header {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  font-size: 9px;
  font-weight: 900;
  padding: 4px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ms-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #555;
  padding: 12px 4px;
  gap: 6px;
}

.ms-content i {
  font-size: 24px;
}

.ms-text {
  font-size: 10px;
  font-weight: 700;
}

/* Aspect Ratios */
.aspect-portrait {
  aspect-ratio: 9 / 16;
}

.aspect-landscape {
  aspect-ratio: 16 / 9;
}

/* Animation for Pushing */
.ph-spin {
  animation: ph-spin 1s infinite linear;
}

@keyframes ph-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Global Push Button (Optional context) */
.btn-sync {
  margin-top: 10px;
  width: 100%;
  background: var(--mm-red);
  color: var(--mm-white);
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(223, 0, 0, 0.2);
  transition: all 0.2s;
}

.btn-sync:hover:not(:disabled),
.btn-sync:active:not(:disabled) {
  background: var(--mm-red-hover);
  transform: translateY(2px);
  box-shadow: 0 2px 5px rgba(223, 0, 0, 0.2);
}

/* Disabled state when no changes */
.btn-sync:disabled {
  background: var(--mm-grey);
  color: #888;
  box-shadow: none;
  cursor: not-allowed;
}


/* --- 5. Media Upload & Library --- */
.library-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.btn-upload {
  background: var(--mm-black);
  color: var(--mm-white);
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-upload:active {
  transform: scale(0.95);
}

.divider {
  width: 1px;
  height: 20px;
  background: var(--mm-grey);
}

.library-title {
  font-size: 11px;
  font-weight: 800;
  color: #888;
  letter-spacing: 0.5px;
}

.media-pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-media {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--mm-bg);
  border: 1px solid var(--mm-grey);
  padding: 8px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mm-text);
  cursor: pointer;
  transition: all 0.2s;
}

.pill-media i {
  color: #888;
  font-size: 16px;
}

.pill-media.selected {
  background: var(--mm-text);
  color: var(--mm-white);
  border-color: var(--mm-text);
}

.pill-media.selected i {
  color: var(--mm-white);
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: var(--mm-text);
  color: var(--mm-white);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: dropUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left: 4px solid var(--mm-green); }
.toast.error { border-left: 4px solid var(--mm-red); }

@keyframes dropUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.pill-wrapper {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.pill-delete {
  position: absolute;
  right: -8px;
  top: -8px;
  background: var(--mm-red);
  color: var(--mm-white);
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.pill-wrapper:hover .pill-delete {
  opacity: 1;
}

.pill-delete:hover {
  transform: scale(1.1);
  background: var(--mm-red-hover);
}

/* --- Playing Info Overlay --- */
.ms-playing {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, background 0.3s;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.ms-playing.active {
  opacity: 1;
  background: var(--mm-red);
}

.micro-screen {
  position: relative;
  overflow: hidden;
}

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